Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
736895f0
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看板
未验证
提交
736895f0
编写于
11月 11, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 11, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6462 XTS失败用例适配
Merge pull request !6462 from chengxingzhen/master
上级
26b34ceb
6e047c25
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
434 addition
and
435 deletion
+434
-435
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets
...y/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets
+430
-431
ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets
.../main/ets/MainAbility/test/StartAbilityForResult.test.ets
+4
-4
未找到文件。
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets
浏览文件 @
736895f0
...
@@ -13,437 +13,436 @@
...
@@ -13,437 +13,436 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
"@ohos/hypium"
import
{
describe
,
beforeAll
,
afterEach
,
it
,
expect
}
from
"@ohos/hypium"
import
featureAbility
from
'@ohos.ability.featureAbility'
;
import
featureAbility
from
'@ohos.ability.featureAbility'
;
import
AbilityDelegatorRegistry
from
'@ohos.application.abilityDelegatorRegistry'
import
AbilityDelegatorRegistry
from
'@ohos.application.abilityDelegatorRegistry'
import
commonEvent
from
'@ohos.commonEvent'
;
import
commonEvent
from
'@ohos.commonEvent'
;
export
default
function
connectAbilityTest_PA
()
{
export
default
function
connectAbilityTest_PA
()
{
var
TAG
=
""
;
let
TAG
=
""
;
var
dataAssert
=
""
;
let
dataAssert
=
""
;
var
abilityDelegator
=
undefined
let
abilityDelegator
=
undefined
var
subscriber
;
let
subscriber
;
var
subscribeInfo
=
{
let
subscribeInfo
=
{
events
:
[
"service_event"
,
"service2_event"
,
"service3_event"
,
"service4_event"
,
"service5_event"
,
events
:
[
"service_event"
,
"service2_event"
,
"service3_event"
,
"service4_event"
,
"service5_event"
,
"service6_event"
,
"service7_event"
,
"service8_event"
,
"service9_event"
,
"service10_event"
,
"service11_event"
]
"service6_event"
,
"service7_event"
,
"service8_event"
,
"service9_event"
,
"service10_event"
,
"service11_event"
]
};
};
function
sleep
(
time
)
{
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
))
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
))
}
}
async
function
startService
(
msg
,
str
)
{
async
function
startService
(
msg
,
str
)
{
console
.
info
(
msg
+
' startService successful. str: '
+
JSON
.
stringify
(
str
));
console
.
info
(
msg
+
' startService successful. str: '
+
JSON
.
stringify
(
str
));
featureAbility
.
startAbility
(
str
)
featureAbility
.
startAbility
(
str
)
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
console
.
info
(
msg
+
' startService successful. Data: '
+
JSON
.
stringify
(
data
));
console
.
info
(
msg
+
' startService successful. Data: '
+
JSON
.
stringify
(
data
));
})
.
catch
((
error
)
=>
{
})
.
catch
((
error
)
=>
{
console
.
error
(
msg
+
' startService failed. Cause: '
+
JSON
.
stringify
(
error
));
console
.
error
(
msg
+
' startService failed. Cause: '
+
JSON
.
stringify
(
error
));
})
})
}
}
function
checkParameters
(
msg1
,
data
)
{
function
checkParameters
(
msg1
,
data
)
{
for
(
var
key
in
data
.
parameters
)
{
for
(
let
key
in
data
.
parameters
)
{
console
.
info
(
msg1
+
" data.parameters is : "
+
data
.
parameters
[
key
])
console
.
info
(
msg1
+
" data.parameters is : "
+
data
.
parameters
[
key
])
if
(
data
.
parameters
[
key
]
===
"onFailed"
)
{
if
(
data
.
parameters
[
key
]
===
"onFailed"
)
{
dataAssert
=
"onFailed"
;
dataAssert
=
"onFailed"
;
}
else
if
(
data
.
parameters
[
key
]
===
"onDisconnect"
)
{
}
else
if
(
data
.
parameters
[
key
]
===
"onDisconnect"
)
{
dataAssert
=
"onDisconnect"
;
dataAssert
=
"onDisconnect"
;
}
else
if
(
data
.
parameters
[
key
]
===
"onConnect"
)
{
}
else
if
(
data
.
parameters
[
key
]
===
"onConnect"
)
{
dataAssert
=
"onConnect"
;
dataAssert
=
"onConnect"
;
}
}
}
}
}
}
function
SubscribeCallBack
(
err
,
data
)
{
function
SubscribeCallBack
(
err
,
data
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
"commonEvent subscribe failed "
+
JSON
.
stringify
(
err
));
console
.
error
(
"commonEvent subscribe failed "
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
if
(
data
.
event
===
"service_event"
)
{
if
(
data
.
event
===
"service_event"
)
{
console
.
info
(
"commonEvent subscribe service "
+
JSON
.
stringify
(
data
));
console
.
info
(
"commonEvent subscribe service "
+
JSON
.
stringify
(
data
));
checkParameters
(
"commonEvent service"
,
data
)
checkParameters
(
"commonEvent service"
,
data
)
}
else
if
(
data
.
event
===
"service2_event"
)
{
}
else
if
(
data
.
event
===
"service2_event"
)
{
console
.
info
(
"commonEvent subscribe service2 "
+
JSON
.
stringify
(
data
));
console
.
info
(
"commonEvent subscribe service2 "
+
JSON
.
stringify
(
data
));
checkParameters
(
"commonEvent service2"
,
data
)
checkParameters
(
"commonEvent service2"
,
data
)
}
else
if
(
data
.
event
===
"service3_event"
)
{
}
else
if
(
data
.
event
===
"service3_event"
)
{
console
.
info
(
"commonEvent subscribe service3 "
+
JSON
.
stringify
(
data
));
console
.
info
(
"commonEvent subscribe service3 "
+
JSON
.
stringify
(
data
));
checkParameters
(
"commonEvent service3"
,
data
)
checkParameters
(
"commonEvent service3"
,
data
)
}
else
if
(
data
.
event
===
"service4_event"
)
{
}
else
if
(
data
.
event
===
"service4_event"
)
{
console
.
info
(
"commonEvent subscribe service4 "
+
JSON
.
stringify
(
data
));
console
.
info
(
"commonEvent subscribe service4 "
+
JSON
.
stringify
(
data
));
checkParameters
(
"commonEvent service4"
,
data
)
checkParameters
(
"commonEvent service4"
,
data
)
}
else
if
(
data
.
event
===
"service5_event"
)
{
}
else
if
(
data
.
event
===
"service5_event"
)
{
console
.
info
(
"commonEvent subscribe service5 "
+
JSON
.
stringify
(
data
));
console
.
info
(
"commonEvent subscribe service5 "
+
JSON
.
stringify
(
data
));
checkParameters
(
"commonEvent service5"
,
data
)
checkParameters
(
"commonEvent service5"
,
data
)
}
else
if
(
data
.
event
===
"service6_event"
)
{
}
else
if
(
data
.
event
===
"service6_event"
)
{
console
.
info
(
"commonEvent subscribe service6 "
+
JSON
.
stringify
(
data
));
console
.
info
(
"commonEvent subscribe service6 "
+
JSON
.
stringify
(
data
));
checkParameters
(
"commonEvent service6"
,
data
)
checkParameters
(
"commonEvent service6"
,
data
)
}
else
if
(
data
.
event
===
"service7_event"
)
{
}
else
if
(
data
.
event
===
"service7_event"
)
{
console
.
info
(
"commonEvent subscribe service7 "
+
JSON
.
stringify
(
data
));
console
.
info
(
"commonEvent subscribe service7 "
+
JSON
.
stringify
(
data
));
checkParameters
(
"commonEvent service7"
,
data
)
checkParameters
(
"commonEvent service7"
,
data
)
}
else
if
(
data
.
event
===
"service8_event"
)
{
}
else
if
(
data
.
event
===
"service8_event"
)
{
console
.
info
(
"commonEvent subscribe service8 "
+
JSON
.
stringify
(
data
));
console
.
info
(
"commonEvent subscribe service8 "
+
JSON
.
stringify
(
data
));
checkParameters
(
"commonEvent service8"
,
data
)
checkParameters
(
"commonEvent service8"
,
data
)
}
else
if
(
data
.
event
===
"service9_event"
)
{
}
else
if
(
data
.
event
===
"service9_event"
)
{
console
.
info
(
"commonEvent subscribe service9 "
+
JSON
.
stringify
(
data
));
console
.
info
(
"commonEvent subscribe service9 "
+
JSON
.
stringify
(
data
));
checkParameters
(
"commonEvent service9"
,
data
)
checkParameters
(
"commonEvent service9"
,
data
)
}
else
if
(
data
.
event
===
"service10_event"
)
{
}
else
if
(
data
.
event
===
"service10_event"
)
{
console
.
info
(
"commonEvent subscribe service10 "
+
JSON
.
stringify
(
data
));
console
.
info
(
"commonEvent subscribe service10 "
+
JSON
.
stringify
(
data
));
checkParameters
(
"commonEvent service10"
,
data
)
checkParameters
(
"commonEvent service10"
,
data
)
}
else
if
(
data
.
event
===
"service11_event"
)
{
}
else
if
(
data
.
event
===
"service11_event"
)
{
console
.
info
(
"commonEvent subscribe service11 "
+
JSON
.
stringify
(
data
));
console
.
info
(
"commonEvent subscribe service11 "
+
JSON
.
stringify
(
data
));
checkParameters
(
"commonEvent service11"
,
data
)
checkParameters
(
"commonEvent service11"
,
data
)
}
}
}
}
}
}
function
CreateSubscriberCallBack
(
err
,
commonEventSubscriber
)
{
function
CreateSubscriberCallBack
(
err
,
commonEventSubscriber
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
"commonEvent createSubscriber failed "
+
JSON
.
stringify
(
err
));
console
.
error
(
"commonEvent createSubscriber failed "
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
console
.
info
(
"----commonEvent createSubscriber------"
);
console
.
info
(
"----commonEvent createSubscriber------"
);
subscriber
=
commonEventSubscriber
;
subscriber
=
commonEventSubscriber
;
commonEvent
.
subscribe
(
subscriber
,
SubscribeCallBack
);
commonEvent
.
subscribe
(
subscriber
,
SubscribeCallBack
);
}
}
}
}
describe
(
'FreeInstall_FA_ConnectAbility_PA'
,
function
()
{
describe
(
'FreeInstall_FA_ConnectAbility_PA'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
"FreeInstall_FA_ConnectAbility_PA before all called"
);
console
.
info
(
"FreeInstall_FA_ConnectAbility_PA before all called"
);
console
.
info
(
"FreeInstall_FA_ConnectAbility_PA commonEvent.createSubscriber start!!!"
);
console
.
info
(
"FreeInstall_FA_ConnectAbility_PA commonEvent.createSubscriber start!!!"
);
commonEvent
.
createSubscriber
(
subscribeInfo
,
CreateSubscriberCallBack
);
commonEvent
.
createSubscriber
(
subscribeInfo
,
CreateSubscriberCallBack
);
await
sleep
(
2000
);
await
sleep
(
2000
);
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
cmd
=
"bm install -p data/test/MockService.hap"
;
let
cmd
=
"bm install -p data/test/MockService.hap"
;
console
.
info
(
"cmd : "
+
cmd
)
console
.
info
(
"cmd : "
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
"executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
console
.
info
(
"executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
})
await
sleep
(
500
);
await
sleep
(
500
);
var
cmd1
=
"mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"
;
let
cmd1
=
"mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"
;
abilityDelegator
.
executeShellCommand
(
cmd1
,
(
err
:
any
,
d
:
any
)
=>
{
abilityDelegator
.
executeShellCommand
(
cmd1
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
"executeShellCommand1 : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
console
.
info
(
"executeShellCommand1 : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
})
await
sleep
(
500
);
await
sleep
(
500
);
var
cmd2
=
"mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"
;
let
cmd2
=
"mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"
;
abilityDelegator
.
executeShellCommand
(
cmd2
,
(
err
:
any
,
d
:
any
)
=>
{
abilityDelegator
.
executeShellCommand
(
cmd2
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
"executeShellCommand2 : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
console
.
info
(
"executeShellCommand2 : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
})
await
sleep
(
500
);
await
sleep
(
500
);
var
cmdum
=
"bm uninstall -n com.example.different.hmservice"
;
let
cmdum
=
"bm uninstall -n com.example.different.hmservice"
;
abilityDelegator
.
executeShellCommand
(
cmdum
,
(
err
:
any
,
d
:
any
)
=>
{
abilityDelegator
.
executeShellCommand
(
cmdum
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
done
();
done
();
})
})
});
});
afterEach
(
async
function
(
done
)
{
afterEach
(
async
function
(
done
)
{
console
.
info
(
"FreeInstall_FA_ConnectAbility_PA after each called"
);
console
.
info
(
"FreeInstall_FA_ConnectAbility_PA after each called"
);
dataAssert
=
""
dataAssert
=
""
await
sleep
(
1000
);
if
(
"FreeInstall_FA_ConnectAbility_PA_1100"
===
TAG
)
{
if
(
"FreeInstall_FA_ConnectAbility_PA_1100"
===
TAG
)
{
let
cmd14
=
"bm uninstall -n com.ohos.hag.famanager"
;
var
cmd14
=
"bm uninstall -n com.ohos.hag.famanager"
;
abilityDelegator
.
executeShellCommand
(
cmd14
,
(
err
:
any
,
d
:
any
)
=>
{
abilityDelegator
.
executeShellCommand
(
cmd14
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
"executeShellCommand14 : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
console
.
info
(
"executeShellCommand14 : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
})
}
}
await
sleep
(
1500
);
await
sleep
(
500
);
done
();
done
();
});
});
/*
/*
* @tc.number FreeInstall_FA_ConnectAbility_PA_0100
* @tc.number FreeInstall_FA_ConnectAbility_PA_0100
* @tc.name Deviceid is empty,atomic service does not exist locally
* @tc.name Deviceid is empty,atomic service does not exist locally
* @tc.desc Function test
* @tc.level 0
*/
it
(
"FreeInstall_FA_ConnectAbility_PA_0100"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0100-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0100"
;
var
cmdmyapp7
=
"cp data/test/ConnectFaMyApplication7.hap /data/app/el2/100/base/com.ohos.hag.famanager/"
+
"haps/entry/files"
;
abilityDelegator
.
executeShellCommand
(
cmdmyapp7
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
setTimeout
(
async
()
=>
{
var
str1
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication.ServiceAbility"
,
}
};
startService
(
TAG
,
str1
);
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0100-------------"
);
},
4000
);
done
();
});
/*
* @tc.number FreeInstall_FA_ConnectAbility_PA_0200
* @tc.name Deviceid is empty,atomic service exists locally
* @tc.desc Function test
* @tc.desc Function test
* @tc.level 0
* @tc.level 0
*/
*/
it
(
"FreeInstall_FA_ConnectAbility_PA_0200"
,
0
,
async
function
(
done
)
{
it
(
"FreeInstall_FA_ConnectAbility_PA_0100"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0200-------------"
);
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0100-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0200"
;
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0100"
;
var
cmdapp9
=
"bm install -p data/test/ConnectFaMyApplication9.hap"
;
let
cmdmyapp7
=
"cp data/test/ConnectFaMyApplication7.hap /data/app/el2/100/base/com.ohos.hag.famanager/"
+
abilityDelegator
.
executeShellCommand
(
cmdapp9
,
(
err
:
any
,
d
:
any
)
=>
{
"haps/entry/files"
;
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
abilityDelegator
.
executeShellCommand
(
cmdmyapp7
,
(
err
:
any
,
d
:
any
)
=>
{
})
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
setTimeout
(
async
()
=>
{
})
var
str2
=
{
let
str1
=
{
"want"
:
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication.ServiceAbility2"
,
"abilityName"
:
"com.example.myapplication.ServiceAbility"
,
}
}
};
};
startService
(
TAG
,
str2
);
startService
(
TAG
,
str1
);
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
setTimeout
(()
=>
{
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0200-------------"
);
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
},
4000
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0100-------------"
);
done
();
done
();
});
},
4000
);
});
/*
* @tc.number FreeInstall_FA_ConnectAbility_PA_0300
/*
* @tc.name The bundleName passed in is different from the local
* @tc.number FreeInstall_FA_ConnectAbility_PA_0200
* @tc.desc Function test
* @tc.name Deviceid is empty,atomic service exists locally
* @tc.level 1
* @tc.desc Function test
*/
* @tc.level 0
it
(
"FreeInstall_FA_ConnectAbility_PA_0300"
,
0
,
async
function
(
done
)
{
*/
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0300-------------"
);
it
(
"FreeInstall_FA_ConnectAbility_PA_0200"
,
0
,
async
function
(
done
)
{
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0300"
;
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0200-------------"
);
setTimeout
(
async
()
=>
{
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0200"
;
var
str3
=
{
let
cmdapp9
=
"bm install -p data/test/ConnectFaMyApplication9.hap"
;
"want"
:
{
abilityDelegator
.
executeShellCommand
(
cmdapp9
,
(
err
:
any
,
d
:
any
)
=>
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
"abilityName"
:
"com.example.myapplication.ServiceAbility3"
,
})
}
await
sleep
(
2000
)
};
let
str2
=
{
startService
(
TAG
,
str3
);
"want"
:
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
"bundleName"
:
"com.example.myapplication.hmservice"
,
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
"abilityName"
:
"com.example.myapplication.ServiceAbility2"
,
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0300-------------"
);
}
},
4000
);
};
done
();
startService
(
TAG
,
str2
);
});
setTimeout
(()
=>
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
/*
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
* @tc.number FreeInstall_FA_ConnectAbility_PA_0400
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0200-------------"
);
* @tc.name Do not pass flags, atomic service does not exist locally
done
();
* @tc.desc Function test
},
4000
);
* @tc.level 1
});
*/
it
(
"FreeInstall_FA_ConnectAbility_PA_0400"
,
0
,
async
function
(
done
)
{
/*
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0400-------------"
);
* @tc.number FreeInstall_FA_ConnectAbility_PA_0300
setTimeout
(
async
()
=>
{
* @tc.name The bundleName passed in is different from the local
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0400"
;
* @tc.desc Function test
var
str4
=
{
* @tc.level 1
"want"
:
{
*/
"bundleName"
:
"com.example.myapplication.hmservice"
,
it
(
"FreeInstall_FA_ConnectAbility_PA_0300"
,
0
,
async
function
(
done
)
{
"abilityName"
:
"com.example.myapplication.ServiceAbility4"
,
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0300-------------"
);
}
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0300"
;
};
let
str3
=
{
startService
(
TAG
,
str4
);
"want"
:
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
"bundleName"
:
"com.example.myapplication.hmservice"
,
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
"abilityName"
:
"com.example.myapplication.ServiceAbility3"
,
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0400-------------"
);
}
},
4000
);
};
done
();
startService
(
TAG
,
str3
);
});
setTimeout
(()
=>
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
/*
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
* @tc.number FreeInstall_FA_ConnectAbility_PA_0500
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0300-------------"
);
* @tc.name Do not pass flags, atomic service exists locally
done
();
* @tc.desc Function test
},
4000
);
* @tc.level 0
});
*/
it
(
"FreeInstall_FA_ConnectAbility_PA_0500"
,
0
,
async
function
(
done
)
{
/*
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0500-------------"
);
* @tc.number FreeInstall_FA_ConnectAbility_PA_0400
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0500"
;
* @tc.name Do not pass flags, atomic service does not exist locally
var
cmdin
=
"bm install -p data/test/ConnectDifferentApplication.hap"
;
* @tc.desc Function test
abilityDelegator
.
executeShellCommand
(
cmdin
,
(
err
:
any
,
d
:
any
)
=>
{
* @tc.level 1
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
*/
})
it
(
"FreeInstall_FA_ConnectAbility_PA_0400"
,
0
,
async
function
(
done
)
{
setTimeout
(
async
()
=>
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0400-------------"
);
var
str5
=
{
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0400"
;
"want"
:
{
let
str4
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"want"
:
{
"abilityName"
:
"com.example.myapplication.ServiceAbility5"
,
"bundleName"
:
"com.example.myapplication.hmservice"
,
}
"abilityName"
:
"com.example.myapplication.ServiceAbility4"
,
};
}
startService
(
TAG
,
str5
);
};
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
startService
(
TAG
,
str4
);
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
setTimeout
(()
=>
{
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0500-------------"
);
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
},
4000
);
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
done
();
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0400-------------"
);
});
done
();
},
4000
);
/*
});
* @tc.number FreeInstall_FA_ConnectAbility_PA_0600
* @tc.name Incorrect deviceid passed in
/*
* @tc.desc Function test
* @tc.number FreeInstall_FA_ConnectAbility_PA_0500
* @tc.level 1
* @tc.name Do not pass flags, atomic service exists locally
*/
* @tc.desc Function test
it
(
"FreeInstall_FA_ConnectAbility_PA_0600"
,
0
,
async
function
(
done
)
{
* @tc.level 0
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0600-------------"
);
*/
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0600"
;
it
(
"FreeInstall_FA_ConnectAbility_PA_0500"
,
0
,
async
function
(
done
)
{
setTimeout
(
async
()
=>
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0500-------------"
);
var
str6
=
{
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0500"
;
"want"
:
{
let
cmdin
=
"bm install -p data/test/ConnectDifferentApplication.hap"
;
"bundleName"
:
"com.example.myapplication.hmservice"
,
abilityDelegator
.
executeShellCommand
(
cmdin
,
(
err
:
any
,
d
:
any
)
=>
{
"abilityName"
:
"com.example.myapplication.ServiceAbility6"
,
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
}
})
};
await
sleep
(
2000
)
startService
(
TAG
,
str6
);
let
str5
=
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
"want"
:
{
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
"bundleName"
:
"com.example.myapplication.hmservice"
,
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0600-------------"
);
"abilityName"
:
"com.example.myapplication.ServiceAbility5"
,
},
4000
);
}
done
();
};
});
startService
(
TAG
,
str5
);
setTimeout
(()
=>
{
/*
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
* @tc.number FreeInstall_FA_ConnectAbility_PA_0700
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
* @tc.name Incorrect bundleName passed in
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0500-------------"
);
* @tc.desc Function test
done
();
* @tc.level 1
},
4000
);
*/
});
it
(
"FreeInstall_FA_ConnectAbility_PA_0700"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0700-------------"
);
/*
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0700"
;
* @tc.number FreeInstall_FA_ConnectAbility_PA_0600
* @tc.name Incorrect deviceid passed in
setTimeout
(
async
()
=>
{
* @tc.desc Function test
var
str7
=
{
* @tc.level 1
"want"
:
{
*/
"bundleName"
:
"com.example.myapplication.hmservice"
,
it
(
"FreeInstall_FA_ConnectAbility_PA_0600"
,
0
,
async
function
(
done
)
{
"abilityName"
:
"com.example.myapplication.ServiceAbility7"
,
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0600-------------"
);
}
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0600"
;
};
let
str6
=
{
startService
(
TAG
,
str7
);
"want"
:
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
"bundleName"
:
"com.example.myapplication.hmservice"
,
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
"abilityName"
:
"com.example.myapplication.ServiceAbility6"
,
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0700-------------"
);
}
},
4000
);
};
done
();
startService
(
TAG
,
str6
);
});
setTimeout
(()
=>
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
/*
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
* @tc.number FreeInstall_FA_ConnectAbility_PA_0800
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0600-------------"
);
* @tc.name Pass in an empty abilityName
done
();
* @tc.desc Function test
},
4000
);
* @tc.level 1
});
*/
it
(
"FreeInstall_FA_ConnectAbility_PA_0800"
,
0
,
async
function
(
done
)
{
/*
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0800-------------"
);
* @tc.number FreeInstall_FA_ConnectAbility_PA_0700
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0800"
;
* @tc.name Incorrect bundleName passed in
* @tc.desc Function test
setTimeout
(
async
()
=>
{
* @tc.level 1
var
str8
=
{
*/
"want"
:
{
it
(
"FreeInstall_FA_ConnectAbility_PA_0700"
,
0
,
async
function
(
done
)
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0700-------------"
);
"abilityName"
:
"com.example.myapplication.ServiceAbility8"
,
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0700"
;
}
};
let
str7
=
{
startService
(
TAG
,
str8
);
"want"
:
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
"bundleName"
:
"com.example.myapplication.hmservice"
,
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
"abilityName"
:
"com.example.myapplication.ServiceAbility7"
,
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0800-------------"
);
}
},
4000
);
};
done
();
startService
(
TAG
,
str7
);
});
setTimeout
(()
=>
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
/*
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
* @tc.number FreeInstall_FA_ConnectAbility_PA_0900
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0700-------------"
);
* @tc.name No atomic service under path
done
();
* @tc.desc Function test
},
4000
);
* @tc.level 1
});
*/
it
(
"FreeInstall_FA_ConnectAbility_PA_0900"
,
0
,
async
function
(
done
)
{
/*
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0900-------------"
);
* @tc.number FreeInstall_FA_ConnectAbility_PA_0800
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0900"
;
* @tc.name Pass in an empty abilityName
var
cmdrm
=
"rm -r /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files/*"
;
* @tc.desc Function test
abilityDelegator
.
executeShellCommand
(
cmdrm
,
(
err
:
any
,
d
:
any
)
=>
{
* @tc.level 1
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
*/
})
it
(
"FreeInstall_FA_ConnectAbility_PA_0800"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0800-------------"
);
setTimeout
(
async
()
=>
{
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0800"
;
await
sleep
(
500
);
var
str9
=
{
let
str8
=
{
"want"
:
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication.ServiceAbility9"
,
"abilityName"
:
"com.example.myapplication.ServiceAbility8"
,
}
}
};
};
startService
(
TAG
,
str9
);
startService
(
TAG
,
str8
);
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
setTimeout
(()
=>
{
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0900-------------"
);
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
},
4000
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0800-------------"
);
done
();
done
();
});
},
4000
);
});
/*
* @tc.number FreeInstall_FA_ConnectAbility_PA_1000
/*
* @tc.name Incorrect moduleName passed in
* @tc.number FreeInstall_FA_ConnectAbility_PA_0900
* @tc.desc Function test
* @tc.name No atomic service under path
* @tc.level 1
* @tc.desc Function test
*/
* @tc.level 1
it
(
"FreeInstall_FA_ConnectAbility_PA_1000"
,
0
,
async
function
(
done
)
{
*/
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_1000-------------"
);
it
(
"FreeInstall_FA_ConnectAbility_PA_0900"
,
0
,
async
function
(
done
)
{
TAG
=
"FreeInstall_FA_ConnectAbility_PA_1000"
;
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0900-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0900"
;
setTimeout
(
async
()
=>
{
let
cmdrm
=
"rm -r /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files/*"
;
var
str10
=
{
abilityDelegator
.
executeShellCommand
(
cmdrm
,
(
err
:
any
,
d
:
any
)
=>
{
"want"
:
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
"bundleName"
:
"com.example.myapplication.hmservice"
,
})
"abilityName"
:
"com.example.myapplication.ServiceAbility10"
,
}
await
sleep
(
500
);
};
let
str9
=
{
startService
(
TAG
,
str10
);
"want"
:
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
"bundleName"
:
"com.example.myapplication.hmservice"
,
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
"abilityName"
:
"com.example.myapplication.ServiceAbility9"
,
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_1000-------------"
);
}
},
4000
);
};
done
();
startService
(
TAG
,
str9
);
});
setTimeout
(()
=>
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
/*
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
* @tc.number FreeInstall_FA_ConnectAbility_PA_1100
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0900-------------"
);
* @tc.name Pass in parameters
done
();
* @tc.desc Function test
},
4000
);
* @tc.level 0
});
*/
it
(
"FreeInstall_FA_ConnectAbility_PA_1100"
,
0
,
async
function
(
done
)
{
/*
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_1100-------------"
);
* @tc.number FreeInstall_FA_ConnectAbility_PA_1000
TAG
=
"FreeInstall_FA_ConnectAbility_PA_1100"
;
* @tc.name Incorrect moduleName passed in
var
cmdmyapp8
=
"cp data/test/ConnectFaMyApplication8.hap /data/app/el2/100/base/com.ohos.hag.famanager/"
+
* @tc.desc Function test
"haps/entry/files"
;
* @tc.level 1
abilityDelegator
.
executeShellCommand
(
cmdmyapp8
,
(
err
:
any
,
d
:
any
)
=>
{
*/
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
it
(
"FreeInstall_FA_ConnectAbility_PA_1000"
,
0
,
async
function
(
done
)
{
})
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_1000-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_PA_1000"
;
setTimeout
(
async
()
=>
{
var
str11
=
{
let
str10
=
{
"want"
:
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication.ServiceAbility11"
,
"abilityName"
:
"com.example.myapplication.ServiceAbility10"
,
}
}
};
};
startService
(
TAG
,
str11
);
startService
(
TAG
,
str10
);
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
setTimeout
(()
=>
{
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_1100-------------"
);
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
},
4000
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_1000-------------"
);
done
();
done
();
});
},
4000
);
}
});
)
}
/*
* @tc.number FreeInstall_FA_ConnectAbility_PA_1100
* @tc.name Pass in parameters
* @tc.desc Function test
* @tc.level 0
*/
it
(
"FreeInstall_FA_ConnectAbility_PA_1100"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_1100-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_PA_1100"
;
let
cmdmyapp8
=
"cp data/test/ConnectFaMyApplication8.hap /data/app/el2/100/base/com.ohos.hag.famanager/"
+
"haps/entry/files"
;
abilityDelegator
.
executeShellCommand
(
cmdmyapp8
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
let
str11
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication.ServiceAbility11"
,
}
};
startService
(
TAG
,
str11
);
setTimeout
(()
=>
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_1100-------------"
);
done
()
},
4000
);
});
}
)
}
\ No newline at end of file
ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets
浏览文件 @
736895f0
...
@@ -772,7 +772,7 @@ export default function StartAbilityForResult() {
...
@@ -772,7 +772,7 @@ export default function StartAbilityForResult() {
/*
/*
* @tc.number: FreeInstall_FA_StartAbilityForResult_1900
* @tc.number: FreeInstall_FA_StartAbilityForResult_1900
* @tc.name: startAbilityForResult: yuanzihua already installed,input wrong flags('11'),start
successfully
.
* @tc.name: startAbilityForResult: yuanzihua already installed,input wrong flags('11'),start
failed
.
* @tc.desc: Function test
* @tc.desc: Function test
* @tc.level 0
* @tc.level 0
*/
*/
...
@@ -800,14 +800,14 @@ export default function StartAbilityForResult() {
...
@@ -800,14 +800,14 @@ export default function StartAbilityForResult() {
}
}
await featureAbility.startAbilityForResult(startAbilityParameter)
await featureAbility.startAbilityForResult(startAbilityParameter)
.then((data) => {
.then((data) => {
details = data;
console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data))
console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data))
}).catch((error) => {
}).catch((error) => {
details = error;
console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error));
console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error));
})
})
await Utils.sleep(2000);
await Utils.sleep(2000);
console.log(TAG + "
resultCode: " + details.resultC
ode);
console.log(TAG + "
errorCode: " + details.c
ode);
expect(details.
resultC
ode).assertEqual(1);
expect(details.
c
ode).assertEqual(1);
done();
done();
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录