Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
51eeabd0
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看板
提交
51eeabd0
编写于
2月 27, 2022
作者:
J
jiyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change startability and want
Signed-off-by:
N
jiyong
<
jiyong@huawei.com
>
上级
3113a4d9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
137 addition
and
97 deletion
+137
-97
aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js
...ytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js
+89
-83
aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/test/ActsGetWantAllTest.js
...twantalltest/entry/src/main/js/test/ActsGetWantAllTest.js
+22
-5
aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.js
...etwantalltesthap/src/main/js/default/pages/index/index.js
+26
-9
未找到文件。
aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js
100644 → 100755
浏览文件 @
51eeabd0
...
...
@@ -167,6 +167,65 @@ describe('ActsFeatureAbilityTest', function () {
},
TIMEOUT
)
})
/*
* @tc.number ACTS_StartAbility_1000
* @tc.name The configured URI is started and the page is not configured
* @tc.desc Function test
* @tc.level 0
*/
it
(
"
ACTS_StartAbility_1000
"
,
0
,
async
function
(
done
){
console
.
info
(
"
------------------logMessage ACTS_StartAbility_1000-------------------
"
);
try
{
var
Subscriber
;
let
id
;
function
SubscribeCallBack
(
err
,
data
)
{
clearTimeout
(
id
);
expect
(
data
.
event
).
assertEqual
(
"
ACTS_StartAbility_1000_CommonEvent
"
);
console
.
debug
(
"
====>Subscribe CallBack data:====>
"
+
JSON
.
stringify
(
data
));
commonEvent
.
unsubscribe
(
Subscriber
,
UnSubscribeCallback
);
done
();
}
commonEvent
.
createSubscriber
(
subscriberInfoStartAbilityTen
).
then
(
async
(
data
)
=>
{
console
.
debug
(
"
====>Create Subscriber====>
"
);
Subscriber
=
data
;
await
commonEvent
.
subscribe
(
Subscriber
,
SubscribeCallBack
);
})
function
UnSubscribeCallback
()
{
console
.
debug
(
"
====>UnSubscribe CallBack====>
"
);
done
();
}
function
timeout
()
{
expect
().
assertFail
();
console
.
debug
(
'
ACTS_StartAbility_1000=====timeout======
'
);
commonEvent
.
unsubscribe
(
Subscriber
,
UnSubscribeCallback
)
done
();
}
id
=
setTimeout
(
timeout
,
START_ABILITY_TIMEOUT
);
let
Want
=
{
bundleName
:
"
com.example.startability
"
,
abilityName
:
"
com.example.startability.MainAbility
"
,
uri
:
"
xxxxx
"
,
}
var
StartAbilityParameter
=
{
want
:
Want
}
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1000 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
==
0
).
assertTrue
();
done
();
});
}
catch
(
error
){
console
.
log
(
"
ACTS_StartAbility_1000 : error =
"
+
error
);
}
})
/**
* @tc.number: ACTS_StartAbility_0100
* @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability.
...
...
@@ -1099,7 +1158,7 @@ describe('ActsFeatureAbilityTest', function () {
(
error
,
data
)
=>
{
console
.
log
(
"
ACTS_HasWindowFocus_0400 asyncCallback code:
"
+
error
.
code
+
"
data:
"
+
data
)
expect
(
error
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertEqual
(
tru
e
);
expect
(
data
).
assertEqual
(
fals
e
);
done
();
}
);
...
...
@@ -1228,7 +1287,7 @@ describe('ActsFeatureAbilityTest', function () {
}
}
commonEvent
.
createSubscriber
(
subscriberInfo
TerminateAbilityTwo
).
then
(
async
(
data
)
=>
{
commonEvent
.
createSubscriber
(
subscriberInfo
_ACTS_TerminateAbility_0200
).
then
(
async
(
data
)
=>
{
console
.
debug
(
"
====>Create Subscriber====>
"
);
Subscriber
=
data
;
await
commonEvent
.
subscribe
(
Subscriber
,
SubscribeCallBack
);
...
...
@@ -1525,13 +1584,13 @@ describe('ActsFeatureAbilityTest', function () {
// expect(info.iconId).assertEqual(0); //create by DevEco when building HAP.
expect
(
info
.
process
).
assertEqual
(
"
processTest
"
);
expect
(
info
.
supportedModes
).
assertEqual
(
0
);
expect
(
info
.
moduleSourceDirs
[
0
]).
assertEqual
(
"
/data/a
pp/el1/bundle/public
/
"
+
expect
(
info
.
moduleSourceDirs
[
0
]).
assertEqual
(
"
/data/a
ccounts/account_0/applications
/
"
+
"
com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest
"
);
expect
(
info
.
permissions
[
0
]).
assertEqual
(
"
ohos.permission.CAMERA
"
);
expect
(
info
.
moduleInfos
[
0
].
moduleName
).
assertEqual
(
"
entry
"
);
expect
(
info
.
moduleInfos
[
0
].
moduleSourceDir
).
assertEqual
(
"
/data/a
pp/el1/bundle/public
/
"
+
expect
(
info
.
moduleInfos
[
0
].
moduleSourceDir
).
assertEqual
(
"
/data/a
ccounts/account_0/applications
/
"
+
"
com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest
"
);
expect
(
info
.
entryDir
).
assertEqual
(
"
/data/a
pp/el1/bundle/public
/
"
+
expect
(
info
.
entryDir
).
assertEqual
(
"
/data/a
ccounts/account_0/applications
/
"
+
"
com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest
"
);
}
...
...
@@ -1806,14 +1865,17 @@ describe('ActsFeatureAbilityTest', function () {
expect
(
data
.
type
).
assertEqual
(
1
);
expect
(
data
.
subType
).
assertEqual
(
0
);
expect
(
data
.
orientation
).
assertEqual
(
0
);
expect
(
data
.
launchMode
).
assertEqual
(
0
);
expect
(
data
.
launchMode
).
assertEqual
(
1
);
expect
(
data
.
permissions
[
0
]).
assertEqual
(
"
ohos.permission.ACCELEROMETER
"
);
expect
(
data
.
permissions
[
1
]).
assertEqual
(
"
ohos.permission.ANSWER_CALL
"
);
expect
(
data
.
deviceTypes
[
0
]).
assertEqual
(
"
phone
"
);
expect
(
data
.
deviceCapabilities
[
0
]).
assertEqual
(
"
screen_support
"
);
expect
(
data
.
deviceCapabilities
[
1
]).
assertEqual
(
"
audio_support
"
);
expect
(
data
.
readPermission
).
assertEqual
(
""
);
expect
(
data
.
writePermission
).
assertEqual
(
""
);
checkApplicationInfo
(
data
.
applicationInfo
);
expect
(
data
.
formEntity
).
assertEqual
(
0
);
expect
(
data
.
minFormHeight
).
assertEqual
(
0
);
expect
(
data
.
defaultFormHeight
).
assertEqual
(
0
);
...
...
@@ -2179,65 +2241,6 @@ describe('ActsFeatureAbilityTest', function () {
}
});
/*
* @tc.number ACTS_StartAbility_1000
* @tc.name The configured URI is started and the page is not configured
* @tc.desc Function test
* @tc.level 0
*/
it
(
"
ACTS_StartAbility_1000
"
,
0
,
async
function
(
done
){
console
.
info
(
"
------------------logMessage ACTS_StartAbility_1000-------------------
"
);
try
{
var
Subscriber
;
let
id
;
function
SubscribeCallBack
(
err
,
data
)
{
clearTimeout
(
id
);
expect
(
data
.
event
).
assertEqual
(
"
ACTS_StartAbility_1000_CommonEvent
"
);
console
.
debug
(
"
====>Subscribe CallBack data:====>
"
+
JSON
.
stringify
(
data
));
commonEvent
.
unsubscribe
(
Subscriber
,
UnSubscribeCallback
);
done
();
}
commonEvent
.
createSubscriber
(
subscriberInfoStartAbilityTen
).
then
(
async
(
data
)
=>
{
console
.
debug
(
"
====>Create Subscriber====>
"
);
Subscriber
=
data
;
await
commonEvent
.
subscribe
(
Subscriber
,
SubscribeCallBack
);
})
function
UnSubscribeCallback
()
{
console
.
debug
(
"
====>UnSubscribe CallBack====>
"
);
done
();
}
function
timeout
()
{
expect
().
assertFail
();
console
.
debug
(
'
ACTS_StartAbility_1000=====timeout======
'
);
commonEvent
.
unsubscribe
(
Subscriber
,
UnSubscribeCallback
)
done
();
}
id
=
setTimeout
(
timeout
,
START_ABILITY_TIMEOUT
);
let
Want
=
{
bundleName
:
"
com.example.startability
"
,
abilityName
:
"
com.example.startability.MainAbility
"
,
uri
:
"
xxxxx
"
,
}
var
StartAbilityParameter
=
{
want
:
Want
}
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1000 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
==
0
).
assertTrue
();
done
();
});
}
catch
(
error
){
console
.
log
(
"
ACTS_StartAbility_1000 : error =
"
+
error
);
}
})
/*
* @tc.number ACTS_StartAbility_1100
* @tc.name Verify the ability of implicitly starting through action without configuring action
...
...
@@ -2257,7 +2260,7 @@ describe('ActsFeatureAbilityTest', function () {
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1100 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
!=
0
).
assertTrue
();
expect
(
err
.
code
==
2097155
).
assertTrue
();
done
();
});
}
catch
(
error
){
...
...
@@ -2285,7 +2288,7 @@ describe('ActsFeatureAbilityTest', function () {
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1200 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
!=
0
).
assertTrue
();
expect
(
err
.
code
==
2097155
).
assertTrue
();
done
();
});
}
catch
(
error
){
...
...
@@ -2392,11 +2395,12 @@ describe('ActsFeatureAbilityTest', function () {
want
:
Want
}
featureAbility
.
startAbility
(
StartAbilityParameter
).
then
((
data
)
=>
{
console
.
log
(
"
ACTS_StartAbility_1600 asyncCallbackdata:
"
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
log
(
"
ACTS_StartAbility_1600 : error =
"
+
JSON
.
stringify
(
error
));
await
featureAbility
.
startAbility
(
StartAbilityParameter
).
then
((
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1600 errCode :
'
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}).
catch
((
err
)
=>
{
expect
(
err
.
code
==
2097155
).
assertTrue
();
});
});
...
...
@@ -2408,14 +2412,14 @@ describe('ActsFeatureAbilityTest', function () {
*/
it
(
"
ACTS_StartAbility_1700
"
,
0
,
async
function
(){
console
.
info
(
"
------------------logMessage ACTS_StartAbility_1700-------------------
"
);
try
{
var
StartAbilityParameter
=
{}
var
promise
=
await
featureAbility
.
startAbility
(
StartAbilityParameter
);
console
.
log
(
'
ACTS_StartAbility_1700 promise is :
'
+
JSON
.
stringify
(
promise
)
);
done
();
}
catch
(
error
)
{
console
.
log
(
"
ACTS_StartAbility_1700 : error =
"
+
JSON
.
stringify
(
error
)
);
}
var
StartAbilityParameter
=
{}
await
featureAbility
.
startAbility
(
StartAbilityParameter
).
then
((
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1700 data:
'
+
JSON
.
stringify
(
data
)
);
expect
().
assertFail
(
);
done
();
}).
catch
((
err
)
=>
{
expect
(
err
.
code
==
-
104
).
assertTrue
(
);
});
});
/*
...
...
@@ -2426,11 +2430,13 @@ describe('ActsFeatureAbilityTest', function () {
*/
it
(
"
ACTS_StartAbility_1800
"
,
0
,
async
function
(
done
){
console
.
info
(
"
------------------logMessage ACTS_StartAbility_1800-------------------
"
);
featureAbility
.
startAbility
(
undefined
).
then
((
data
)
=>
{
console
.
log
(
"
ACTS_StartAbility_1800 asyncCallbackdata:
"
+
JSON
.
stringify
(
data
));;
}).
catch
((
error
)
=>
{
console
.
log
(
"
ACTS_StartAbility_1800 : error =
"
+
JSON
.
stringify
(
error
));
await
featureAbility
.
startAbility
(
undefined
).
then
((
data
)
=>
{
console
.
log
(
'
ACTS_StartAbility_1800 asyncCallback data:
'
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}).
catch
((
err
)
=>
{
expect
(
err
.
code
==
-
104
).
assertTrue
();
});
});
})
aafwk/aafwk_standard/want/actsgetwantalltest/entry/src/main/js/test/ActsGetWantAllTest.js
100644 → 100755
浏览文件 @
51eeabd0
...
...
@@ -323,7 +323,6 @@ describe('ActsGetWantTest', function () {
},
(
err
,
data
)
=>
{
console
.
info
(
'
====> ACTS_StartAbilityForResult_0700 start ability=====>
'
+
JSON
.
stringify
(
data
))
console
.
info
(
'
====> ACTS_StartAbilityForResult_0700 Ret:
'
+
JSON
.
stringify
(
err
))
expect
(
data
.
want
.
deviceId
).
assertEqual
(
""
);
expect
(
data
.
want
.
bundleName
).
assertEqual
(
"
com.example.actsgetwantalltesthap
"
);
expect
(
data
.
want
.
abilityName
).
assertEqual
(
"
com.example.actsgetwantalltesthap.MainAbility
"
);
...
...
@@ -377,8 +376,26 @@ describe('ActsGetWantTest', function () {
},
(
err
,
data
)
=>
{
console
.
info
(
'
====> ACTS_StartAbilityForResult_0800 start ability=====>
'
+
JSON
.
stringify
(
data
))
console
.
info
(
'
====> ACTS_StartAbilityForResult_0800 Ret:
'
+
JSON
.
stringify
(
err
))
expect
(
err
.
code
==
0
).
assertFalse
();
// StartAbility with continuation flags is not allowed.
expect
(
data
.
want
.
deviceId
).
assertEqual
(
""
);
expect
(
data
.
want
.
bundleName
).
assertEqual
(
"
com.example.actsgetwantalltesthap
"
);
expect
(
data
.
want
.
abilityName
).
assertEqual
(
"
com.example.actsgetwantalltesthap.MainAbility
"
);
expect
(
data
.
want
.
action
).
assertEqual
(
"
action1
"
);
expect
(
data
.
want
.
entities
[
0
]).
assertEqual
(
"
entity1
"
);
expect
(
data
.
want
.
type
).
assertEqual
(
"
MIMETYPE
"
);
expect
(
data
.
want
.
uri
).
assertEqual
(
"
key={true,true,false}
"
);
expect
(
data
.
want
.
flags
).
assertEqual
(
wantConstant
.
Flags
.
FLAG_ABILITY_CONTINUATION
);
expect
(
data
.
want
.
parameters
.
mykey0
).
assertEqual
(
0.1
);
expect
(
data
.
want
.
parameters
.
mykey1
[
0
]).
assertEqual
(
0.1
);
expect
(
data
.
want
.
parameters
.
mykey1
[
1
]).
assertEqual
(
0.2
);
expect
(
data
.
want
.
parameters
.
mykey1
[
2
]).
assertEqual
(
0.0000000003
);
expect
(
data
.
want
.
parameters
.
mykey2
).
assertEqual
(
"
[a, b, c]
"
);
expect
(
data
.
want
.
parameters
.
mykey3
).
assertEqual
(
"
str
"
);
expect
(
data
.
want
.
parameters
.
mykey4
[
0
]).
assertEqual
(
false
);
expect
(
data
.
want
.
parameters
.
mykey4
[
1
]).
assertEqual
(
true
);
expect
(
data
.
want
.
parameters
.
mykey4
[
2
]).
assertEqual
(
false
);
expect
(
data
.
want
.
parameters
.
mykey5
[
0
]).
assertEqual
(
"
str
"
);
expect
(
data
.
want
.
parameters
.
mykey5
[
1
]).
assertEqual
(
"
STR
"
);
expect
(
data
.
want
.
parameters
.
mykey5
[
2
]).
assertEqual
(
"
helloopenharmonyhelloopenharmonyhelloopenharmony
"
);
console
.
info
(
'
====> before done=====>
'
)
done
();
})
...
...
@@ -994,7 +1011,7 @@ describe('ActsGetWantTest', function () {
mykey2
:
"
[1, 2, 3]
"
,
mykey3
:
"
str
"
,
mykey4
:
[
false
,
true
,
false
],
mykey5
:
[
"
str
"
,
"
!@#$%
"
,
"
helloopenharmony
"
],
mykey5
:
[
"
str
"
,
"
test123
"
,
"
helloopenharmony
"
],
},
},
},
...
...
@@ -1028,7 +1045,7 @@ describe('ActsGetWantTest', function () {
expect
(
data
.
want
.
parameters
.
mykey4
[
1
]).
assertEqual
(
true
);
expect
(
data
.
want
.
parameters
.
mykey4
[
2
]).
assertEqual
(
false
);
expect
(
data
.
want
.
parameters
.
mykey5
[
0
]).
assertEqual
(
"
str
"
);
expect
(
data
.
want
.
parameters
.
mykey5
[
1
]).
assertEqual
(
"
!@#$%
"
);
expect
(
data
.
want
.
parameters
.
mykey5
[
1
]).
assertEqual
(
"
test123
"
);
expect
(
data
.
want
.
parameters
.
mykey5
[
2
]).
assertEqual
(
"
helloopenharmony
"
);
console
.
info
(
'
====> before done=====>
'
)
}
...
...
aafwk/aafwk_standard/want/sceneProject/actsgetwantalltesthap/src/main/js/default/pages/index/index.js
100644 → 100755
浏览文件 @
51eeabd0
...
...
@@ -30,15 +30,32 @@ export default {
(
err
,
data
)
=>
{
globalWant
=
data
;
console
.
debug
(
"
==========data=
"
+
JSON
.
stringify
(
globalWant
));
setTimeout
(
function
(){
console
.
debug
(
"
==========data1 bundleName is===========
"
+
JSON
.
stringify
(
globalWant
.
bundleName
));
var
promise
=
featureAbility
.
terminateSelfWithResult
(
{
resultCode
:
1
,
want
:
globalWant
}
);
},
1000
);
if
(
globalWant
.
parameters
.
mykey5
[
1
]
==
'
test123
'
){
featureAbility
.
getWant
().
then
((
data
)
=>
{
globalWant
=
data
setTimeout
(
function
(){
console
.
debug
(
"
==========data2 bundleName is===========
"
+
JSON
.
stringify
(
globalWant
.
bundleName
));
var
promise
=
featureAbility
.
terminateSelfWithResult
(
{
resultCode
:
1
,
want
:
globalWant
}
);
},
1000
);
})
}
else
{
setTimeout
(
function
(){
console
.
debug
(
"
==========data1 bundleName is===========
"
+
JSON
.
stringify
(
globalWant
.
bundleName
));
var
promise
=
featureAbility
.
terminateSelfWithResult
(
{
resultCode
:
1
,
want
:
globalWant
}
);
},
1000
);
}
}
)
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录