Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0fe3677e
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0fe3677e
编写于
11月 11, 2022
作者:
C
chengxingzhen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xts失败用例适配
Signed-off-by:
N
chengxingzhen
<
chengxingzhen@huawei.com
>
上级
6e047c25
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
287 addition
and
318 deletion
+287
-318
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest.ets
...ntry/src/main/ets/MainAbility/test/ConnectAbilityTest.ets
+185
-206
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets
...try/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets
+101
-111
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets
...y/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets
+1
-1
未找到文件。
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest.ets
浏览文件 @
0fe3677e
此差异已折叠。
点击以展开。
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets
浏览文件 @
0fe3677e
...
...
@@ -13,7 +13,7 @@
* 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
rpc
from
'@ohos.rpc'
;
import
featureAbility
from
'@ohos.ability.featureAbility'
;
import
wantConstant
from
'@ohos.ability.wantConstant'
...
...
@@ -22,9 +22,9 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry
export
default
function
ConnectAbilityTest1
()
{
var
TAG
=
""
;
var
Tempassert
=
""
;
var
abilityDelegator
=
undefined
let
TAG
=
""
;
let
Tempassert
=
""
;
let
abilityDelegator
=
undefined
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
))
...
...
@@ -34,17 +34,19 @@ export default function ConnectAbilityTest1() {
beforeAll
(
async
function
(
done
)
{
console
.
info
(
"FreeInstall_FA_ConnectAbility before all called"
);
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
(
TAG
+
" abilityDelegator : "
+
JSON
.
stringify
(
abilityDelegator
));
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
"executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
var
cmd1
=
"mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"
;
await
sleep
(
500
);
let
cmd1
=
"mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"
;
abilityDelegator
.
executeShellCommand
(
cmd1
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
"executeShellCommand1 : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
var
cmd2
=
"mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"
;
await
sleep
(
500
);
let
cmd2
=
"mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"
;
abilityDelegator
.
executeShellCommand
(
cmd2
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
"executeShellCommand2 : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
done
();
...
...
@@ -54,11 +56,12 @@ export default function ConnectAbilityTest1() {
afterEach
(
async
function
(
done
)
{
console
.
info
(
"FreeInstall_FA_ConnectAbility after each called"
);
Tempassert
=
""
if
(
"FreeInstall_FA_ConnectAbility_
16
00"
===
TAG
)
{
var
cmd14
=
"bm uninstall -n com.ohos.hag.famanager"
;
if
(
"FreeInstall_FA_ConnectAbility_
20
00"
===
TAG
)
{
let
cmd14
=
"bm uninstall -n com.ohos.hag.famanager"
;
abilityDelegator
.
executeShellCommand
(
cmd14
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
"executeShellCommand14 : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
await
sleep
(
2000
)
}
done
();
});
...
...
@@ -113,8 +116,6 @@ export default function ConnectAbilityTest1() {
console
.
info
(
msg
+
"END"
);
}
/*
* @tc.number FreeInstall_FA_ConnectAbility_1500
* @tc.name The application is not in the foreground,
...
...
@@ -125,11 +126,12 @@ export default function ConnectAbilityTest1() {
it
(
"FreeInstall_FA_ConnectAbility_1500"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_1500-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_1500"
;
var
cmddif
=
"bm install -p data/test/ConnectDifferentApplication.hap"
;
let
cmddif
=
"bm install -p data/test/ConnectDifferentApplication.hap"
;
abilityDelegator
.
executeShellCommand
(
cmddif
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
var
str
=
{
await
sleep
(
2000
)
let
str
=
{
"want"
:
{
"bundleName"
:
"com.example.different.hmservice"
,
"abilityName"
:
"MainAbility"
,
...
...
@@ -141,20 +143,18 @@ export default function ConnectAbilityTest1() {
})
.
catch
((
error
)
=>
{
console
.
error
(
TAG
+
" startother failed. Cause: "
+
JSON
.
stringify
(
error
));
})
setTimeout
(
async
()
=>
{
var
request15
=
{
"bundleName"
:
"com.example.myapplication.hmservice
"
,
"abilityName"
:
"com.example.myapplication5.ServiceAbility
5"
,
"moduleName"
:
"myapplication5"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request15
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onFailed
"
);
},
500
)
let
request15
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication5.ServiceAbility5
"
,
"moduleName"
:
"myapplication
5"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request15
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onFailed"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1500-------------
"
);
done
();
},
2000
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1500-------------"
);
done
();
});
/*
...
...
@@ -167,11 +167,12 @@ export default function ConnectAbilityTest1() {
it
(
"FreeInstall_FA_ConnectAbility_1600"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_1600-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_1600"
;
var
cmdmyapp4
=
"bm install -p data/test/ConnectFaMyApplication4.hap"
;
let
cmdmyapp4
=
"bm install -p data/test/ConnectFaMyApplication4.hap"
;
abilityDelegator
.
executeShellCommand
(
cmdmyapp4
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
var
str
=
{
await
sleep
(
2000
)
let
str
=
{
"want"
:
{
"bundleName"
:
"com.example.different.hmservice"
,
"abilityName"
:
"MainAbility"
,
...
...
@@ -184,20 +185,18 @@ export default function ConnectAbilityTest1() {
console
.
error
(
TAG
+
" startother failed. Cause: "
+
JSON
.
stringify
(
error
));
})
setTimeout
(
function
()
{
var
request16
=
{
"bundleName"
:
"com.example.myapplication.hmservice
"
,
"abilityName"
:
"com.example.myapplication4.ServiceAbility
4"
,
"moduleName"
:
"myapplication4"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request16
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onConnect
"
);
},
500
)
let
request16
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication4.ServiceAbility4
"
,
"moduleName"
:
"myapplication
4"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request16
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onConnect"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1600-------------
"
);
done
();
},
2000
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1600-------------"
);
done
();
});
/*
...
...
@@ -209,7 +208,7 @@ export default function ConnectAbilityTest1() {
it
(
"FreeInstall_FA_ConnectAbility_1400"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_1400-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_1400"
;
var
str
=
{
let
str
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication2.MainAbility"
,
...
...
@@ -222,20 +221,18 @@ export default function ConnectAbilityTest1() {
})
.
catch
((
error
)
=>
{
console
.
error
(
TAG
+
" startmyapp2 failed. Cause: "
+
JSON
.
stringify
(
error
));
})
let
request14
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication1.ServiceAbility_feature"
,
"moduleName"
:
"myapplication3"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request14
);
setTimeout
(()
=>
{
var
request14
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication1.ServiceAbility_feature"
,
"moduleName"
:
"myapplication3"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request14
);
setTimeout
(
async
()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onFailed"
);
},
500
);
expect
(
Tempassert
)
.
assertEqual
(
"onFailed"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1400-------------"
);
done
()
},
2000
)
done
();
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1400-------------"
);
});
/*
...
...
@@ -247,23 +244,22 @@ export default function ConnectAbilityTest1() {
it
(
"FreeInstall_FA_ConnectAbility_1700"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_1700-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_1700"
;
var
cmddif
=
"bm install -p data/test/ConnectDifferentApplication.hap"
;
let
cmddif
=
"bm install -p data/test/ConnectDifferentApplication.hap"
;
await
abilityDelegator
.
executeShellCommand
(
cmddif
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
await
sleep
(
2000
)
let
request17
=
{
"bundleName"
:
"com.example.different.hmservice"
,
"abilityName"
:
"com.example.different.ServiceAbility"
,
"moduleName"
:
"entry"
,
}
connectabillity
(
TAG
,
request17
);
setTimeout
(()
=>
{
var
request17
=
{
"bundleName"
:
"com.example.different.hmservice"
,
"abilityName"
:
"com.example.different.ServiceAbility"
,
"moduleName"
:
"entry"
,
}
connectabillity
(
TAG
,
request17
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onConnect"
);
},
500
);
expect
(
Tempassert
)
.
assertEqual
(
"onConnect"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1700-------------"
);
done
();
},
2000
)
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1700-------------"
);
done
();
});
/*
...
...
@@ -275,21 +271,18 @@ export default function ConnectAbilityTest1() {
it
(
"FreeInstall_FA_ConnectAbility_1800"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_1800-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_1800"
;
setTimeout
(
async
()
=>
{
var
request18
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication1.ServiceAbility_feature"
,
"moduleName"
:
"xxxxx"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request18
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onFailed"
);
},
500
)
let
request18
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication1.ServiceAbility_feature"
,
"moduleName"
:
"xxxxx"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request18
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onFailed"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1800-------------"
);
done
();
},
2000
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1800-------------"
);
done
();
});
/*
...
...
@@ -301,25 +294,23 @@ export default function ConnectAbilityTest1() {
it
(
"FreeInstall_FA_ConnectAbility_1900"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_1900-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_1900"
;
var
cmdmyapp5
=
"cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/"
+
let
cmdmyapp5
=
"cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/"
+
"haps/entry/files"
;
await
abilityDelegator
.
executeShellCommand
(
cmdmyapp5
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
setTimeout
(
async
()
=>
{
var
request19
=
{
"bundleName"
:
"com.example.myapplication.hmservic
e"
,
"abilityName"
:
"com.example.myapplication1.ServiceAbility_feature
"
,
"moduleName"
:
"myapplication3"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request19
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onFailed
"
);
},
500
)
let
request19
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication1.ServiceAbility_featur
e"
,
"moduleName"
:
"myapplication3
"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request19
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onFailed"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1900-------------
"
);
done
();
},
2000
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1900-------------"
);
done
();
});
/*
...
...
@@ -331,28 +322,27 @@ export default function ConnectAbilityTest1() {
it
(
"FreeInstall_FA_ConnectAbility_2000"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_2000-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_2000"
;
var
cmdmyapp5
=
"cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/"
+
let
cmdmyapp5
=
"cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/"
+
"haps/entry/files"
;
abilityDelegator
.
executeShellCommand
(
cmdmyapp5
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
setTimeout
(
async
()
=>
{
var
request20
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication5.ServiceAbility5"
,
"moduleName"
:
"myapplication5"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
"parameters"
:
{
"name"
:
1111
,
"key1"
:
"value1"
,
"site"
:
"nice to meet you!"
},
}
connectabillity
(
TAG
,
request20
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onConnect"
);
},
500
)
await
sleep
(
1000
)
let
request20
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication5.ServiceAbility5"
,
"moduleName"
:
"myapplication5"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
"parameters"
:
{
"name"
:
1111
,
"key1"
:
"value1"
,
"site"
:
"nice to meet you!"
},
}
connectabillity
(
TAG
,
request20
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onConnect"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_2000-------------"
);
done
()
},
4000
)
done
();
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_2000-------------"
);
});
}
)
...
...
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets
浏览文件 @
0fe3677e
...
...
@@ -146,8 +146,8 @@
abilityDelegator
.
executeShellCommand
(
cmd14
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
"executeShellCommand14 : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
await
sleep
(
2000
)
}
await
sleep
(
1500
);
done
();
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录