Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
3e0a7bff
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
3e0a7bff
编写于
7月 18, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4292 XTS元能力失败用例适配
Merge pull request !4292 from chengxingzhen/master
上级
9b94a21d
15a44974
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
371 addition
and
759 deletion
+371
-759
ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js
...ckfifthscene/src/main/js/test/MangerAbilityJsunit.test.js
+1
-1
ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js
...ckfirstscene/src/main/js/test/MangerAbilityJsunit.test.js
+1
-1
ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js
...kfourthscene/src/main/js/test/MangerAbilityJsunit.test.js
+1
-1
ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js
...ksecondscene/src/main/js/test/MangerAbilityJsunit.test.js
+1
-1
ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js
...ckthirdscene/src/main/js/test/MangerAbilityJsunit.test.js
+1
-1
ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js
...stfifthscene/src/main/js/test/MangerAbilityJsunit.test.js
+1
-1
ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js
...stfirstscene/src/main/js/test/MangerAbilityJsunit.test.js
+1
-1
ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js
...tfourthscene/src/main/js/test/MangerAbilityJsunit.test.js
+1
-1
ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js
...tsecondscene/src/main/js/test/MangerAbilityJsunit.test.js
+1
-1
ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js
...stthirdscene/src/main/js/test/MangerAbilityJsunit.test.js
+1
-1
ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/test/DataAbilityHelperJsSt.test.js
...test/entry/src/main/js/test/DataAbilityHelperJsSt.test.js
+1
-0
ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/Ability.test.ets
...omationquerytest/entry/src/main/ets/test/Ability.test.ets
+1
-1
ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js
...ytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js
+323
-717
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets
...ry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets
+13
-11
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets
...ry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets
+17
-15
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets
...ry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets
+6
-5
未找到文件。
ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
3e0a7bff
...
...
@@ -132,7 +132,7 @@ export default function ActsAmsCallBackFifthScene() {
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Equal
(
0
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Larger
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
...
...
ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
3e0a7bff
...
...
@@ -76,7 +76,7 @@ export default function ActsAmsCallBackFirstScene() {
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Equal
(
0
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Larger
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
...
...
ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
3e0a7bff
...
...
@@ -127,7 +127,7 @@ export default function ActsAmsCallBackFourthScene() {
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Equal
(
0
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Larger
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
...
...
ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
3e0a7bff
...
...
@@ -93,7 +93,7 @@ export default function ActsAmsCallBackSecondScene() {
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Equal
(
0
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Larger
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
...
...
ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
3e0a7bff
...
...
@@ -87,7 +87,7 @@ export default function ActsAmsCallBackThirdScene() {
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Equal
(
0
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Larger
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
...
...
ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
3e0a7bff
...
...
@@ -144,7 +144,7 @@ export default function ActsAmsTestFifthScene() {
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Equal
(
0
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Larger
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
...
...
ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
3e0a7bff
...
...
@@ -78,7 +78,7 @@ export default function ActsAmsTestFirstScene() {
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Equal
(
0
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Larger
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
...
...
ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
3e0a7bff
...
...
@@ -144,7 +144,7 @@ export default function ActsAmsTestFourthScene() {
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Equal
(
0
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Larger
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
...
...
ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
3e0a7bff
...
...
@@ -100,7 +100,7 @@ export default function ActsAmsTestSecondScene() {
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Equal
(
0
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Larger
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
...
...
ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js
浏览文件 @
3e0a7bff
...
...
@@ -102,7 +102,7 @@ export default function ActsAmsTestThirdScene() {
expect
(
typeof
(
info
[
i
].
processName
)).
assertEqual
(
"
string
"
);
expect
(
info
[
i
].
processName
.
length
).
assertLarger
(
0
);
expect
(
Array
.
isArray
(
info
[
i
].
bundleNames
)).
assertEqual
(
true
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Equal
(
0
);
expect
(
info
[
i
].
bundleNames
.
length
).
assert
Larger
(
0
);
expect
(
typeof
(
info
[
i
].
uid
)).
assertEqual
(
"
number
"
);
expect
(
info
[
i
].
uid
).
assertLarger
(
0
);
...
...
ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/entry/src/main/js/test/DataAbilityHelperJsSt.test.js
浏览文件 @
3e0a7bff
...
...
@@ -35,6 +35,7 @@ describe('ActsDataAbilityHelperTest', function () {
console
.
debug
(
'
ACTS_beforeAll DAHelper ====>:
'
+
DAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
DAHelper
));
if
(
DAHelper
==
null
){
console
.
debug
(
'
ACTS_beforeAll DAHelper ====>: DAHelper == null
'
);
return
;
}
}
catch
(
err
)
{
console
.
error
(
'
=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:
'
+
err
);
...
...
ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
3e0a7bff
...
...
@@ -212,7 +212,7 @@ export default function abilityTest(abilityContext) {
expect(data.formEnabled).assertEqual(false);
expect(data.type).assertEqual(1);
expect(data.subType).assertEqual(0);
expect(data.orientation).assertEqual(
0
);
expect(data.orientation).assertEqual(
2
);
expect(data.launchMode).assertEqual(0);
expect(data.permissions.length).assertEqual(0);
expect(data.deviceTypes[0]).assertEqual("phone");
...
...
ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js
浏览文件 @
3e0a7bff
...
...
@@ -16,50 +16,48 @@ import featureAbility from '@ohos.ability.featureAbility'
import
wantconstant
from
'
@ohos.ability.wantConstant
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
commonEvent
from
'
@ohos.commonEvent
'
import
notification
from
'
@ohos.notification
'
;
import
wantAgent
from
'
@ohos.wantAgent
'
;
import
particleAbility
from
'
@ohos.ability.particleAbility
'
import
backgroundTaskManager
from
'
@ohos.backgroundTaskManager
'
const
CREATELOCALDIR
=
"
/data/storage/el2/base/haps/entry
"
;
const
START_ABILITY_TIMEOUT
=
4000
;
const
TERMINATE_ABILITY_TIMEOUT
=
1000
;
const
TIMEOUT
=
1000
;
const
errCode
=
1
;
var
subscriberInfoActsStartAbility0100
=
{
let
subscriberInfoActsStartAbility0100
=
{
events
:
[
"
ACTS_StartAbility_0100_CommonEvent
"
],
};
var
subscriberInfoActsStartAbility0200
=
{
let
subscriberInfoActsStartAbility0200
=
{
events
:
[
"
ACTS_StartAbility_0200_CommonEvent
"
],
};
var
subscriberInfoActsStartAbility0300
=
{
let
subscriberInfoActsStartAbility0300
=
{
events
:
[
"
ACTS_StartAbility_0300_CommonEvent
"
],
};
var
subscriberInfoActsStartAbility0400
=
{
let
subscriberInfoActsStartAbility0400
=
{
events
:
[
"
ACTS_StartAbility_0400_CommonEvent
"
],
};
var
subscriberInfoActsStartAbility0500
=
{
let
subscriberInfoActsStartAbility0500
=
{
events
:
[
"
ACTS_StartAbility_0500_CommonEvent
"
],
};
var
subscriberInfoActsStartAbility0600
=
{
let
subscriberInfoActsStartAbility0600
=
{
events
:
[
"
ACTS_StartAbility_0600_CommonEvent
"
],
};
var
subscriberInfoStartAbilityTen
=
{
let
subscriberInfoStartAbilityTen
=
{
events
:
[
"
ACTS_StartAbility_1000_CommonEvent
"
],
};
var
subscriberInfoStartAbilityThirteen
=
{
let
subscriberInfoStartAbilityThirteen
=
{
events
:
[
"
ACTS_StartAbility_1300_CommonEvent
"
],
};
var
subscriberInfoTerminateAbilityTwo
=
{
let
subscriberInfoTerminateAbilityTwo
=
{
events
:
[
"
ACTS_TerminateAbility_0200_CommonEvent
"
,
"
ACTS_TerminateAbility_0200_Return
"
],
};
var
subscriberInfoActsGetCallingBundle0100
=
{
let
subscriberInfoActsGetCallingBundle0100
=
{
events
:
[
"
ACTS_GetCallingBundle_0100_CommonEvent
"
,
"
com.example.actsfeatureabilitytest.promise
"
,
"
com.example.actsfeatureabilitytest.callback
"
],
};
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
));
}
describe
(
'
ActsFeatureAbilityTest
'
,
function
()
{
beforeAll
(
function
()
{
...
...
@@ -98,344 +96,6 @@ describe('ActsFeatureAbilityTest', function () {
setTimeout
(()
=>
{},
500
);
})
/*
* @tc.name:Acts_ContinuousTask_0100
* @tc.desc:verify new startBackgroundrunning interface promise mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7U AR000GH6ER AR000GH6EM AR000GH6EN AR000GH6EO
*/
it
(
"
Acts_ContinuousTask_0100
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
Acts_ContinuousTask_0100 start
"
);
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
"
com.example.actsfeatureabilitytest
"
,
abilityName
:
"
com.example.actsfeatureabilitytest.MainAbility
"
}
],
operationType
:
2
,
requestCode
:
0
,
wantAgentFlags
:
[
3
]
};
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
data
)
=>
{
backgroundTaskManager
.
startBackgroundRunning
(
featureAbility
.
getContext
(),
backgroundTaskManager
.
BackgroundMode
.
DATA_TRANSFER
,
data
).
then
(()
=>
{
console
.
log
(
"
Acts_ContinuousTask_0100 startBackgroundRunning success
"
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
}).
catch
((
err
)
=>
{
expect
(
false
).
assertTrue
();
console
.
log
(
"
Acts_ContinuousTask_0100 startBackgroundRunning failure
"
);
setTimeout
(()
=>
{
done
();
},
500
);
});
});
})
/*
* @tc.name:Acts_ContinuousTask_0200
* @tc.desc:verify new startBackgroundrunning interface callback mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7T AR000GH6ER AR000GH6EP AR000GJ9PR AR000GH6G8
*/
it
(
"
Acts_ContinuousTask_0200
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
Acts_ContinuousTask_0200 start
"
);
function
conTaskCallback
(
err
,
data
)
{
if
(
err
)
{
console
.
info
(
'
Acts_ContinuousTask_0200 startBackgroundRunning failed
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Acts_ContinuousTask_0200 startBackgroundRunning succeed
'
);
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
"
com.example.actsfeatureabilitytest
"
,
abilityName
:
"
com.example.actsfeatureabilitytest.MainAbility
"
}
],
operationType
:
2
,
requestCode
:
0
,
wantAgentFlags
:
[
3
]
};
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
data
)
=>
{
backgroundTaskManager
.
startBackgroundRunning
(
featureAbility
.
getContext
(),
backgroundTaskManager
.
BackgroundMode
.
DATA_TRANSFER
,
data
,
conTaskCallback
);
});
})
/*
* @tc.name:Acts_ContinuousTask_0300
* @tc.desc:verify old startBackgroundrunning interface promise mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7V AR000GH6ER AR000GH6EM AR000GH6G9 AR000GH56K
*/
it
(
"
Acts_ContinuousTask_0300
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
Acts_ContinuousTask_0300 start
"
);
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
"
com.example.actsfeatureabilitytest
"
,
abilityName
:
"
com.example.actsfeatureabilitytest.MainAbility
"
}
],
operationType
:
2
,
requestCode
:
0
,
wantAgentFlags
:
[
3
]
};
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
data
)
=>
{
let
basicContent
=
{
title
:
"
title
"
,
text
:
"
text
"
};
let
notificationContent
=
{
contentType
:
notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
basicContent
};
let
request
=
{
content
:
notificationContent
,
wantAgent
:
data
}
let
id
=
1
;
particleAbility
.
startBackgroundRunning
(
id
,
request
).
then
((
data
)
=>
{
console
.
log
(
"
Acts_ContinuousTask_0300 startBackgroundRunning success
"
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
}).
catch
((
err
)
=>
{
expect
(
false
).
assertTrue
();
console
.
log
(
"
Acts_ContinuousTask_0300 startBackgroundRunning failure
"
);
setTimeout
(()
=>
{
done
();
},
500
);
});
});
})
/*
* @tc.name:Acts_ContinuousTask_0400
* @tc.desc:verify old startBackgroundrunning interface callback mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT81 AR000GH6ER AR000GH6EM AR000GH6G9 AR000GH6ET
*/
it
(
"
Acts_ContinuousTask_0400
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
Acts_ContinuousTask_0400 start
"
);
function
conTaskCallback
(
err
,
data
)
{
if
(
err
)
{
console
.
info
(
'
Acts_ContinuousTask_0400 startBackgroundRunning failure
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Acts_ContinuousTask_0400 startBackgroundRunning success
'
);
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
"
com.example.actsfeatureabilitytest
"
,
abilityName
:
"
com.example.actsfeatureabilitytest.MainAbility
"
}
],
operationType
:
2
,
requestCode
:
0
,
wantAgentFlags
:
[
3
]
};
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
data
)
=>
{
let
basicContent
=
{
title
:
"
title
"
,
text
:
"
text
"
};
let
notificationContent
=
{
contentType
:
notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
basicContent
};
let
request
=
{
content
:
notificationContent
,
wantAgent
:
data
}
let
id
=
1
;
particleAbility
.
startBackgroundRunning
(
id
,
request
,
conTaskCallback
);
});
})
/*
* @tc.name:Acts_ContinuousTask_0500
* @tc.desc:verify new api stopBackgroundrunning interface promise mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7U AR000GH6ES AR000GH6EM AR000GH6EN AR000GH6EO
*/
it
(
"
Acts_ContinuousTask_0500
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
Acts_ContinuousTask_0500 start
"
);
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
"
com.example.actsfeatureabilitytest
"
,
abilityName
:
"
com.example.actsfeatureabilitytest.MainAbility
"
}
],
operationType
:
2
,
requestCode
:
0
,
wantAgentFlags
:
[
3
]
};
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
data
)
=>
{
backgroundTaskManager
.
startBackgroundRunning
(
featureAbility
.
getContext
(),
backgroundTaskManager
.
BackgroundMode
.
DATA_TRANSFER
,
data
).
then
((
data
)
=>
{
backgroundTaskManager
.
stopBackgroundRunning
(
featureAbility
.
getContext
()).
then
((
data
)
=>
{
console
.
log
(
"
Acts_ContinuousTask_0500 cancelBackgroundRunning success
"
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
}).
catch
((
err
)
=>
{
expect
(
false
).
assertTrue
();
console
.
log
(
"
Acts_ContinuousTask_0500 cancelBackgroundRunning failure
"
);
setTimeout
(()
=>
{
done
();
},
500
);
});
})
});
})
/*
* @tc.name:Acts_ContinuousTask_0600
* @tc.desc:verify new api stopBackgroundrunning interface callback mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7T AR000GH6ES AR000GH6EP AR000GJ9PR AR000GH6G8
*/
it
(
"
Acts_ContinuousTask_0600
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
Acts_ContinuousTask_0600 start
"
);
function
conTaskCallback
(
err
,
data
)
{
if
(
err
)
{
console
.
info
(
'
Acts_ContinuousTask_0600 startBackgroundRunning failure
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Acts_ContinuousTask_0600 startBackgroundRunning success
'
);
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
"
com.example.actsfeatureabilitytest
"
,
abilityName
:
"
com.example.actsfeatureabilitytest.MainAbility
"
}
],
operationType
:
2
,
requestCode
:
0
,
wantAgentFlags
:
[
3
]
};
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
data
)
=>
{
backgroundTaskManager
.
startBackgroundRunning
(
featureAbility
.
getContext
(),
backgroundTaskManager
.
BackgroundMode
.
DATA_TRANSFER
,
data
).
then
((
data
)
=>
{
backgroundTaskManager
.
stopBackgroundRunning
(
featureAbility
.
getContext
(),
conTaskCallback
);
})
});
})
/*
* @tc.name:Acts_ContinuousTask_0700
* @tc.desc:verify old api cancelBackgroundrunning interface promise mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7V AR000GH6ES AR000GH6EM AR000GH6G9 AR000GH56K
*/
it
(
"
Acts_ContinuousTask_0700
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
Acts_ContinuousTask_0700 start
"
);
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
"
com.example.actsfeatureabilitytest
"
,
abilityName
:
"
com.example.actsfeatureabilitytest.MainAbility
"
}
],
operationType
:
2
,
requestCode
:
0
,
wantAgentFlags
:
[
3
]
};
await
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
data
)
=>
{
particleAbility
.
startBackgroundRunning
(
data
);
setTimeout
(()
=>
{
},
500
);
});
particleAbility
.
cancelBackgroundRunning
().
then
(()
=>
{
console
.
log
(
"
Acts_ContinuousTask_0700 cancelBackgroundRunning success
"
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
}).
catch
(
(
err
)
=>
{
expect
(
false
).
assertTrue
();
console
.
log
(
"
Acts_ContinuousTask_0700 cancelBackgroundRunning failure
"
);
setTimeout
(()
=>
{
done
();
},
500
);
});
})
/*
* @tc.name:Acts_ContinuousTask_0800
* @tc.desc:verify old cancelBackgroundrunning interface callback mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT81 AR000GH6ES AR000GH6EM AR000GH6G9 AR000GH6ET
*/
it
(
"
Acts_ContinuousTask_0800
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
Acts_ContinuousTask_0800 start
"
);
function
conTaskCallback
(
err
,
data
)
{
if
(
err
)
{
console
.
info
(
'
Acts_ContinuousTask_0800 startBackgroundRunning failure
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
Acts_ContinuousTask_0800 startBackgroundRunning success
'
);
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
"
com.example.actsfeatureabilitytest
"
,
abilityName
:
"
com.example.actsfeatureabilitytest.MainAbility
"
}
],
operationType
:
2
,
requestCode
:
0
,
wantAgentFlags
:
[
3
]
};
await
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
data
)
=>
{
particleAbility
.
startBackgroundRunning
(
data
);
setTimeout
(()
=>
{
},
500
);
});
particleAbility
.
cancelBackgroundRunning
(
conTaskCallback
);
})
/**
* @tc.number: ACTS_wantConstant_0100
* @tc.name: wantConstant : Check specific enum
...
...
@@ -482,7 +142,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by Promise)
*/
it
(
'
ACTS_GetContext_0100
'
,
0
,
async
function
(
done
)
{
var
promise
=
await
featureAbility
.
getContext
()
let
promise
=
await
featureAbility
.
getContext
()
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
done
();
})
...
...
@@ -493,14 +153,10 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by Promise)
*/
it
(
'
ACTS_HasWindowFocus_0100
'
,
0
,
async
function
(
done
)
{
var
promise
=
featureAbility
.
hasWindowFocus
();
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
var
info
=
await
featureAbility
.
hasWindowFocus
();
let
info
=
await
featureAbility
.
hasWindowFocus
();
expect
(
info
).
assertEqual
(
true
);
console
.
info
(
'
====> ACTS_HasWindowFocus_0100 end=====>
'
)
done
();
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_HasWindowFocus_0100 =====>
'
)
},
TIMEOUT
)
})
/**
...
...
@@ -509,18 +165,15 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_HasWindowFocus_0300
'
,
0
,
async
function
(
done
)
{
var
result
=
featureAbility
.
hasWindowFocus
(
let
result
=
featureAbility
.
hasWindowFocus
(
(
err
,
data
)
=>
{
console
.
log
(
"
hasWindowFocus asyncCallback code:
"
+
err
.
code
+
"
data:
"
+
data
);
console
.
info
(
"
hasWindowFocus asyncCallback code:
"
+
err
.
code
+
"
data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertTrue
();
done
()
}
);
console
.
info
(
'
AceApplication : hasWindowFocus :
'
+
result
);
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_HasWindowFocus_0300 =====>
'
)
},
TIMEOUT
)
})
/*
...
...
@@ -532,7 +185,7 @@ describe('ActsFeatureAbilityTest', function () {
it
(
"
ACTS_StartAbility_1000
"
,
0
,
async
function
(
done
){
console
.
info
(
"
------------------logMessage ACTS_StartAbility_1000-------------------
"
);
try
{
var
Subscriber
;
let
Subscriber
;
let
id
;
function
SubscribeCallBack
(
err
,
data
)
{
...
...
@@ -567,17 +220,17 @@ describe('ActsFeatureAbilityTest', function () {
abilityName
:
"
com.example.startability.MainAbility
"
,
uri
:
"
xxxxx
"
,
}
var
StartAbilityParameter
=
{
let
StartAbilityParameter
=
{
want
:
Want
}
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1000 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
console
.
info
(
'
ACTS_StartAbility_1000 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
==
0
).
assertTrue
();
});
}
catch
(
error
){
console
.
log
(
"
ACTS_StartAbility_1000 : error =
"
+
error
);
console
.
info
(
"
ACTS_StartAbility_1000 : error =
"
+
error
);
}
})
...
...
@@ -587,7 +240,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by Promise)
*/
it
(
'
ACTS_StartAbility_0100
'
,
0
,
async
function
(
done
)
{
var
Subscriber
;
let
Subscriber
;
let
id
;
function
SubscribeCallBack
(
err
,
data
)
{
...
...
@@ -617,7 +270,7 @@ describe('ActsFeatureAbilityTest', function () {
}
id
=
setTimeout
(
timeout
,
START_ABILITY_TIMEOUT
);
var
promise
=
await
featureAbility
.
startAbility
(
let
promise
=
await
featureAbility
.
startAbility
(
{
want
:
{
...
...
@@ -669,7 +322,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Pass the parameters, Check the return value of the interface (by Promise)
*/
it
(
'
ACTS_StartAbility_0200
'
,
0
,
async
function
(
done
)
{
var
Subscriber
;
let
Subscriber
;
let
id
;
function
SubscribeCallBack
(
err
,
data
)
{
...
...
@@ -700,7 +353,7 @@ describe('ActsFeatureAbilityTest', function () {
id
=
setTimeout
(
timeout
,
START_ABILITY_TIMEOUT
);
console
.
debug
(
'
=======wait id======
'
);
var
promise
=
await
featureAbility
.
startAbility
(
let
promise
=
await
featureAbility
.
startAbility
(
{
want
:
{
...
...
@@ -763,7 +416,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Passing null, Check the return value of the interface (by Promise)
*/
it
(
'
ACTS_StartAbility_0300
'
,
0
,
async
function
(
done
)
{
var
Subscriber
;
let
Subscriber
;
let
id
;
function
SubscribeCallBack
(
err
,
data
)
{
...
...
@@ -793,7 +446,7 @@ describe('ActsFeatureAbilityTest', function () {
}
id
=
setTimeout
(
timeout
,
START_ABILITY_TIMEOUT
);
var
promise
=
await
featureAbility
.
startAbility
(
let
promise
=
await
featureAbility
.
startAbility
(
{
want
:
{
...
...
@@ -845,7 +498,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_StartAbility_0400
'
,
0
,
async
function
(
done
)
{
var
Subscriber
;
let
Subscriber
;
let
id
;
function
SubscribeCallBack
(
err
,
data
)
{
...
...
@@ -875,7 +528,7 @@ describe('ActsFeatureAbilityTest', function () {
}
id
=
setTimeout
(
timeout
,
START_ABILITY_TIMEOUT
);
var
result
=
featureAbility
.
startAbility
(
let
result
=
featureAbility
.
startAbility
(
{
want
:
{
...
...
@@ -918,7 +571,7 @@ describe('ActsFeatureAbilityTest', function () {
},
},
(
error
,
data
)
=>
{
console
.
log
(
'
featureAbilityTest startAbility asyncCallback errCode :
'
+
error
+
"
data:
"
+
data
)
console
.
info
(
'
featureAbilityTest startAbility asyncCallback errCode :
'
+
error
+
"
data:
"
+
data
)
},
);
...
...
@@ -930,7 +583,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Pass the parameters, Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_StartAbility_0500
'
,
0
,
async
function
(
done
)
{
var
Subscriber
;
let
Subscriber
;
let
id
;
function
SubscribeCallBack
(
err
,
data
)
{
...
...
@@ -960,7 +613,7 @@ describe('ActsFeatureAbilityTest', function () {
}
id
=
setTimeout
(
timeout
,
START_ABILITY_TIMEOUT
);
var
result
=
featureAbility
.
startAbility
(
let
result
=
featureAbility
.
startAbility
(
{
want
:
{
...
...
@@ -1014,7 +667,7 @@ describe('ActsFeatureAbilityTest', function () {
},
},
(
error
,
data
)
=>
{
console
.
log
(
'
featureAbilityTest startAbility asyncCallback errCode :
'
+
error
+
"
data:
"
+
data
)
console
.
info
(
'
featureAbilityTest startAbility asyncCallback errCode :
'
+
error
+
"
data:
"
+
data
)
},
);
...
...
@@ -1026,7 +679,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Passing null, Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_StartAbility_0600
'
,
0
,
async
function
(
done
)
{
var
Subscriber
;
let
Subscriber
;
let
id
;
function
SubscribeCallBack
(
err
,
data
)
{
...
...
@@ -1056,7 +709,7 @@ describe('ActsFeatureAbilityTest', function () {
}
id
=
setTimeout
(
timeout
,
START_ABILITY_TIMEOUT
);
var
result
=
featureAbility
.
startAbility
(
let
result
=
featureAbility
.
startAbility
(
{
want
:
{
...
...
@@ -1099,7 +752,7 @@ describe('ActsFeatureAbilityTest', function () {
},
},
(
error
,
data
)
=>
{
console
.
log
(
'
featureAbilityTest startAbility asyncCallback errCode :
'
+
error
+
"
data:
"
+
data
)
console
.
info
(
'
featureAbilityTest startAbility asyncCallback errCode :
'
+
error
+
"
data:
"
+
data
)
},
);
...
...
@@ -1111,7 +764,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it
(
'
ACTS_TerminateAbility_0200
'
,
0
,
async
function
(
done
)
{
var
Subscriber
;
let
Subscriber
;
let
id
;
let
events
=
new
Map
();
...
...
@@ -1147,9 +800,9 @@ describe('ActsFeatureAbilityTest', function () {
commonEvent
.
unsubscribe
(
Subscriber
,
UnSubscribeCallback
)
done
();
}
console
.
log
(
'
=====start ability=====
'
);
console
.
info
(
'
=====start ability=====
'
);
id
=
setTimeout
(
timeout
,
START_ABILITY_TIMEOUT
);
var
promise
=
featureAbility
.
startAbility
(
let
promise
=
featureAbility
.
startAbility
(
{
want
:
{
...
...
@@ -1167,76 +820,9 @@ describe('ActsFeatureAbilityTest', function () {
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
})
// checkAbilityName
function
checkAbilityName
(
info
)
{
console
.
log
(
"
AbilityName name :
"
+
info
);
expect
(
typeof
(
info
)).
assertEqual
(
"
string
"
);
expect
(
info
).
assertEqual
(
"
com.example.actsfeatureabilitytest.MainAbility
"
);
}
/**
* @tc.number: ACTS_GetAbilityName_0100
* @tc.name: GetAbilityName : Obtains the class name in this ability name, without the prefixed bundle name.
* @tc.desc: Check the return type of the interface (by Promise)
*/
it
(
'
ACTS_GetAbilityName_0100
'
,
0
,
async
function
(
done
)
{
var
promise
=
featureAbility
.
getAbilityName
();
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
var
info
=
await
featureAbility
.
getAbilityName
();
checkAbilityName
(
info
);
done
();
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetAbilityName_0100 =====>
'
)
},
TIMEOUT
)
})
/**
* @tc.number: ACTS_GetAbilityName_0200
* @tc.name: GetAbilityName : Obtains the class name in this ability name, without the prefixed bundle name.
* @tc.desc: Check the return type of the interface (by AsyncCallback)
*/
it
(
'
ACTS_GetAbilityName_0200
'
,
0
,
async
function
(
done
)
{
var
result
=
featureAbility
.
getAbilityName
(
(
err
,
data
)
=>
{
checkAbilityName
(
data
);
done
()
}
);
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetAbilityName_0200 =====>
'
)
},
TIMEOUT
)
})
// checkApplicationInfo
function
checkApplicationInfo
(
info
)
{
console
.
log
(
"
getApplicationInfo :
"
+
info
)
console
.
log
(
"
name :
"
+
info
.
name
);
console
.
log
(
"
description :
"
+
info
.
description
);
console
.
log
(
"
descriptionId :
"
+
info
.
descriptionId
);
console
.
log
(
"
systemApp :
"
+
info
.
systemApp
);
console
.
log
(
"
enabled :
"
+
info
.
enabled
);
console
.
log
(
"
label :
"
+
info
.
label
);
console
.
log
(
"
labelId :
"
+
info
.
labelId
);
console
.
log
(
"
icon :
"
+
info
.
icon
);
console
.
log
(
"
iconId :
"
+
info
.
iconId
);
console
.
log
(
"
process :
"
+
info
.
process
);
console
.
log
(
"
supportedModes :
"
+
info
.
supportedModes
);
console
.
log
(
"
moduleSourceDirs length :
"
+
info
.
moduleSourceDirs
.
length
);
for
(
var
j
=
0
;
j
<
info
.
moduleSourceDirs
.
length
;
j
++
)
{
console
.
log
(
"
info.moduleSourceDirs[
"
+
j
+
"
] :
"
+
info
.
moduleSourceDirs
[
j
]);
}
console
.
log
(
"
permissions length :
"
+
info
.
permissions
.
length
);
for
(
var
j
=
0
;
j
<
info
.
permissions
.
length
;
j
++
)
{
console
.
log
(
"
info.permissions[
"
+
j
+
"
] :
"
+
info
.
permissions
[
j
]);
}
console
.
log
(
"
moduleInfos length :
"
+
info
.
moduleInfos
.
length
);
for
(
var
j
=
0
;
j
<
info
.
moduleInfos
.
length
;
j
++
)
{
console
.
log
(
"
info.moduleInfos[
"
+
j
+
"
].moduleName :
"
+
info
.
moduleInfos
[
j
].
moduleName
);
console
.
log
(
"
info.moduleInfos[
"
+
j
+
"
].moduleSourceDir :
"
+
info
.
moduleInfos
[
j
].
moduleSourceDir
);
}
console
.
log
(
"
entryDir :
"
+
info
.
entryDir
);
console
.
info
(
"
getApplicationInfo :
"
+
info
)
expect
(
typeof
(
info
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
.
name
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
.
description
)).
assertEqual
(
"
string
"
);
...
...
@@ -1272,6 +858,7 @@ describe('ActsFeatureAbilityTest', function () {
"
com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest
"
);
expect
(
info
.
entryDir
).
assertEqual
(
"
/data/app/el1/bundle/public/
"
+
"
com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest
"
);
console
.
info
(
"
getApplicationInfo : end
"
)
}
/**
...
...
@@ -1280,15 +867,17 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by Promise)
*/
it
(
'
ACTS_GetApplicationInfo_0100
'
,
0
,
async
function
(
done
)
{
var
context
=
featureAbility
.
getContext
();
var
promise
=
context
.
getApplicationInfo
();
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
var
info
=
await
context
.
getApplicationInfo
();
checkApplicationInfo
(
info
);
done
();
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetApplicationInfo_0100 =====>
'
)
},
TIMEOUT
)
let
context
=
featureAbility
.
getContext
();
await
context
.
getApplicationInfo
().
then
((
data
)
=>
{
checkApplicationInfo
(
data
);
console
.
info
(
"
ACTS_GetApplicationInfo_0100 info :
"
+
JSON
.
stringify
(
data
))
console
.
info
(
'
====> ACTS_GetApplicationInfo_0100 end=====>
'
)
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
'
====> ACTS_GetApplicationInfo_0100 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
()
});
})
/**
...
...
@@ -1297,24 +886,26 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_GetApplicationInfo_0200
'
,
0
,
async
function
(
done
)
{
var
context
=
featureAbility
.
getContext
()
var
result
=
context
.
getApplicationInfo
(
let
context
=
featureAbility
.
getContext
()
context
.
getApplicationInfo
(
(
err
,
data
)
=>
{
checkApplicationInfo
(
data
);
done
()
if
(
err
.
code
!=
0
){
console
.
info
(
'
====> ACTS_GetApplicationInfo_0200 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
()
}
else
{
console
.
info
(
'
====> ACTS_GetApplicationInfo_0200 data=====>
'
+
JSON
.
stringify
(
data
))
checkApplicationInfo
(
data
);
done
()
}
}
);
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetApplicationInfo_0200 =====>
'
)
},
TIMEOUT
)
await
sleep
(
1000
)
})
// checkProcessInfo
function
checkProcessInfo
(
info
)
{
console
.
log
(
"
checkProcessInfo ProcessInfo:
"
+
info
);
console
.
log
(
"
checkProcessInfo processName :
"
+
info
.
processName
);
console
.
log
(
"
checkProcessInfo pid :
"
+
info
.
pid
);
console
.
info
(
"
checkProcessInfo ProcessInfo:
"
+
info
);
expect
(
typeof
(
info
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
.
processName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
.
pid
)).
assertEqual
(
"
number
"
);
...
...
@@ -1327,15 +918,17 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by promise)
*/
it
(
'
ACTS_GetProcessInfo_0100
'
,
0
,
async
function
(
done
)
{
var
context
=
featureAbility
.
getContext
()
var
promise
=
context
.
getProcessInfo
();
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
var
info
=
await
context
.
getProcessInfo
();
checkProcessInfo
(
info
);
done
();
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetProcessInfo_0100 =====>
'
)
},
TIMEOUT
)
let
context
=
featureAbility
.
getContext
()
await
context
.
getProcessInfo
().
then
((
data
)
=>
{
checkProcessInfo
(
data
);
console
.
info
(
"
ACTS_GetProcessInfo_0100 info :
"
+
JSON
.
stringify
(
data
))
console
.
info
(
'
====> ACTS_GetProcessInfo_0100 end=====>
'
)
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
'
====> ACTS_GetProcessInfo_0100 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
()
});
})
/**
...
...
@@ -1344,27 +937,26 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by AsyncCallback)
*/
it
(
'
ACTS_GetProcessInfo_0200
'
,
0
,
async
function
(
done
)
{
var
context
=
featureAbility
.
getContext
()
var
result
=
context
.
getProcessInfo
(
let
context
=
featureAbility
.
getContext
()
context
.
getProcessInfo
(
(
err
,
data
)
=>
{
checkProcessInfo
(
data
);
done
()
if
(
err
.
code
!=
0
){
console
.
info
(
'
====> ACTS_GetProcessInfo_0200 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
()
}
else
{
console
.
info
(
'
====> ACTS_GetProcessInfo_0200 data=====>
'
+
JSON
.
stringify
(
data
))
checkProcessInfo
(
data
);
done
()
}
}
);
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetProcessInfo_0200 =====>
'
)
},
TIMEOUT
)
await
sleep
(
1000
)
})
// checkElementName
function
checkElementName
(
info
)
{
console
.
log
(
"
getElementName :
"
+
info
);
console
.
log
(
"
deviceId :
"
+
info
.
deviceId
);
console
.
log
(
"
bundleName :
"
+
info
.
bundleName
);
console
.
log
(
"
abilityName :
"
+
info
.
abilityName
);
console
.
log
(
"
uri :
"
+
info
.
uri
);
console
.
log
(
"
shortName :
"
+
info
.
shortName
);
console
.
info
(
"
getElementName :
"
+
info
);
expect
(
typeof
(
info
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
info
.
deviceId
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
info
.
bundleName
)).
assertEqual
(
"
string
"
);
...
...
@@ -1377,6 +969,7 @@ describe('ActsFeatureAbilityTest', function () {
expect
(
info
.
abilityName
).
assertEqual
(
"
com.example.actsfeatureabilitytest.MainAbility
"
);
expect
(
info
.
uri
).
assertEqual
(
""
);
expect
(
info
.
shortName
).
assertEqual
(
""
);
console
.
info
(
"
getElementName : end
"
);
}
/**
...
...
@@ -1385,15 +978,17 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it
(
'
ACTS_GetElementName_0100
'
,
0
,
async
function
(
done
)
{
var
context
=
featureAbility
.
getContext
()
var
promise
=
context
.
getElementName
();
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
var
info
=
await
context
.
getElementName
();
checkElementName
(
info
);
done
();
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetElementName_0100 =====>
'
)
},
TIMEOUT
)
let
context
=
featureAbility
.
getContext
()
await
context
.
getElementName
().
then
((
data
)
=>
{
checkElementName
(
data
);
console
.
info
(
"
ACTS_GetElementName_0100 info :
"
+
JSON
.
stringify
(
data
))
console
.
info
(
'
====> ACTS_GetElementName_0100 end=====>
'
)
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
'
====> ACTS_GetElementName_0100 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
()
});
})
/**
...
...
@@ -1402,21 +997,25 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_GetElementName_0200
'
,
0
,
async
function
(
done
)
{
var
context
=
featureAbility
.
getContext
()
var
result
=
context
.
getElementName
(
let
context
=
featureAbility
.
getContext
()
context
.
getElementName
(
(
err
,
data
)
=>
{
checkElementName
(
data
);
done
()
if
(
err
.
code
!=
0
){
console
.
info
(
'
====> ACTS_GetProcessInfo_0200 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
()
}
else
{
console
.
info
(
'
====> ACTS_GetProcessInfo_0200 data=====>
'
+
JSON
.
stringify
(
data
))
checkElementName
(
data
);
done
()
}
}
);
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetElementName_0200 =====>
'
)
},
TIMEOUT
)
await
sleep
(
1000
)
})
// checkAppType
function
checkAppType
(
info
)
{
console
.
log
(
"
AppType :
"
+
info
);
console
.
info
(
"
AppType :
"
+
info
);
expect
(
typeof
(
info
)).
assertEqual
(
"
string
"
);
expect
(
info
).
assertEqual
(
"
system
"
);
}
...
...
@@ -1427,14 +1026,16 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it
(
'
ACTS_GetAppType_0100
'
,
0
,
async
function
(
done
)
{
var
promise
=
featureAbility
.
getAppType
();
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
var
info
=
await
featureAbility
.
getAppType
();
checkAppType
(
info
);
done
();
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetAppType_0100 =====>
'
)
},
TIMEOUT
)
await
featureAbility
.
getContext
().
getAppType
().
then
((
data
)
=>
{
console
.
info
(
"
ACTS_GetAppType_0100 getAppType info :
"
+
JSON
.
stringify
(
data
))
checkAppType
(
data
);
console
.
info
(
'
====> ACTS_GetAppType_0100 end=====>
'
)
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
'
====> ACTS_GetAppType_0100 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
()
});
})
/**
...
...
@@ -1443,59 +1044,23 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_GetAppType_0200
'
,
0
,
async
function
(
done
)
{
var
result
=
featureAbility
.
getAppType
(
(
err
,
data
)
=>
{
checkAppType
(
data
);
featureAbility
.
getContext
().
getAppType
((
err
,
data
)
=>
{
if
(
err
.
code
!=
0
){
console
.
info
(
"
ACTS_GetAppType_0200 getAppType callback err :
"
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
()
}
);
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetAppType_0200 =====>
'
)
},
TIMEOUT
)
}
else
{
console
.
info
(
"
ACTS_GetAppType_0200 getAppType callback data :
"
+
JSON
.
stringify
(
data
))
checkAppType
(
data
)
done
()
}
});
await
sleep
(
1000
)
})
// checkAbilityInfo
function
checkAbilityInfo
(
data
)
{
console
.
log
(
"
checkAbilityInfo start
"
+
data
);
console
.
log
(
"
checkAbilityInfo bundleName :
"
+
data
.
bundleName
);
console
.
log
(
"
checkAbilityInfo name :
"
+
data
.
name
);
console
.
log
(
"
checkAbilityInfo label :
"
+
data
.
label
);
console
.
log
(
"
checkAbilityInfo description :
"
+
data
.
description
);
console
.
log
(
"
checkAbilityInfo icon :
"
+
data
.
icon
);
console
.
log
(
"
checkAbilityInfo labelId :
"
+
data
.
labelId
);
console
.
log
(
"
checkAbilityInfo descriptionId :
"
+
data
.
descriptionId
);
console
.
log
(
"
checkAbilityInfo iconId :
"
+
data
.
iconId
);
console
.
log
(
"
checkAbilityInfo moduleName :
"
+
data
.
moduleName
);
console
.
log
(
"
checkAbilityInfo process :
"
+
data
.
process
);
console
.
log
(
"
checkAbilityInfo isVisible :
"
+
data
.
isVisible
);
console
.
log
(
"
checkAbilityInfo type :
"
+
data
.
type
)
console
.
log
(
"
checkAbilityInfo orientation :
"
+
data
.
orientation
);
console
.
log
(
"
checkAbilityInfo launchMode :
"
+
data
.
launchMode
);
console
.
log
(
"
checkAbilityInfo uri :
"
+
data
.
uri
);
console
.
log
(
"
checkAbilityInfo promise readPermission :
"
+
data
.
readPermission
);
console
.
log
(
"
checkAbilityInfo writePermission :
"
+
data
.
writePermission
);
console
.
log
(
"
checkAbilityInfo formEntity :
"
+
data
.
formEntity
);
console
.
log
(
"
checkAbilityInfo minFormHeight :
"
+
data
.
minFormHeight
);
console
.
log
(
"
checkAbilityInfo defaultFormHeight :
"
+
data
.
defaultFormHeight
);
console
.
log
(
"
checkAbilityInfo minFormWidth :
"
+
data
.
minFormWidth
);
console
.
log
(
"
checkAbilityInfo defaultFormWidth :
"
+
data
.
defaultFormWidth
);
console
.
log
(
"
checkAbilityInfo targetAbility :
"
+
data
.
targetAbility
);
console
.
log
(
"
checkAbilityInfo backgroundModes :
"
+
data
.
backgroundModes
);
console
.
log
(
"
checkAbilityInfo subType :
"
+
data
.
subType
);
console
.
log
(
"
checkAbilityInfo formEnabled :
"
+
data
.
formEnabled
);
console
.
log
(
"
checkAbilityInfo permissions length :
"
+
data
.
permissions
.
length
);
for
(
var
j
=
0
;
j
<
data
.
permissions
.
length
;
j
++
)
{
console
.
log
(
"
getAbilityInfo data.permissions[
"
+
j
+
"
] :
"
+
data
.
permissions
[
j
]);
}
console
.
log
(
"
checkAbilityInfo deviceTypes length :
"
+
data
.
deviceTypes
.
length
);
for
(
var
j
=
0
;
j
<
data
.
deviceTypes
.
length
;
j
++
)
{
console
.
log
(
"
getAbilityInfo data.deviceTypes[
"
+
j
+
"
] :
"
+
data
.
deviceTypes
[
j
]);
}
console
.
log
(
"
checkAbilityInfo deviceCapabilities length :
"
+
data
.
deviceCapabilities
.
length
);
for
(
var
j
=
0
;
j
<
data
.
deviceCapabilities
.
length
;
j
++
)
{
console
.
log
(
"
getAbilityInfo data.deviceCapabilities[
"
+
j
+
"
] :
"
+
data
.
deviceCapabilities
[
j
]);
}
console
.
info
(
"
checkAbilityInfo start
"
+
data
);
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
.
bundleName
)).
assertEqual
(
"
string
"
);
...
...
@@ -1561,7 +1126,7 @@ describe('ActsFeatureAbilityTest', function () {
expect
(
data
.
defaultFormWidth
).
assertEqual
(
0
);
expect
(
data
.
uri
).
assertEqual
(
"
uriTest
"
);
console
.
log
(
"
checkAbilityInfo end
"
+
data
);
console
.
info
(
"
checkAbilityInfo end
"
+
data
);
}
/**
...
...
@@ -1570,15 +1135,15 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it
(
'
ACTS_GetAbilityInfo_0100
'
,
0
,
async
function
(
done
)
{
var
promise
=
featureAbility
.
getAbilityInfo
();
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
var
info
=
await
featureAbility
.
getAbilityInfo
();
checkAbilityInfo
(
info
);
done
();
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetAbilityInfo_0100 =====>
'
)
}
,
TIMEOUT
)
await
featureAbility
.
getContext
().
getAbilityInfo
().
then
((
data
)
=>
{
checkAbilityInfo
(
data
);
console
.
info
(
'
====> ACTS_GetAbilityInfo_0100 data=====>
'
+
JSON
.
stringify
(
data
))
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
'
====> ACTS_GetAbilityInfo_0100 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
(
)
}
);
})
/**
...
...
@@ -1587,42 +1152,24 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_GetAbilityInfo_0200
'
,
0
,
async
function
(
done
)
{
var
result
=
featureAbility
.
getAbilityInfo
(
featureAbility
.
getContext
()
.
getAbilityInfo
(
(
err
,
data
)
=>
{
checkAbilityInfo
(
data
);
done
()
if
(
err
.
code
!=
0
){
expect
().
assertFail
()
done
()
}
else
{
console
.
info
(
'
====> ACTS_GetAbilityInfo_0200 =====>
'
+
JSON
.
stringify
(
data
))
checkAbilityInfo
(
data
);
done
()
}
}
);
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetAbilityInfo_0200 =====>
'
)
},
TIMEOUT
)
await
sleep
(
1000
)
})
// checkHapModuleInfo
function
checkHapModuleInfo
(
data
)
{
console
.
log
(
"
checkHapModuleInfo start
"
+
data
);
console
.
log
(
"
checkHapModuleInfo name :
"
+
data
.
name
);
console
.
log
(
"
checkHapModuleInfo description :
"
+
data
.
description
);
console
.
log
(
"
checkHapModuleInfo descriptionId :
"
+
data
.
descriptionId
);
console
.
log
(
"
checkHapModuleInfo icon :
"
+
data
.
icon
);
console
.
log
(
"
checkHapModuleInfo label :
"
+
data
.
label
);
console
.
log
(
"
checkHapModuleInfo labelId :
"
+
data
.
labelId
);
console
.
log
(
"
checkHapModuleInfo iconId :
"
+
data
.
iconId
);
console
.
log
(
"
checkHapModuleInfo backgroundImg :
"
+
data
.
backgroundImg
);
console
.
log
(
"
checkHapModuleInfo supportedModes :
"
+
data
.
supportedModes
);
console
.
log
(
"
checkHapModuleInfo reqCapabilities length :
"
+
data
.
reqCapabilities
.
length
);
for
(
var
j
=
0
;
j
<
data
.
reqCapabilities
.
length
;
j
++
)
{
console
.
log
(
"
getHapModuleInfo data.reqCapabilities[
"
+
j
+
"
] :
"
+
data
.
reqCapabilities
[
j
]);
}
console
.
log
(
"
checkHapModuleInfo deviceTypes length :
"
+
data
.
deviceTypes
.
length
);
for
(
var
j
=
0
;
j
<
data
.
deviceTypes
.
length
;
j
++
)
{
console
.
log
(
"
getHapModuleInfo data.deviceTypes[
"
+
j
+
"
] :
"
+
data
.
deviceTypes
[
j
]);
}
console
.
log
(
"
checkHapModuleInfo abilityInfos length :
"
+
data
.
abilityInfos
.
length
);
console
.
log
(
"
checkHapModuleInfo moduleName :
"
+
data
.
moduleName
);
console
.
log
(
"
checkHapModuleInfo mainAbilityName :
"
+
data
.
mainAbilityName
);
console
.
log
(
"
checkHapModuleInfo installationFree :
"
+
data
.
installationFree
);
console
.
info
(
"
checkHapModuleInfo start
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
);
expect
(
typeof
(
data
.
name
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
description
)).
assertEqual
(
"
string
"
);
...
...
@@ -1635,11 +1182,10 @@ describe('ActsFeatureAbilityTest', function () {
expect
(
typeof
(
data
.
supportedModes
)).
assertEqual
(
"
number
"
);
expect
(
Array
.
isArray
(
data
.
reqCapabilities
)).
assertEqual
(
true
);
expect
(
Array
.
isArray
(
data
.
deviceTypes
)).
assertEqual
(
true
);
expect
(
Array
.
isArray
(
data
.
abilityInfo
s
)).
assertEqual
(
true
);
expect
(
Array
.
isArray
(
data
.
abilityInfo
)).
assertEqual
(
true
);
expect
(
typeof
(
data
.
moduleName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
mainAbilityName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
installationFree
)).
assertEqual
(
"
boolean
"
);
expect
(
data
.
name
).
assertEqual
(
"
com.example.actsfeatureabilitytest
"
);
expect
(
data
.
description
).
assertEqual
(
"
descriptionTest
"
);
expect
(
data
.
descriptionId
).
assertEqual
(
0
);
...
...
@@ -1649,15 +1195,13 @@ describe('ActsFeatureAbilityTest', function () {
expect
(
data
.
iconId
).
assertEqual
(
0
);
expect
(
data
.
backgroundImg
).
assertEqual
(
""
);
expect
(
data
.
supportedModes
).
assertEqual
(
0
);
expect
(
data
.
reqCapabilities
[
0
]).
assertEqual
(
"
reqCapabilitiesTest1
"
);
expect
(
data
.
reqCapabilities
[
1
]).
assertEqual
(
"
reqCapabilitiesTest2
"
);
expect
(
data
.
deviceTypes
[
0
]).
assertEqual
(
"
phone
"
);
expect
(
data
.
moduleName
).
assertEqual
(
"
entry
"
)
expect
(
data
.
mainAbilityName
).
assertEqual
(
""
);
expect
(
data
.
installationFree
).
assertEqual
(
false
);
console
.
log
(
"
checkHapModuleInfo end
"
+
data
);
console
.
info
(
"
checkHapModuleInfo end
"
+
data
);
}
/**
...
...
@@ -1666,14 +1210,16 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it
(
'
ACTS_GetHapModuleInfo_0100
'
,
0
,
async
function
(
done
)
{
var
promise
=
featureAbility
.
getHapModuleInfo
();
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
var
info
=
await
featureAbility
.
getHapModuleInfo
();
checkHapModuleInfo
(
info
);
done
();
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetHapModuleInfo_0100 =====>
'
)
},
TIMEOUT
)
await
featureAbility
.
getContext
().
getHapModuleInfo
().
then
((
data
)
=>
{
checkHapModuleInfo
(
data
);
console
.
info
(
'
====> ACTS_GetHapModuleInfo_0100 data=====>
'
+
JSON
.
stringify
(
data
))
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
'
====> ACTS_GetHapModuleInfo_0100 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
()
});
})
/**
...
...
@@ -1682,20 +1228,26 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_GetHapModuleInfo_0200
'
,
0
,
async
function
(
done
)
{
var
result
=
featureAbility
.
getHapModuleInfo
(
let
tempInfo
featureAbility
.
getContext
().
getHapModuleInfo
(
(
err
,
data
)
=>
{
checkHapModuleInfo
(
data
);
done
()
if
(
err
.
code
!=
0
){
expect
().
assertFail
()
done
()
}
else
{
console
.
info
(
'
====> ACTS_GetHapModuleInfo_0200 =====>
'
+
JSON
.
stringify
(
tempInfo
))
tempInfo
=
data
checkHapModuleInfo
(
tempInfo
);
done
()
}
}
);
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetHapModuleInfo_0200 =====>
'
)
},
TIMEOUT
)
await
sleep
(
1000
)
})
// checkProcessName
function
checkProcessName
(
info
)
{
console
.
log
(
"
checkProcessName processName :
"
+
info
);
console
.
info
(
"
checkProcessName processName :
"
+
info
);
expect
(
typeof
(
info
)).
assertEqual
(
"
string
"
);
expect
(
info
).
assertEqual
(
"
processTestAbility
"
);
}
...
...
@@ -1706,15 +1258,16 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it
(
'
ACTS_GetProcessName_0100
'
,
0
,
async
function
(
done
)
{
var
context
=
featureAbility
.
getContext
();
var
promise
=
context
.
getProcessName
();
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
var
info
=
await
context
.
getProcessName
();
checkProcessName
(
info
);
done
();
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetProcessName_0100 =====>
'
)
},
TIMEOUT
)
let
context
=
featureAbility
.
getContext
();
await
context
.
getProcessName
().
then
((
data
)
=>
{
console
.
info
(
'
====> ACTS_GetProcessName_0100 data=====>
'
+
JSON
.
stringify
(
data
))
checkProcessName
(
data
);
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
'
====> ACTS_GetProcessName_0100 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
();
});
})
/**
...
...
@@ -1723,16 +1276,22 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_GetProcessName_0200
'
,
0
,
async
function
(
done
)
{
var
context
=
featureAbility
.
getContext
();
var
result
=
context
.
getProcessName
(
let
tempInfo
let
context
=
featureAbility
.
getContext
();
context
.
getProcessName
(
(
err
,
data
)
=>
{
checkProcessName
(
data
);
done
()
if
(
err
.
code
!=
0
){
expect
().
assertFail
()
done
()
}
else
{
tempInfo
=
data
checkProcessName
(
tempInfo
);
console
.
info
(
'
====> ACTS_GetProcessName_0200 =====>
'
+
JSON
.
stringify
(
tempInfo
))
done
()
}
}
);
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetProcessName_0200 =====>
'
)
},
TIMEOUT
)
await
sleep
(
1000
)
})
/**
...
...
@@ -1740,8 +1299,8 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.name: GetCallingBundle : Obtains the bundle name of the ability that called the current ability.
* @tc.desc: Check the return type of the interface (by AsyncCallback)
*/
it
(
'
ACTS_GetCallingBundle_0100
'
,
0
,
async
function
(
done
)
{
var
Subscriber
;
it
(
'
ACTS_GetCallingBundle_0100
'
,
0
,
async
function
(
done
)
{
let
Subscriber
;
let
id
;
let
events
=
new
Map
();
...
...
@@ -1783,7 +1342,7 @@ describe('ActsFeatureAbilityTest', function () {
done
();
}
id
=
setTimeout
(
timeout
,
START_ABILITY_TIMEOUT
);
var
result
=
await
featureAbility
.
startAbility
(
await
featureAbility
.
startAbility
(
{
want
:
{
...
...
@@ -1794,35 +1353,46 @@ describe('ActsFeatureAbilityTest', function () {
);
})
// checkGetOrCreateLocalDir
function
checkGetOrCreateLocalDir
(
info
)
{
console
.
info
(
"
checkGetOrCreateLocalDir root dir :
"
+
info
);
expect
(
info
).
assertEqual
(
"
/data/storage/el2/base/haps/entry
"
);
}
// @tc.number: ACTS_GetOrCreateLocalDir_0100
// @tc.name: GetProcessName : Obtains the name of the current process.
// @tc.desc: Check the return value of the interface (by promise)
it
(
'
ACTS_GetOrCreateLocalDir_0100
'
,
0
,
async
function
(
done
)
{
var
context
=
featureAbility
.
getContext
();
var
promise
=
context
.
getOrCreateLocalDir
();
expect
(
typeof
(
promise
)).
assertEqual
(
"
object
"
);
var
info
=
await
context
.
getOrCreateLocalDir
();
expect
(
info
).
assertEqual
(
CREATELOCALDIR
);
done
();
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetOrCreateLocalDir_0100 =====>
'
)
},
TIMEOUT
)
let
context
=
featureAbility
.
getContext
();
await
context
.
getOrCreateLocalDir
().
then
((
data
)
=>
{
checkGetOrCreateLocalDir
(
data
);
console
.
info
(
'
====> ACTS_GetOrCreateLocalDir_0100 data=====>
'
+
JSON
.
stringify
(
data
))
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
'
====> ACTS_GetOrCreateLocalDir_0100 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
()
})
})
// @tc.number: ACTS_GetOrCreateLocalDir_0200
// @tc.name: GetProcessName : Obtains the name of the current process.
// @tc.desc: Check the return value of the interface (by AsyncCallback)
it
(
'
ACTS_GetOrCreateLocalDir_0200
'
,
0
,
async
function
(
done
)
{
var
context
=
featureAbility
.
getContext
();
var
result
=
context
.
getOrCreateLocalDir
(
let
context
=
featureAbility
.
getContext
();
context
.
getOrCreateLocalDir
(
(
err
,
data
)
=>
{
expect
(
data
).
assertEqual
(
CREATELOCALDIR
);
done
()
}
);
setTimeout
(
function
()
{
console
.
info
(
'
====> ACTS_GetOrCreateLocalDir_0200 =====>
'
)
},
TIMEOUT
)
if
(
err
.
code
!=
0
){
console
.
info
(
'
====> ACTS_GetOrCreateLocalDir_0200 err=====>
'
+
JSON
.
stringify
(
err
))
expect
().
assertFail
()
done
()
}
else
{
console
.
info
(
'
====> ACTS_GetOrCreateLocalDir_0200 data=====>
'
+
JSON
.
stringify
(
data
))
checkGetOrCreateLocalDir
(
data
);
done
()
}
});
await
sleep
(
1000
)
})
/*
...
...
@@ -1839,18 +1409,23 @@ describe('ActsFeatureAbilityTest', function () {
bundleName
:
"
com.example.startability
"
,
abilityName
:
"
com.example.startability.MainAbilityXXXXX
"
,
}
var
StartAbilityParameter
=
{
let
StartAbilityParameter
=
{
want
:
Want
}
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_0700 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
console
.
info
(
'
ACTS_StartAbility_0700 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
(
errCode
).
assertEqual
(
error
.
code
);
done
();
if
(
err
.
code
!=
0
){
expect
(
err
.
code
).
assertEqual
(
1
);
done
();
}
else
{
expect
().
assertFail
()
done
()
}
});
}
catch
(
error
){
console
.
log
(
"
ACTS_StartAbility_0700 : error =
"
+
error
);
console
.
info
(
"
ACTS_StartAbility_0700 : error =
"
+
error
);
}
});
...
...
@@ -1868,18 +1443,23 @@ describe('ActsFeatureAbilityTest', function () {
bundleName
:
"
com.example.startabilityxxxxx
"
,
abilityName
:
"
com.example.startability.MainAbility
"
,
}
var
StartAbilityParameter
=
{
let
StartAbilityParameter
=
{
want
:
Want
}
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_0800 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
console
.
info
(
'
ACTS_StartAbility_0800 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
!=
0
).
assertTrue
();
done
();
if
(
err
.
code
!=
0
){
expect
(
err
.
code
).
assertEqual
(
1
);
done
();
}
else
{
expect
().
assertFail
()
done
()
}
});
}
catch
(
error
){
console
.
log
(
"
ACTS_StartAbility_0800 : error =
"
+
error
);
console
.
info
(
"
ACTS_StartAbility_0800 : error =
"
+
error
);
}
});
...
...
@@ -1897,18 +1477,23 @@ describe('ActsFeatureAbilityTest', function () {
bundleName
:
"
com.example.startability
"
,
abilityName
:
"
com.example.startability.MainAbility
"
,
}
var
StartAbilityParameter
=
{
let
StartAbilityParameter
=
{
want
:
Want
}
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_0900 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
console
.
info
(
'
ACTS_StartAbility_0900 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
)
+
"
err.code:
"
+
err
.
code
);
expect
(
err
.
code
!=
0
).
assertTrue
();
done
();
if
(
err
.
code
!=
0
){
expect
(
err
.
code
!=
0
).
assertTrue
();
done
();
}
else
{
expect
().
assertFail
()
done
()
}
});
}
catch
(
error
){
console
.
log
(
"
ACTS_StartAbility_0900 : error =
"
+
error
);
console
.
info
(
"
ACTS_StartAbility_0900 : error =
"
+
error
);
}
});
...
...
@@ -1924,18 +1509,23 @@ describe('ActsFeatureAbilityTest', function () {
let
Want
=
{
action
:
"
action.sysxxxtem.homexxxx
"
}
var
StartAbilityParameter
=
{
let
StartAbilityParameter
=
{
want
:
Want
}
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1100 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
console
.
info
(
'
ACTS_StartAbility_1100 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
!=
0
).
assertTrue
();
done
();
if
(
err
.
code
!=
0
){
expect
(
err
.
code
).
assertEqual
(
1
);
done
();
}
else
{
expect
().
assertFail
()
done
()
}
});
}
catch
(
error
){
console
.
log
(
"
ACTS_StartAbility_1100 : error =
"
+
error
);
console
.
info
(
"
ACTS_StartAbility_1100 : error =
"
+
error
);
}
});
...
...
@@ -1952,18 +1542,23 @@ describe('ActsFeatureAbilityTest', function () {
action
:
"
action.system.home
"
,
entities
:
[
"
entity.system.homexxxxxxxxx
"
]
}
var
StartAbilityParameter
=
{
let
StartAbilityParameter
=
{
want
:
Want
}
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1200 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
console
.
info
(
'
ACTS_StartAbility_1200 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
!=
0
).
assertTrue
();
done
();
if
(
err
.
code
!=
0
){
expect
(
err
.
code
).
assertEqual
(
1
);
done
();
}
else
{
expect
().
assertFail
()
done
()
}
});
}
catch
(
error
){
console
.
log
(
"
ACTS_StartAbility_1200 : error =
"
+
error
);
console
.
info
(
"
ACTS_StartAbility_1200 : error =
"
+
error
);
}
});
...
...
@@ -1976,7 +1571,7 @@ describe('ActsFeatureAbilityTest', function () {
it
(
"
ACTS_StartAbility_1300
"
,
0
,
async
function
(
done
){
console
.
info
(
"
------------------logMessage ACTS_StartAbility_1300-------------------
"
);
try
{
var
Subscriber
;
let
Subscriber
;
let
id
;
function
SubscribeCallBack
(
err
,
data
)
{
...
...
@@ -2010,17 +1605,20 @@ describe('ActsFeatureAbilityTest', function () {
action
:
"
action.system.homeability
"
,
entities
:
[]
}
var
StartAbilityParameter
=
{
let
StartAbilityParameter
=
{
want
:
Want
}
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1300 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
console
.
info
(
'
ACTS_StartAbility_1300 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
==
0
).
assertTrue
();
if
(
err
.
code
!=
0
){
expect
().
assertFail
()
done
()
}
});
}
catch
(
error
){
console
.
log
(
"
ACTS_StartAbility_1300 : error =
"
+
error
);
console
.
info
(
"
ACTS_StartAbility_1300 : error =
"
+
error
);
}
});
...
...
@@ -2037,17 +1635,25 @@ describe('ActsFeatureAbilityTest', function () {
action
:
"
action.system.home
"
,
entities
:
'
asdfghj
'
}
var
StartAbilityParameter
=
{
let
StartAbilityParameter
=
{
want
:
Want
}
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1400 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
console
.
info
(
'
ACTS_StartAbility_1400 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
done
();
if
(
err
.
code
!=
0
){
expect
().
assertFail
()
done
()
}
else
{
expect
(
err
.
code
).
assertEqual
(
0
)
done
()
}
});
}
catch
(
error
){
console
.
log
(
"
ACTS_StartAbility_1400 : error =
"
+
error
);
console
.
info
(
"
ACTS_StartAbility_1400 : error =
"
+
error
);
expect
().
assertFail
()
done
()
}
});
...
...
@@ -2060,22 +1666,22 @@ describe('ActsFeatureAbilityTest', function () {
it
(
"
ACTS_StartAbility_1600
"
,
0
,
async
function
(
done
){
console
.
info
(
"
------------------logMessage ACTS_StartAbility_1600-------------------
"
);
let
Want
=
{}
var
StartAbilityParameter
=
{
let
StartAbilityParameter
=
{
want
:
Want
}
var
promise
=
featureAbility
.
startAbility
(
StartAbilityParameter
);
let
promise
=
featureAbility
.
startAbility
(
StartAbilityParameter
);
if
(
promise
)
{
promise
.
then
((
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1600 errCode :
'
+
"
data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
'
ACTS_StartAbility_1600 errCode :
'
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}).
catch
((
err
)
=>
{
expect
(
err
.
code
!=
0
).
assertTrue
(
);
expect
(
err
.
code
).
assertEqual
(
1
);
done
();
});
}
else
{
expect
(
promise
==
undefined
).
assertTrue
();
expect
(
).
assertFail
()
done
();
}
});
...
...
@@ -2088,19 +1694,19 @@ describe('ActsFeatureAbilityTest', function () {
*/
it
(
"
ACTS_StartAbility_1700
"
,
0
,
async
function
(
done
){
console
.
info
(
"
------------------logMessage ACTS_StartAbility_1700-------------------
"
);
var
StartAbilityParameter
=
{}
var
promise
=
featureAbility
.
startAbility
(
StartAbilityParameter
)
let
StartAbilityParameter
=
{}
let
promise
=
featureAbility
.
startAbility
(
StartAbilityParameter
)
if
(
promise
)
{
promise
.
then
((
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1700 data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
ACTS_StartAbility_1700 data:
'
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}).
catch
((
err
)
=>
{
expect
(
err
.
code
!=
0
).
assertTrue
(
);
expect
(
err
.
code
).
assertEqual
(
202
);
done
();
});
}
else
{
expect
(
promise
==
undefined
).
assertTrue
();
expect
(
).
assertFail
()
done
();
}
});
...
...
@@ -2113,18 +1719,18 @@ describe('ActsFeatureAbilityTest', function () {
*/
it
(
"
ACTS_StartAbility_1800
"
,
0
,
async
function
(
done
){
console
.
info
(
"
------------------logMessage ACTS_StartAbility_1800-------------------
"
);
var
promise
=
featureAbility
.
startAbility
(
undefined
);
let
promise
=
featureAbility
.
startAbility
(
undefined
);
if
(
promise
)
{
promise
.
then
((
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1800 asyncCallback data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
ACTS_StartAbility_1800 asyncCallback data:
'
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}).
catch
((
err
)
=>
{
expect
(
err
.
code
!=
0
).
assertTrue
(
);
expect
(
err
.
code
).
assertEqual
(
202
);
done
();
});
}
else
{
expect
(
promise
==
undefined
).
assertTrue
();
expect
(
).
assertFail
()
done
();
}
});
...
...
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets
浏览文件 @
3e0a7bff
...
...
@@ -62,16 +62,17 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
tempDataC = dataC[0];
expect(error.code).assertEqual(ERR_OK_CODE);
expect(error.message).assertEqual(ERR_OK);
done();
console.log(`==========${callbackName} ${describeName} end==========`);
});
await sleep(2000)
checkDataB(tempDataB)
checkDataC(tempDataC)
done();
} catch (error) {
console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`);
console.log(`${callbackName} should not reach here`);
expect().assertFail();
done();
}
});
...
...
@@ -110,6 +111,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`);
console.log(`${promiseName} should not reach here`);
expect().assertFail();
done();
}
});
function checkDataB(formInfo){
...
...
@@ -121,9 +123,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_b').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode)
expect(
1).assertEqual(formInfo.isDefault
)
expect(
1).assertEqual(formInfo.updateEnabled
)
expect(
1).assertEqual(formInfo.formVisibleNotify
)
expect(
formInfo.isDefault).assertTrue(
)
expect(
formInfo.updateEnabled).assertTrue(
)
expect(
formInfo.formVisibleNotify).assertTrue(
)
expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilityb").assertEqual(formInfo.formConfigAbility)
expect(3).assertEqual(formInfo.updateDuration)
...
...
@@ -131,8 +133,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect('10:30').assertEqual(formInfo.scheduledUpdateTime)
expect(1).assertEqual(formInfo.supportDimensions[0])
expect(2).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameB').assertEqual(formInfo.
metaData.
customizeData[0].name)
expect('valueB').assertEqual(formInfo.
metaData.
customizeData[0].value)
expect('originWidgetNameB').assertEqual(formInfo.customizeData[0].name)
expect('valueB').assertEqual(formInfo.customizeData[0].value)
}
function checkDataC(formInfo){
expect("com.ohos.st.formsystemproviderc").assertEqual(formInfo.bundleName)
...
...
@@ -143,9 +145,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_c').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_LIGHT).assertEqual(formInfo.colorMode)
expect(
1).assertEqual(formInfo.isDefault
)
expect(
1).assertEqual(formInfo.updateEnabled
)
expect(
1).assertEqual(formInfo.formVisibleNotify
)
expect(
formInfo.isDefault).assertTrue(
)
expect(
formInfo.updateEnabled).assertTrue(
)
expect(
formInfo.formVisibleNotify).assertTrue(
)
expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilityc").assertEqual(formInfo.formConfigAbility)
expect(4).assertEqual(formInfo.updateDuration)
...
...
@@ -153,8 +155,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(3).assertEqual(formInfo.defaultDimension)
expect(3).assertEqual(formInfo.supportDimensions[0])
expect(4).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameC').assertEqual(formInfo.
metaData.
customizeData[0].name)
expect('valueC').assertEqual(formInfo.
metaData.
customizeData[0].value)
expect('originWidgetNameC').assertEqual(formInfo.customizeData[0].name)
expect('valueC').assertEqual(formInfo.customizeData[0].value)
}
});
};
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets
浏览文件 @
3e0a7bff
...
...
@@ -74,6 +74,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`);
console.log(`${callbackName} should not reach here`);
expect().assertFail();
done();
}
});
...
...
@@ -115,6 +116,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`);
console.log(`${promiseName} should not reach here`);
expect().assertFail();
done();
}
});
...
...
@@ -127,9 +129,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_b').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode)
expect(
1).assertEqual(formInfo.isDefault
)
expect(
1).assertEqual(formInfo.updateEnabled
)
expect(
1).assertEqual(formInfo.formVisibleNotify
)
expect(
formInfo.isDefault).assertTrue(
)
expect(
formInfo.updateEnabled).assertTrue(
)
expect(
formInfo.formVisibleNotify).assertTrue(
)
expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilityb").assertEqual(formInfo.formConfigAbility)
expect(3).assertEqual(formInfo.updateDuration)
...
...
@@ -137,8 +139,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect('10:30').assertEqual(formInfo.scheduledUpdateTime)
expect(1).assertEqual(formInfo.supportDimensions[0])
expect(2).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameB').assertEqual(formInfo.
metaData.
customizeData[0].name)
expect('valueB').assertEqual(formInfo.
metaData.
customizeData[0].value)
expect('originWidgetNameB').assertEqual(formInfo.customizeData[0].name)
expect('valueB').assertEqual(formInfo.customizeData[0].value)
}
function checkDataA1(formInfo){
...
...
@@ -150,9 +152,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_a01').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_DARK).assertEqual(formInfo.colorMode)
expect(
1).assertEqual(formInfo.isDefault
)
expect(
1).assertEqual(formInfo.updateEnabled
)
expect(
1).assertEqual(formInfo.formVisibleNotify
)
expect(
formInfo.isDefault).assertTrue(
)
expect(
formInfo.updateEnabled).assertTrue(
)
expect(
formInfo.formVisibleNotify).assertTrue(
)
expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilitya01").assertEqual(formInfo.formConfigAbility)
expect(1).assertEqual(formInfo.updateDuration)
...
...
@@ -160,8 +162,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect('5:30').assertEqual(formInfo.scheduledUpdateTime)
expect(1).assertEqual(formInfo.supportDimensions[0])
expect(3).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameA01').assertEqual(formInfo.
metaData.
customizeData[0].name)
expect('valueA01').assertEqual(formInfo.
metaData.
customizeData[0].value)
expect('originWidgetNameA01').assertEqual(formInfo.customizeData[0].name)
expect('valueA01').assertEqual(formInfo.customizeData[0].value)
}
function checkDataA2(formInfo){
...
...
@@ -173,9 +175,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_a02').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_LIGHT).assertEqual(formInfo.colorMode)
expect(
0).assertEqual(formInfo.isDefault
)
expect(
0).assertEqual(formInfo.updateEnabled
)
expect(
0).assertEqual(formInfo.formVisibleNotify
)
expect(
formInfo.isDefault).assertFalse(
)
expect(
formInfo.updateEnabled).assertFalse(
)
expect(
formInfo.formVisibleNotify).assertFalse(
)
expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilitya02").assertEqual(formInfo.formConfigAbility)
expect(2).assertEqual(formInfo.updateDuration)
...
...
@@ -185,8 +187,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(2).assertEqual(formInfo.supportDimensions[1])
expect(3).assertEqual(formInfo.supportDimensions[2])
expect(4).assertEqual(formInfo.supportDimensions[3])
expect('originWidgetNameA02').assertEqual(formInfo.
metaData.
customizeData[0].name)
expect('valueA02').assertEqual(formInfo.
metaData.
customizeData[0].value)
expect('originWidgetNameA02').assertEqual(formInfo.customizeData[0].name)
expect('valueA02').assertEqual(formInfo.customizeData[0].value)
}
});
};
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets
浏览文件 @
3e0a7bff
...
...
@@ -68,6 +68,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`);
console.log(`${callbackName} should not reach here`);
expect().assertFail();
done();
}
});
...
...
@@ -118,9 +119,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_b').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode)
expect(
1).assertEqual(formInfo.isDefault
)
expect(
1).assertEqual(formInfo.updateEnabled
)
expect(
1).assertEqual(formInfo.formVisibleNotify
)
expect(
formInfo.isDefault).assertTrue(
)
expect(
formInfo.updateEnabled).assertTrue(
)
expect(
formInfo.formVisibleNotify).assertTrue(
)
expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilityb").assertEqual(formInfo.formConfigAbility)
expect(3).assertEqual(formInfo.updateDuration)
...
...
@@ -128,8 +129,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect('10:30').assertEqual(formInfo.scheduledUpdateTime)
expect(1).assertEqual(formInfo.supportDimensions[0])
expect(2).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameB').assertEqual(formInfo.
metaData.
customizeData[0].name)
expect('valueB').assertEqual(formInfo.
metaData.
customizeData[0].value)
expect('originWidgetNameB').assertEqual(formInfo.customizeData[0].name)
expect('valueB').assertEqual(formInfo.customizeData[0].value)
}
});
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录