Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
459a517a
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看板
提交
459a517a
编写于
9月 23, 2022
作者:
X
xinxin13
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change freeinstalltest code case
Signed-off-by:
N
xinxin13
<
xinxin13@huawei.com
>
上级
69ee04d7
变更
11
展开全部
显示空白变更内容
内联
并排
Showing
11 changed file
with
1682 addition
and
1635 deletion
+1682
-1635
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest.ets
...ntry/src/main/ets/MainAbility/test/ConnectAbilityTest.ets
+477
-600
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets
...try/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets
+325
-173
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/List.test.ets
...yfatest/entry/src/main/ets/MainAbility/test/List.test.ets
+7
-7
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets
...y/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets
+119
-118
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility2/app.ets
...nectabilityfatest/entry/src/main/ets/MainAbility2/app.ets
+1
-1
ability/ability_runtime/freeinstalltest/startabilityfatest/actsfreeinstallstartabilityfatest/entry/src/main/ets/MainAbility/test/StartAbility.test2.ets
...ntry/src/main/ets/MainAbility/test/StartAbility.test2.ets
+194
-197
ability/ability_runtime/freeinstalltest/startabilityfatest/actsstartabilitynotargetbundlelistfatest/entry/src/main/ets/MainAbility/test/StartAbility.test.ets
...entry/src/main/ets/MainAbility/test/StartAbility.test.ets
+181
-179
ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult2.test.ets
...main/ets/MainAbility/test/StartAbilityForResult2.test.ets
+55
-55
ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/PageAbility/app.ets
...ityforresultfatest/entry/src/main/ets/PageAbility/app.ets
+14
-14
ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsstartabilityforresultnotargetfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets
.../main/ets/MainAbility/test/StartAbilityForResult.test.ets
+35
-34
ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest/entry/src/main/ets/test/StartAbilityForResult.ets
...agetest/entry/src/main/ets/test/StartAbilityForResult.ets
+274
-257
未找到文件。
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest.ets
浏览文件 @
459a517a
此差异已折叠。
点击以展开。
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets
浏览文件 @
459a517a
...
...
@@ -42,12 +42,10 @@ export default function ConnectAbilityTest1() {
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
"executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
await
sleep
(
500
);
var
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
));
})
await
sleep
(
500
);
var
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
));
...
...
@@ -58,14 +56,12 @@ export default function ConnectAbilityTest1() {
afterEach
(
async
function
(
done
)
{
console
.
info
(
"FreeInstall_FA_ConnectAbility after each called"
);
Tempassert
=
""
await
sleep
(
1000
);
if
(
"FreeInstall_FA_ConnectAbility_1600"
===
TAG
)
{
var
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
(
500
);
done
();
});
...
...
@@ -135,7 +131,6 @@ export default function ConnectAbilityTest1() {
abilityDelegator
.
executeShellCommand
(
cmddif
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
await
sleep
(
1000
);
var
str
=
{
"want"
:
{
"bundleName"
:
"com.example.different.hmservice"
,
...
...
@@ -148,7 +143,7 @@ export default function ConnectAbilityTest1() {
})
.
catch
((
error
)
=>
{
console
.
error
(
TAG
+
" startother failed. Cause: "
+
JSON
.
stringify
(
error
));
})
await
sleep
(
1500
);
setTimeout
(
async
()
=>
{
var
request15
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication5.ServiceAbility5"
,
...
...
@@ -156,11 +151,12 @@ export default function ConnectAbilityTest1() {
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request15
);
setTimeout
(
function
()
{
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onFailed"
);
},
500
)
},
2000
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1500-------------"
);
done
();
},
1500
);
});
/*
...
...
@@ -177,7 +173,6 @@ export default function ConnectAbilityTest1() {
abilityDelegator
.
executeShellCommand
(
cmdmyapp4
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
await
sleep
(
1000
);
var
str
=
{
"want"
:
{
"bundleName"
:
"com.example.different.hmservice"
,
...
...
@@ -190,7 +185,8 @@ export default function ConnectAbilityTest1() {
})
.
catch
((
error
)
=>
{
console
.
error
(
TAG
+
" startother failed. Cause: "
+
JSON
.
stringify
(
error
));
})
await
sleep
(
1500
);
setTimeout
(
function
()
{
var
request16
=
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication4.ServiceAbility4"
,
...
...
@@ -198,11 +194,167 @@ export default function ConnectAbilityTest1() {
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request16
);
setTimeout
(
function
()
{
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onConnect"
);
},
500
)
},
2000
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1600-------------"
);
done
();
},
1500
);
});
/*
* @tc.number FreeInstall_FA_ConnectAbility_1400
* @tc.name The application is not in the foreground [start myapp2 first, then connect]
* @tc.desc Function test
* @tc.level 1
*/
it
(
"FreeInstall_FA_ConnectAbility_1400"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_1400-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_1400"
;
var
str
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
"abilityName"
:
"com.example.myapplication2.MainAbility"
,
}
}
console
.
info
(
TAG
+
" startmyapp2 str: "
+
JSON
.
stringify
(
str
));
featureAbility
.
startAbility
(
str
)
.
then
((
data
)
=>
{
console
.
info
(
TAG
+
" startmyapp2 successful. Data: "
+
JSON
.
stringify
(
data
))
})
.
catch
((
error
)
=>
{
console
.
error
(
TAG
+
" startmyapp2 failed. Cause: "
+
JSON
.
stringify
(
error
));
})
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
);
},
2000
)
done
();
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1400-------------"
);
});
/*
* @tc.number FreeInstall_FA_ConnectAbility_1700
* @tc.name Do not pass flags, connect to the service of another project
* @tc.desc Function test
* @tc.level 0
*/
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"
;
await
abilityDelegator
.
executeShellCommand
(
cmddif
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
setTimeout
(()
=>
{
var
request17
=
{
"bundleName"
:
"com.example.different.hmservice"
,
"abilityName"
:
"com.example.different.ServiceAbility"
,
"moduleName"
:
"entry"
,
}
connectabillity
(
TAG
,
request17
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onConnect"
);
},
500
);
},
2000
)
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1700-------------"
);
done
();
});
/*
* @tc.number FreeInstall_FA_ConnectAbility_1800
* @tc.name Incorrect moduleName passed in
* @tc.desc Function test
* @tc.level 1
*/
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
)
},
2000
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1800-------------"
);
done
();
});
/*
* @tc.number FreeInstall_FA_ConnectAbility_1900
* @tc.name The target is atomized as hapA, and hapB is placed under the path
* @tc.desc Function test
* @tc.level 1
*/
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/"
+
"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.hmservice"
,
"abilityName"
:
"com.example.myapplication1.ServiceAbility_feature"
,
"moduleName"
:
"myapplication3"
,
"flags"
:
wantConstant
.
Flags
.
FLAG_INSTALL_ON_DEMAND
,
}
connectabillity
(
TAG
,
request19
);
setTimeout
(()
=>
{
expect
(
Tempassert
)
.
assertEqual
(
"onFailed"
);
},
500
)
},
2000
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_1900-------------"
);
done
();
});
/*
* @tc.number FreeInstall_FA_ConnectAbility_2000
* @tc.name Pass in parameters
* @tc.desc Function test
* @tc.level 0
*/
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/"
+
"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
)
},
4000
)
done
();
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_2000-------------"
);
});
}
)
...
...
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/List.test.ets
浏览文件 @
459a517a
...
...
@@ -12,13 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ConnectAbilityTest1 from './ConnectAbilityTest1'
import ConnectAbilityTest from './ConnectAbilityTest'
import connectAbilityTest_PA from './connectAbilityTest_PA'
import ConnectAbilityTest from './ConnectAbilityTest'
import ConnectAbilityTest1 from './ConnectAbilityTest1'
export default function testsuite() {
ConnectAbilityTest1();
ConnectAbilityTest();
connectAbilityTest_PA();
ConnectAbilityTest();
ConnectAbilityTest1();
}
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets
浏览文件 @
459a517a
...
...
@@ -167,7 +167,7 @@ export default function connectAbilityTest_PA() {
abilityDelegator
.
executeShellCommand
(
cmdmyapp7
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
await
sleep
(
500
);
setTimeout
(
async
()
=>
{
var
str1
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
...
...
@@ -175,12 +175,11 @@ export default function connectAbilityTest_PA() {
}
};
startService
(
TAG
,
str1
);
setTimeout
(
function
()
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0100-------------"
);
done
();
},
4000
);
done
();
});
/*
...
...
@@ -196,7 +195,7 @@ export default function connectAbilityTest_PA() {
abilityDelegator
.
executeShellCommand
(
cmdapp9
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
await
sleep
(
500
);
setTimeout
(
async
()
=>
{
var
str2
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
...
...
@@ -204,12 +203,11 @@ export default function connectAbilityTest_PA() {
}
};
startService
(
TAG
,
str2
);
setTimeout
(
function
()
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0200-------------"
);
done
();
},
4000
);
done
();
});
/*
...
...
@@ -221,6 +219,7 @@ export default function connectAbilityTest_PA() {
it
(
"FreeInstall_FA_ConnectAbility_PA_0300"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0300-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0300"
;
setTimeout
(
async
()
=>
{
var
str3
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
...
...
@@ -228,12 +227,11 @@ export default function connectAbilityTest_PA() {
}
};
startService
(
TAG
,
str3
);
setTimeout
(
function
()
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0300-------------"
);
done
();
},
4000
);
done
();
});
/*
...
...
@@ -244,6 +242,7 @@ export default function connectAbilityTest_PA() {
*/
it
(
"FreeInstall_FA_ConnectAbility_PA_0400"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0400-------------"
);
setTimeout
(
async
()
=>
{
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0400"
;
var
str4
=
{
"want"
:
{
...
...
@@ -252,12 +251,11 @@ export default function connectAbilityTest_PA() {
}
};
startService
(
TAG
,
str4
);
setTimeout
(
function
()
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0400-------------"
);
done
();
},
4000
);
done
();
});
/*
...
...
@@ -273,7 +271,7 @@ export default function connectAbilityTest_PA() {
abilityDelegator
.
executeShellCommand
(
cmdin
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
await
sleep
(
500
);
setTimeout
(
async
()
=>
{
var
str5
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
...
...
@@ -281,12 +279,11 @@ export default function connectAbilityTest_PA() {
}
};
startService
(
TAG
,
str5
);
setTimeout
(
function
()
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0500-------------"
);
done
();
},
4000
);
done
();
});
/*
...
...
@@ -298,6 +295,7 @@ export default function connectAbilityTest_PA() {
it
(
"FreeInstall_FA_ConnectAbility_PA_0600"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0600-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0600"
;
setTimeout
(
async
()
=>
{
var
str6
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
...
...
@@ -305,12 +303,11 @@ export default function connectAbilityTest_PA() {
}
};
startService
(
TAG
,
str6
);
setTimeout
(
function
()
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0600-------------"
);
done
();
},
4000
);
done
();
});
/*
...
...
@@ -322,6 +319,8 @@ export default function connectAbilityTest_PA() {
it
(
"FreeInstall_FA_ConnectAbility_PA_0700"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0700-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0700"
;
setTimeout
(
async
()
=>
{
var
str7
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
...
...
@@ -329,12 +328,11 @@ export default function connectAbilityTest_PA() {
}
};
startService
(
TAG
,
str7
);
setTimeout
(
function
()
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0700-------------"
);
done
();
},
4000
);
done
();
});
/*
...
...
@@ -346,6 +344,8 @@ export default function connectAbilityTest_PA() {
it
(
"FreeInstall_FA_ConnectAbility_PA_0800"
,
0
,
async
function
(
done
)
{
console
.
log
(
"------------start FreeInstall_FA_ConnectAbility_PA_0800-------------"
);
TAG
=
"FreeInstall_FA_ConnectAbility_PA_0800"
;
setTimeout
(
async
()
=>
{
var
str8
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
...
...
@@ -353,12 +353,11 @@ export default function connectAbilityTest_PA() {
}
};
startService
(
TAG
,
str8
);
setTimeout
(
function
()
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0800-------------"
);
done
();
},
4000
);
done
();
});
/*
...
...
@@ -374,6 +373,8 @@ export default function connectAbilityTest_PA() {
abilityDelegator
.
executeShellCommand
(
cmdrm
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
setTimeout
(
async
()
=>
{
await
sleep
(
500
);
var
str9
=
{
"want"
:
{
...
...
@@ -382,12 +383,11 @@ export default function connectAbilityTest_PA() {
}
};
startService
(
TAG
,
str9
);
setTimeout
(
function
()
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_0900-------------"
);
done
();
},
4000
);
done
();
});
/*
...
...
@@ -399,6 +399,8 @@ export default function connectAbilityTest_PA() {
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
str10
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
...
...
@@ -406,12 +408,11 @@ export default function connectAbilityTest_PA() {
}
};
startService
(
TAG
,
str10
);
setTimeout
(
function
()
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onFailed"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_1000-------------"
);
done
();
},
4000
);
done
();
});
/*
...
...
@@ -428,7 +429,8 @@ export default function connectAbilityTest_PA() {
abilityDelegator
.
executeShellCommand
(
cmdmyapp8
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
TAG
+
" executeShellCommand : err : "
+
JSON
.
stringify
(
err
),
" data : "
+
JSON
.
stringify
(
d
));
})
await
sleep
(
1000
);
setTimeout
(
async
()
=>
{
var
str11
=
{
"want"
:
{
"bundleName"
:
"com.example.myapplication.hmservice"
,
...
...
@@ -436,12 +438,11 @@ export default function connectAbilityTest_PA() {
}
};
startService
(
TAG
,
str11
);
setTimeout
(
function
()
{
console
.
info
(
TAG
+
" SubscribeCallBack data: "
+
JSON
.
stringify
(
dataAssert
));
expect
(
dataAssert
)
.
assertEqual
(
"onConnect"
);
console
.
log
(
"------------end FreeInstall_FA_ConnectAbility_PA_1100-------------"
);
done
();
},
4000
);
done
();
});
}
)
...
...
ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility2/app.ets
浏览文件 @
459a517a
...
...
@@ -17,7 +17,7 @@ import featureAbility from '@ohos.ability.featureAbility';
export default {
onCreate() {
console.info('Application onCreate')
setTimeout(
function ()
{
setTimeout(
()=>
{
featureAbility.terminateSelf()
.then((data) => {
console.info('[Demo] MainAbility2 terminateself succeeded: ' + data);
...
...
ability/ability_runtime/freeinstalltest/startabilityfatest/actsfreeinstallstartabilityfatest/entry/src/main/ets/MainAbility/test/StartAbility.test2.ets
浏览文件 @
459a517a
...
...
@@ -103,7 +103,7 @@ export default function startAbilityTest2() {
}).catch((error) => {
console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error));
})
await sleep(3000);
setTimeout(async () => {
var str = {
'want': {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -118,8 +118,8 @@ export default function startAbilityTest2() {
wrong = error;
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
});
await sleep(2000);
expect(wrong.code).assertEqual(13);
}, 2000)
console.info("------------end FreeInstall_FA_Local_StartAbility_1900-------------");
done();
});
...
...
@@ -153,7 +153,7 @@ export default function startAbilityTest2() {
}).catch((error) => {
console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error));
})
await sleep(3000);
setTimeout(async () => {
var str = {
'want': {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -170,8 +170,8 @@ export default function startAbilityTest2() {
});
await sleep(2000);
expect(wrong.code).assertEqual(13);
}, 2000)
console.info("------------end FreeInstall_FA_Local_StartAbility_2000-------------");
await sleep(2000);
done();
});
...
...
@@ -188,28 +188,24 @@ export default function startAbilityTest2() {
delegator.executeShellCommand(cmd2500, (err: any, d: any) => {
console.info("executeShellCommand2500 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var cmd2501 = "bm install -p data/test/MockServiceTimeout.hap";
delegator.executeShellCommand(cmd2501, (err: any, d: any) => {
console.info("executeShellCommand2501 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var cmd2502 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry";
delegator.executeShellCommand(cmd2502, (err: any, d: any) => {
console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var cmd2503 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
delegator.executeShellCommand(cmd2503, (err: any, d: any) => {
console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var cmd2504 = "cp data/test/AtomizationFaEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps" +
"/entry/files";
delegator.executeShellCommand(cmd2504, (err: any, d: any) => {
console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
setTimeout(async () => {
let wrong;
var str = {
'want': {
...
...
@@ -227,6 +223,7 @@ export default function startAbilityTest2() {
});
await sleep(35000);
expect(wrong.code).assertEqual(3);
}, 2000)
console.info("------------end FreeInstall_FA_Local_StartAbility_2500-------------");
done();
});
...
...
ability/ability_runtime/freeinstalltest/startabilityfatest/actsstartabilitynotargetbundlelistfatest/entry/src/main/ets/MainAbility/test/StartAbility.test.ets
浏览文件 @
459a517a
...
...
@@ -80,6 +80,7 @@ export default function StartAbilityTest() {
it("FreeInstall_FA_StartAbility_2600", 0, async function (done) {
console.log("------------start FreeInstall_FA_StartAbility_2600-------------");
TAG = "FreeInstall_FA_StartAbility_2600";
setTimeout(async () => {
let details;
var str = {
'want': {
...
...
@@ -96,8 +97,8 @@ export default function StartAbilityTest() {
}).catch((error) => {
console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error));
})
await Utils.sleep(2000);
expect(details).assertEqual(0);
}, 2000)
done();
});
...
...
@@ -114,7 +115,7 @@ export default function StartAbilityTest() {
delegator.executeShellCommand(cmd6, (err: any, d: any) => {
console.info("executeShellCommand6: err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await Utils.sleep(500);
setTimeout(async () => {
let details;
var str = {
'want': {
...
...
@@ -127,12 +128,12 @@ export default function StartAbilityTest() {
}
await featureAbility.startAbility(str).then((data) => {
details = data;
console.info(TAG + ' StartAbility
successful. Data: ' + JSON.stringify(data))
console.info(TAG + ' StartAbility2700
successful. Data: ' + JSON.stringify(data))
}).catch((error) => {
console.info(TAG + ' StartAbility
failed. error: ' + JSON.stringify(error));
console.info(TAG + ' StartAbility2700
failed. error: ' + JSON.stringify(error));
})
await Utils.sleep(2000);
expect(details).assertEqual(0);
}, 2000)
done();
});
...
...
@@ -156,7 +157,7 @@ export default function StartAbilityTest() {
delegator.executeShellCommand(cmd8, (err: any, d: any) => {
console.info("executeShellCommand8 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await Utils.sleep(500);
setTimeout(async () => {
let details;
var str = {
'want': {
...
...
@@ -172,8 +173,8 @@ export default function StartAbilityTest() {
}).catch((error) => {
console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error));
})
await Utils.sleep(2000);
expect(details).assertEqual(0);
}, 2000)
done();
});
...
...
@@ -187,13 +188,14 @@ export default function StartAbilityTest() {
it("FreeInstall_FA_StartAbility_3900", 0, async function (done) {
console.log("------------start FreeInstall_FA_StartAbility_3900-------------");
TAG = "FreeInstall_FA_StartAbility_3900";
setTimeout(async () => {
let details;
var str = {
'want': {
"bundleName": "com.open.harmony.startAbility",
"abilityName": "com.example.myapplication1.MainAbility1",
"moduleName": "myapplication1",
"flags": wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE|
wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
"flags": wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE |
wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
}
await featureAbility.startAbility(str).then((data) => {
...
...
@@ -202,8 +204,8 @@ export default function StartAbilityTest() {
}).catch((error) => {
console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error));
})
await Utils.sleep(2000);
expect(details).assertEqual(0);
}, 2000);
done();
});
})
...
...
ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult2.test.ets
浏览文件 @
459a517a
...
...
@@ -92,9 +92,9 @@ export default function StartAbilityForResult2() {
}
featureAbility.startAbilityForResult(str1)
.then((data) => {
console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data))
console.info(TAG + ' StartAbilityForResultPromise
2200
successful. Data: ' + JSON.stringify(data))
}).catch((error) => {
console.info(TAG + ' StartAbilityForResultPromise
failed. Cause: ' + JSON.stringify(error));
console.info(TAG + ' StartAbilityForResultPromise2200
failed. Cause: ' + JSON.stringify(error));
})
await Utils.sleep(3000);
let wrong;
...
...
@@ -108,10 +108,10 @@ export default function StartAbilityForResult2() {
}
await featureAbility.startAbilityForResult(str)
.then((data) => {
console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data))
console.info(TAG + ' StartAbilityForResultPromise
2200
successful. Data: ' + JSON.stringify(data))
}).catch((error) => {
wrong = error;
console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error));
console.info(TAG + ' StartAbilityForResultPromise
2200
failed. Cause: ' + JSON.stringify(error));
})
await Utils.sleep(2000);
expect(wrong.code).assertEqual(13);
...
...
@@ -128,7 +128,8 @@ export default function StartAbilityForResult2() {
it("FreeInstall_FA_StartAbilityForResult_2300", 0, async function (done) {
console.log("------------start FreeInstall_FA_StartAbilityForResult_2300-------------");
TAG = "FreeInstall_FA_StartAbilityForResult_2300";
var cmd19 = "bm install -p data/test/AtomizationResultFaEntry.hap";
var cmd19 = "bm install -rp /data/test/AtomizationResultFaEntry.hap";
console.log("------------start FreeInstall_FA_StartAbilityForResult_2300------install-------");
delegator.executeShellCommand(cmd19, (err: any, d: any) => {
console.info("executeShellCommand19: err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
...
...
@@ -142,12 +143,13 @@ export default function StartAbilityForResult2() {
}
featureAbility.startAbilityForResult(str1)
.then((data) => {
console.info(TAG + ' StartAbilityForResultPromise
successful. Data
: ' + JSON.stringify(data))
console.info(TAG + ' StartAbilityForResultPromise
2300 successful. Data1
: ' + JSON.stringify(data))
}).catch((error) => {
console.info(TAG + ' StartAbilityForResultPromise failed. Cause
: ' + JSON.stringify(error));
console.info(TAG + ' StartAbilityForResultPromise2300 failed. Cause1
: ' + JSON.stringify(error));
})
await Utils.sleep(3000);
let wrong;
await Utils.sleep(1000);
setTimeout(async () => {
var wrong;
var str = {
'want': {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -158,13 +160,13 @@ export default function StartAbilityForResult2() {
}
await featureAbility.startAbilityForResult(str)
.then((data) => {
console.info(TAG + ' StartAbilityForResultPromise successful.
Data: ' + JSON.stringify(data))
console.info(TAG + ' StartAbilityForResultPromise2300 successful. 1
Data: ' + JSON.stringify(data))
}).catch((error) => {
wrong = error;
console.info(TAG + ' StartAbilityForResultPromise failed.
Cause: ' + JSON.stringify(error));
console.info(TAG + ' StartAbilityForResultPromise2300 failed. 1
Cause: ' + JSON.stringify(error));
})
await Utils.sleep(2000);
expect(wrong.code).assertEqual(13);
}, 2000)
done();
});
...
...
@@ -181,29 +183,26 @@ export default function StartAbilityForResult2() {
delegator.executeShellCommand(cmd20, (err: any, d: any) => {
console.info("executeShellCommand20: err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await Utils.sleep(500);
var cmd21 = "bm install -p data/test/MockServiceTimeout.hap";
delegator.executeShellCommand(cmd21, (err: any, d: any) => {
console.info("executeShellCommand21: err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await Utils.sleep(500);
var cmd1 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry";
delegator.executeShellCommand(cmd1, (err: any, d: any) => {
console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
console.info("executeShellCommand1
1
: err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await Utils.sleep(500);
var cmd2 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
delegator.executeShellCommand(cmd2, (err: any, d: any) => {
console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
console.info("executeShellCommand2
1
: err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await Utils.sleep(500);
var cmd3 = "cp data/test/AtomizationResultFaEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" +
"entry/files";
delegator.executeShellCommand(cmd3, (err: any, d: any) => {
console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
console.info("executeShellCommand3
1
: err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await Utils.sleep(500);
let wrong;
setTimeout(async () => {
var wrong;
var str = {
'want': {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -212,16 +211,17 @@ export default function StartAbilityForResult2() {
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
}
featureAbility.startAbilityForResult(str)
await
featureAbility.startAbilityForResult(str)
.then((data) => {
console.info(TAG + ' StartAbilityForResultPromise
successful. Data: ' + JSON.stringify(data))
console.info(TAG + ' StartAbilityForResultPromise2600
successful. Data: ' + JSON.stringify(data))
}).catch((error) => {
wrong = error;
console.info(TAG + ' StartAbilityForResultPromise
failed. Cause: ' + JSON.stringify(error));
console.info(TAG + ' StartAbilityForResultPromise2600
failed. Cause: ' + JSON.stringify(error));
})
await Utils.sleep(35000);
expect(wrong.code).assertEqual(3);
expect(wrong.code).assertEqual(3)
}, 20000)
done();
});
})
}
ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/PageAbility/app.ets
浏览文件 @
459a517a
...
...
@@ -17,13 +17,13 @@ import featureAbility from '@ohos.ability.featureAbility';
export default {
onCreate() {
console.info('Application
onCreate')
setTimeout(function ()
{
featureAbility.terminateSelf()
console.info('Applicationfa
onCreate')
setTimeout(async () =>
{
await
featureAbility.terminateSelf()
.then((data) => {
console.info('PageAbility
terminateself succeeded: ' + data);
console.info('PageAbilityfa
terminateself succeeded: ' + data);
}).catch((error) => {
console.error('PageAbility
terminateself failed. Cause: ' + error);
console.error('PageAbilityfa
terminateself failed. Cause: ' + error);
})
}, 8000);
},
...
...
ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsstartabilityforresultnotargetfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets
浏览文件 @
459a517a
...
...
@@ -88,6 +88,7 @@ export default function StartAbilityForResult() {
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
}
setTimeout(async () => {
await featureAbility.startAbilityForResult(str)
.then((data) => {
details = data;
...
...
@@ -95,9 +96,9 @@ export default function StartAbilityForResult() {
}).catch((error) => {
console.info(TAG + ' StartAbilityForResult failed. error: ' + JSON.stringify(error));
})
await Utils.sleep(1000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
},2000);
done();
});
...
...
@@ -114,7 +115,6 @@ export default function StartAbilityForResult() {
delegator.executeShellCommand(cmd6, (err: any, d: any) => {
console.info("executeShellCommand6: err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await Utils.sleep(500);
let details;
var str = {
'want': {
...
...
@@ -125,6 +125,7 @@ export default function StartAbilityForResult() {
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
}
setTimeout(async ()=>{
await featureAbility.startAbilityForResult(str)
.then((data) => {
details = data;
...
...
@@ -132,9 +133,9 @@ export default function StartAbilityForResult() {
}).catch((error) => {
console.info(TAG + ' StartAbilityForResult failed. error: ' + JSON.stringify(error));
})
await Utils.sleep(1000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
},2000);
done();
});
...
...
@@ -158,7 +159,7 @@ export default function StartAbilityForResult() {
delegator.executeShellCommand(cmd8, (err: any, d: any) => {
console.info("executeShellCommand8: err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await Utils.sleep(500);
setTimeout(async ()=>{
let details;
var str = {
'want': {
...
...
@@ -175,9 +176,9 @@ export default function StartAbilityForResult() {
}).catch((error) => {
console.info(TAG + ' StartAbilityForResult failed. error: ' + JSON.stringify(error));
})
await Utils.sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
},2000);
done();
});
})
...
...
ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest/entry/src/main/ets/test/StartAbilityForResult.ets
浏览文件 @
459a517a
...
...
@@ -34,21 +34,24 @@ export default function StartAbilityForResult(abilityContext) {
beforeAll(async function (done) {
console.info("StartAbilityForResult before all called");
var cmd = "bm install -p data/test/MockService.hap";
console.info("cmd : "
+
cmd)
console.info("cmd : "
+
cmd)
globalThis.delegator.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);
var cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry";
globalThis.delegator.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);
var cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
globalThis.delegator.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);
var cmd3 ="cp data/test/AtomizationResultStageEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
var cmd3 =
"cp data/test/AtomizationResultStageEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
globalThis.delegator.executeShellCommand(cmd3, (err: any, d: any) => {
console.info("executeShellCommand3 : err : " + JSON.stringify(err)," data : " + JSON.stringify(d));
console.info("executeShellCommand3 : err : " + JSON.stringify(err),
" data : " + JSON.stringify(d));
done();
})
});
...
...
@@ -96,6 +99,7 @@ export default function StartAbilityForResult(abilityContext) {
it("FreeInstall_Stage_StartAbilityForResult_0100", 0, async function (done) {
console.log("------------start FreeInstall_Stage_StartAbilityForResult_0100-------------");
TAG = "FreeInstall_Stage_StartAbilityForResult_0100";
setTimeout(async () => {
let details;
var str = {
"deviceId": "",
...
...
@@ -111,9 +115,9 @@ export default function StartAbilityForResult(abilityContext) {
}).catch((error) => {
console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error));
})
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -126,6 +130,7 @@ export default function StartAbilityForResult(abilityContext) {
it("FreeInstall_Stage_StartAbilityForResult_0400", 0, async function (done) {
console.log("------------start FreeInstall_Stage_StartAbilityForResult_0400-------------");
TAG = "FreeInstall_Stage_StartAbilityForResult_0400";
setTimeout(async () => {
let details;
var str = {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -143,9 +148,9 @@ export default function StartAbilityForResult(abilityContext) {
}).catch((error) => {
console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error));
})
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -158,6 +163,7 @@ export default function StartAbilityForResult(abilityContext) {
it("FreeInstall_Stage_StartAbilityForResult_0500", 0, async function (done) {
console.log("------------start FreeInstall_Stage_StartAbilityForResult_0500-------------");
TAG = "FreeInstall_Stage_StartAbilityForResult_0500";
setTimeout(async () => {
let details;
var str = {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -172,9 +178,9 @@ export default function StartAbilityForResult(abilityContext) {
}).catch((error) => {
console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error));
})
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -197,7 +203,7 @@ export default function StartAbilityForResult(abilityContext) {
});
console.log(" checkAbilityInfo deviceId : " + details1.ability.deviceId);
DeviceId = details1.ability.deviceId;
await sleep(500);
setTimeout(async () => {
var str = {
"deviceId": DeviceId,
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -215,6 +221,7 @@ export default function StartAbilityForResult(abilityContext) {
await sleep(2000);
console.log(TAG + " resultCode: " + details2.resultCode);
expect(details2.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -236,7 +243,7 @@ export default function StartAbilityForResult(abilityContext) {
globalThis.delegator.executeShellCommand(cmd8, (err: any, d: any) => {
console.info("executeShellCommand8: err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
setTimeout(async () => {
let details;
var str = {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -254,6 +261,7 @@ export default function StartAbilityForResult(abilityContext) {
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -266,6 +274,7 @@ export default function StartAbilityForResult(abilityContext) {
it("FreeInstall_Stage_StartAbilityForResult_0800", 0, async function (done) {
console.log("------------start FreeInstall_Stage_StartAbilityForResult_0800-------------");
TAG = "FreeInstall_Stage_StartAbilityForResult_0800";
setTimeout(async () => {
let details;
var str = {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -281,9 +290,9 @@ export default function StartAbilityForResult(abilityContext) {
",data: " + JSON.stringify(data));
details = data;
})
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -296,6 +305,7 @@ export default function StartAbilityForResult(abilityContext) {
it("FreeInstall_Stage_StartAbilityForResult_1200", 0, async function (done) {
console.log("------------start FreeInstall_Stage_StartAbilityForResult_1200-------------");
TAG = "FreeInstall_Stage_StartAbilityForResult_1200";
setTimeout(async () => {
let details;
var str = {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -310,9 +320,9 @@ export default function StartAbilityForResult(abilityContext) {
}).catch((error) => {
console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error));
})
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -325,6 +335,7 @@ export default function StartAbilityForResult(abilityContext) {
it("FreeInstall_Stage_StartAbilityForResult_1400", 0, async function (done) {
console.log("------------start FreeInstall_Stage_StartAbilityForResult_1400-------------");
TAG = "FreeInstall_Stage_StartAbilityForResult_1400";
setTimeout(async () => {
let details;
var str = {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -345,6 +356,7 @@ export default function StartAbilityForResult(abilityContext) {
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -357,6 +369,7 @@ export default function StartAbilityForResult(abilityContext) {
it("FreeInstall_Stage_StartAbilityForResult_1600", 0, async function (done) {
console.log("------------start FreeInstall_Stage_StartAbilityForResult_1600-------------");
TAG = "FreeInstall_Stage_StartAbilityForResult_1600";
setTimeout(async () => {
let details;
var str = {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -371,9 +384,9 @@ export default function StartAbilityForResult(abilityContext) {
}).catch((error) => {
console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error));
})
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -386,6 +399,7 @@ export default function StartAbilityForResult(abilityContext) {
it("FreeInstall_Stage_StartAbilityForResult_1800", 0, async function (done) {
console.log("------------start FreeInstall_Stage_StartAbilityForResult_1800-------------");
TAG = "FreeInstall_Stage_StartAbilityForResult_1800";
setTimeout(async () => {
let details;
var str = {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -403,9 +417,9 @@ export default function StartAbilityForResult(abilityContext) {
}).catch((error) => {
console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error));
})
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -422,7 +436,7 @@ export default function StartAbilityForResult(abilityContext) {
globalThis.delegator.executeShellCommand(cmd9, (err: any, d: any) => {
console.info("executeShellCommand9: err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
setTimeout(async () => {
let details;
var str = {
"bundleName": "com.example.qianyiyingyong.hmservice",
...
...
@@ -440,6 +454,7 @@ export default function StartAbilityForResult(abilityContext) {
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -462,7 +477,7 @@ export default function StartAbilityForResult(abilityContext) {
globalThis.delegator.executeShellCommand(cmd11, (err: any, d: any) => {
console.info("executeShellCommand11 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
setTimeout(async () => {
let details;
var str = {
'deviceId': '',
...
...
@@ -470,7 +485,7 @@ export default function StartAbilityForResult(abilityContext) {
"abilityName": "com.example.qianyiyingyong.MainAbility",
"moduleName": "entry",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
'parameters': {"name": "1111", "Ext2": "ExtValue2","site":"很开心看到你!"
}
'parameters': { "name": "1111", "Ext2": "ExtValue2", "site": "很开心看到你!"
}
}
await globalThis.abilityContext.startAbilityForResult(str)
.then((data) => {
...
...
@@ -482,6 +497,7 @@ export default function StartAbilityForResult(abilityContext) {
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
...
...
@@ -504,7 +520,7 @@ export default function StartAbilityForResult(abilityContext) {
globalThis.delegator.executeShellCommand(cmd13, (err: any, d: any) => {
console.info("executeShellCommand13 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
setTimeout(async () => {
let details;
var str = {
"deviceId": "",
...
...
@@ -523,6 +539,7 @@ export default function StartAbilityForResult(abilityContext) {
await sleep(2000);
console.log(TAG + " resultCode: " + details.resultCode);
expect(details.resultCode).assertEqual(1);
}, 2000)
done();
});
})
...
...
鸿蒙社区
@harmonycommunity
mentioned in commit
7c660639
·
9月 27, 2022
mentioned in commit
7c660639
mentioned in commit 7c66063915a6cb3b02472c115fc916231cc69812
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录