Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b5e86514
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看板
提交
b5e86514
编写于
3月 07, 2022
作者:
D
dy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
commit aafwk connect ability and context call xts
Signed-off-by:
N
dy
<
dingyao5@huawei.com
>
上级
6d400237
变更
20
展开全部
隐藏空白更改
内联
并排
Showing
20 changed file
with
1461 addition
and
228 deletion
+1461
-228
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/config.json
...dard/actsabilitymanageretstest/entry/src/main/config.json
+8
-0
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/pages/index.ets
...geretstest/entry/src/main/ets/MainAbility/pages/index.ets
+19
-0
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/DataAbility.test.ets
.../entry/src/main/ets/MainAbility/test/DataAbility.test.ets
+389
-80
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets
...main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets
+224
-2
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/getAbilityInfoJsunit2.test.ets
...main/ets/MainAbility2/test/getAbilityInfoJsunit2.test.ets
+1
-1
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility2/service.ts
...ageretstest/entry/src/main/ets/ServiceAbility2/service.ts
+36
-26
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility3/service.ts
...ageretstest/entry/src/main/ets/ServiceAbility3/service.ts
+34
-23
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility4/service.ts
...ageretstest/entry/src/main/ets/ServiceAbility4/service.ts
+57
-39
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility5/service.ts
...ageretstest/entry/src/main/ets/ServiceAbility5/service.ts
+46
-36
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility6/service.ts
...ageretstest/entry/src/main/ets/ServiceAbility6/service.ts
+19
-21
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility7/service.ts
...ageretstest/entry/src/main/ets/ServiceAbility7/service.ts
+135
-0
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/element/string.json
...etstest/entry/src/main/resources/base/element/string.json
+4
-0
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/config.json
...abilitymanageretstest/myapplication1/src/main/config.json
+57
-0
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/app.ets
...eretstest/myapplication1/src/main/ets/MainAbility/app.ets
+8
-0
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/pages/index.ets
...t/myapplication1/src/main/ets/MainAbility/pages/index.ets
+43
-0
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/List.test.ets
...yapplication1/src/main/ets/MainAbility/test/List.test.ets
+23
-0
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/Utils.ets
...st/myapplication1/src/main/ets/MainAbility/test/Utils.ets
+43
-0
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets
...ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets
+303
-0
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/element/string.json
...yapplication1/src/main/resources/base/element/string.json
+12
-0
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/media/icon.png
...est/myapplication1/src/main/resources/base/media/icon.png
+0
-0
未找到文件。
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/config.json
浏览文件 @
b5e86514
...
@@ -110,6 +110,14 @@
...
@@ -110,6 +110,14 @@
"srcLanguage"
:
"ets"
,
"srcLanguage"
:
"ets"
,
"description"
:
"$string:description_serviceability6"
,
"description"
:
"$string:description_serviceability6"
,
"type"
:
"service"
"type"
:
"service"
},
{
"srcPath"
:
"ServiceAbility7"
,
"name"
:
".ServiceAbility7"
,
"icon"
:
"$media:icon"
,
"srcLanguage"
:
"ets"
,
"description"
:
"$string:description_serviceability7"
,
"type"
:
"service"
}
}
],
],
"js"
:
[
"js"
:
[
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/pages/index.ets
浏览文件 @
b5e86514
...
@@ -67,6 +67,16 @@ async function startService6(){
...
@@ -67,6 +67,16 @@ async function startService6(){
var
data
=
featureAbility
.
startAbility
(
str
);
var
data
=
featureAbility
.
startAbility
(
str
);
console
.
info
(
'particleAbility_connectAbility_test_0500 startAbility succeeded: '
+
JSON
.
stringify
(
data
));
console
.
info
(
'particleAbility_connectAbility_test_0500 startAbility succeeded: '
+
JSON
.
stringify
(
data
));
}
}
async
function
startService7
(){
var
str
=
{
"want"
:
{
"bundleName"
:
"com.ohos.acecollaboration"
,
"abilityName"
:
"com.ohos.acecollaboration.ServiceAbility7"
,
},
};
var
data
=
featureAbility
.
startAbility
(
str
);
console
.
info
(
'particleAbility_connectAbility_test_0600 startAbility succeeded: '
+
JSON
.
stringify
(
data
));
}
@
Entry
@
Entry
@
Component
@
Component
...
@@ -145,6 +155,15 @@ struct MyComponent {
...
@@ -145,6 +155,15 @@ struct MyComponent {
.
onClick
(()
=>
{
.
onClick
(()
=>
{
startService6
();
startService6
();
});
});
Button
(
'connectAPI8'
)
.
fontSize
(
40
)
.
height
(
40
)
.
margin
({
top
:
20
})
.
fontWeight
(
FontWeight
.
Bold
)
.
onClick
(()
=>
{
startService7
();
});
}
}
.
width
(
'100%'
)
.
width
(
'100%'
)
.
height
(
'100%'
)
.
height
(
'100%'
)
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/DataAbility.test.ets
浏览文件 @
b5e86514
此差异已折叠。
点击以展开。
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets
浏览文件 @
b5e86514
...
@@ -53,27 +53,51 @@ export default function getHapModuleInfoJsunit() {
...
@@ -53,27 +53,51 @@ export default function getHapModuleInfoJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_getHapModuleInfo_test_0200', 0, async function (done) {
it('context_getHapModuleInfo_test_0200', 0, async function (done) {
let callback;
try {
try {
console.info('[context_getHapModuleInfo_test_0200] START');
console.info('[context_getHapModuleInfo_test_0200] START');
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
var context = ability_featureAbility.getContext();
var context = ability_featureAbility.getContext();
context.getHapModuleInfo((error, data) => {
context.getHapModuleInfo((error, data) => {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('context_getHapModuleInfo_test_0200', timeOldStamp, timeNewStamp);
Utils.getDurationTime('context_getHapModuleInfo_test_0200', timeOldStamp, timeNewStamp);
console.info('[context_getHapModuleInfo_test_0200] data is:' + JSON.stringify(data));
console.info('[context_getHapModuleInfo_test_0200] data is:' + JSON.stringify(data));
callback = data;
expect(typeof (data)).assertEqual("object");
expect(typeof (data)).assertEqual("object");
});
});
} catch (error) {
} catch (error) {
console.error('[context_getHapModuleInfo_test_0200] failed: ' + JSON.stringify(error));
console.error('[context_getHapModuleInfo_test_0200] failed: ' + JSON.stringify(error));
}
}
var callback = await context.getHapModuleInfo(
);
await Utils.sleep(1000
);
console.info('---[context_getHapModuleInfo_test_0200] check---');
console.info('---[context_getHapModuleInfo_test_0200] check---');
checkHapModuleInfo('context_getHapModuleInfo_test_0200', callback);
checkHapModuleInfo('context_getHapModuleInfo_test_0200', callback);
console.info('[context_getHapModuleInfo_test_0200] FINISH');
console.info('[context_getHapModuleInfo_test_0200] FINISH');
done();
done();
});
});
/**
* @tc.number: context_getHapModuleInfo_test_0300_1
* @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it('context_getHapModuleInfo_test_0300_1', 0, async function (done) {
console.info('[context_getHapModuleInfo_test_0300_1] START');
var str = {
"want": {
"bundleName": "com.ohos.acecollaboration",
"abilityName": "com.example.myapplication1.MainAbility",
},
};
ability_featureAbility.startAbility(str)
.then((data) => {
console.info('[context_getHapModuleInfo_test_0300_1] start myapplication1 successful: ' + JSON.stringify(data))
}).catch((error) => {
console.error('[context_getHapModuleInfo_test_0300_1] start myapplication1 Cause: ' + JSON.stringify(error));
})
done();
});
function checkHapModuleInfo(msg, data) {
function checkHapModuleInfo(msg, data) {
console.log(msg + "checkHapModuleInfo start " + JSON.stringify(data));
console.log(msg + "checkHapModuleInfo start " + JSON.stringify(data));
console.log(msg + "checkHapModuleInfo name : " + data.name);
console.log(msg + "checkHapModuleInfo name : " + data.name);
...
@@ -123,10 +147,208 @@ export default function getHapModuleInfoJsunit() {
...
@@ -123,10 +147,208 @@ export default function getHapModuleInfoJsunit() {
expect(data.backgroundImg).assertEqual("");
expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0);
expect(data.supportedModes).assertEqual(0);
expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.deviceTypes[0]).assertEqual("phone");
for (var i = 0; i < data.abilityInfos.length; i++) {
console.log(msg + "-------AbilityInfo data.abilityInfos[" + i + "] : START ------" );
checkAbilityInfo(msg,data.abilityInfos[i]);
}
expect(data.moduleName).assertEqual("entry")
expect(data.moduleName).assertEqual("entry")
expect(data.mainAbilityName).assertEqual("");
expect(data.mainAbilityName).assertEqual("");
expect(data.installationFree).assertEqual(false);
expect(data.installationFree).assertEqual(false);
console.log(msg + "---checkHapModuleInfo End---");
console.log(msg + "---checkHapModuleInfo End---");
}
}
function checkAbilityInfo(msg,data) {
console.log(msg+ "checkAbilityInfo start " + JSON.stringify(data));
console.log(msg+ "checkAbilityInfo bundleName : " + data.bundleName);
console.log(msg+ "checkAbilityInfo name : " + data.name);
console.log(msg+ "checkAbilityInfo label : " + data.label);
console.log(msg+ "checkAbilityInfo description : " + data.description);
console.log(msg+ "checkAbilityInfo icon : " + data.icon);
console.log(msg+ "checkAbilityInfo descriptionId : " + data.descriptionId);
console.log(msg+ "checkAbilityInfo iconId : " + data.iconId);
console.log(msg+ "checkAbilityInfo moduleName : " + data.moduleName);
console.log(msg+ "checkAbilityInfo process : " + data.process);
console.log(msg+ "checkAbilityInfo targetAbility : " + data.targetAbility);
console.log(msg+ "checkAbilityInfo backgroundModes : " + data.backgroundModes);
console.log(msg+ "checkAbilityInfo isVisible : " + data.isVisible);
console.log(msg+ "checkAbilityInfo formEnabled : " + data.formEnabled);
console.log(msg+ "checkAbilityInfo type : " + data.type)
console.log(msg+ "checkAbilityInfo orientation : " + data.orientation);
console.log(msg+ "checkAbilityInfo launchMode : " + data.launchMode);
console.log(msg+ "checkAbilityInfo permissions length : " + data.permissions.length);
for (var j = 0; j < data.permissions.length; j++) {
console.log(msg+ "getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]);
}
console.log(msg+ "checkAbilityInfo deviceTypes length : " + data.deviceTypes.length);
for (var k = 0; k < data.deviceTypes.length; k++) {
console.log(msg+ "getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
}
console.log(msg+ "checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length);
for (var i = 0; i < data.deviceCapabilities.length; i++) {
console.log(msg+ "getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]);
}
console.log(msg+ "checkAbilityInfo readPermission : " + data.readPermission);
console.log(msg+ "checkAbilityInfo writePermission : " + data.writePermission);
console.log(msg+ "checkAbilityInfo formEntity : " + data.formEntity);
console.log(msg+ "checkAbilityInfo minFormHeight : " + data.minFormHeight);
console.log(msg+ "checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight);
console.log(msg+ "checkAbilityInfo minFormWidth : " + data.minFormWidth);
console.log(msg+ "checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth);
console.log(msg+ "checkAbilityInfo uri : " + data.uri);
console.log(msg+ "checkAbilityInfo labelId : " + data.labelId);
console.log(msg+ "checkAbilityInfo subType : " + data.subType);
expect(typeof (data)).assertEqual("object");
expect(typeof (data.bundleName)).assertEqual("string");
expect(typeof (data.name)).assertEqual("string");
expect(typeof (data.label)).assertEqual("string");
expect(typeof (data.description)).assertEqual("string");
expect(typeof (data.icon)).assertEqual("string");
expect(typeof (data.labelId)).assertEqual("number");
expect(typeof (data.descriptionId)).assertEqual("number");
expect(typeof (data.iconId)).assertEqual("number");
expect(typeof (data.moduleName)).assertEqual("string");
expect(typeof (data.process)).assertEqual("string");
expect(typeof (data.targetAbility)).assertEqual("string");
expect(typeof (data.backgroundModes)).assertEqual("number");
expect(typeof (data.isVisible)).assertEqual("boolean");
expect(typeof (data.formEnabled)).assertEqual("boolean");
expect(typeof (data.type)).assertEqual("number");
expect(typeof (data.subType)).assertEqual("number");
expect(typeof (data.orientation)).assertEqual("number");
expect(typeof (data.launchMode)).assertEqual("number");
expect(Array.isArray(data.permissions)).assertEqual(true);
expect(Array.isArray(data.deviceTypes)).assertEqual(true);
expect(Array.isArray(data.deviceCapabilities)).assertEqual(true);
expect(typeof (data.readPermission)).assertEqual("string");
expect(typeof (data.writePermission)).assertEqual("string");
expect(typeof (data.applicationInfo)).assertEqual("object");
expect(typeof (data.formEntity)).assertEqual("number");
expect(typeof (data.minFormHeight)).assertEqual("number");
expect(typeof (data.defaultFormHeight)).assertEqual("number");
expect(typeof (data.minFormWidth)).assertEqual("number");
expect(typeof (data.defaultFormWidth)).assertEqual("number");
expect(typeof (data.uri)).assertEqual("string");
expect(data.bundleName).assertEqual("com.ohos.acecollaboration");
expect(data.name).assertEqual("com.ohos.acecollaboration.MainAbility");
expect(data.label).assertEqual("$string:entry_MainAbility");
expect(data.description).assertEqual("$string:mainability_description");
expect(data.icon).assertEqual("$media:icon");
expect(data.descriptionId).assertEqual(16777220);
expect(data.iconId).assertEqual(16777221);
expect(data.moduleName).assertEqual("entry");
expect(data.process).assertEqual("");
expect(data.targetAbility).assertEqual("");
expect(data.backgroundModes).assertEqual(0);
expect(data.isVisible).assertEqual(true);
expect(data.formEnabled).assertEqual(false);
expect(data.type).assertEqual(1);
expect(data.orientation).assertEqual(0);
expect(data.launchMode).assertEqual(1);
expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.readPermission).assertEqual("");
expect(data.writePermission).assertEqual("");
checkApplicationInfo(msg,data.applicationInfo);
expect(data.formEntity).assertEqual(0);
expect(data.minFormHeight).assertEqual(0);
expect(data.defaultFormHeight).assertEqual(0);
expect(data.minFormWidth).assertEqual(0);
expect(data.defaultFormWidth).assertEqual(0);
expect(data.uri).assertEqual("");
expect(data.labelId).assertEqual(16777218);
expect(data.subType).assertEqual(0);
console.log(msg+ "---checkAbilityInfo End--- ");
}
function checkApplicationInfo(msg,info) {
console.log(msg+ "checkApplicationInfo start : " + JSON.stringify(info));
console.log(msg+ "checkApplicationInfo name : " + info.name);
console.log(msg+ "checkApplicationInfo description : " + info.description);
console.log(msg+ "checkApplicationInfo descriptionId : " + info.descriptionId);
console.log(msg+ "checkApplicationInfo systemApp : " + info.systemApp);
console.log(msg+ "checkApplicationInfo enabled : " + info.enabled);
console.log(msg+ "checkApplicationInfo label : " + info.label);
console.log(msg+ "checkApplicationInfo labelId : " + info.labelId);
console.log(msg+ "checkApplicationInfo icon : " + info.icon);
console.log(msg+ "checkApplicationInfo iconId : " + info.iconId);
console.log(msg+ "checkApplicationInfo process : " + info.process);
console.log(msg+ "checkApplicationInfo supportedModes : " + info.supportedModes);
console.log(msg+ "checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
for (var j = 0; j < info.moduleSourceDirs.length; j++) {
console.log(msg+ "checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
}
console.log(msg+ "checkApplicationInfo permissions length : " + info.permissions.length);
for (var k = 0; k < info.permissions.length; k++) {
console.log(msg+ "checkApplicationInfo info.permissions[" + k + "] : " + info.permissions[k]);
}
console.log(msg+ "checkApplicationInfo moduleInfos length : " + info.moduleInfos.length);
for (var i = 0; i < info.moduleInfos.length; i++) {
console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleName : " +
info.moduleInfos[i].moduleName);
console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleSourceDir : " +
info.moduleInfos[i].moduleSourceDir);
}
console.log(msg+ "checkApplicationInfo entryDir : " + info.entryDir);
expect(typeof (info)).assertEqual("object");
expect(typeof (info.name)).assertEqual("string");
expect(typeof (info.description)).assertEqual("string");
expect(typeof (info.descriptionId)).assertEqual("number");
expect(typeof (info.systemApp)).assertEqual("boolean");
expect(typeof (info.enabled)).assertEqual("boolean");
expect(typeof (info.label)).assertEqual("string");
expect(typeof (info.labelId)).assertEqual("string");
expect(typeof (info.icon)).assertEqual("string");
expect(typeof (info.iconId)).assertEqual("string");
expect(typeof (info.process)).assertEqual("string");
expect(typeof (info.supportedModes)).assertEqual("number");
expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
expect(Array.isArray(info.permissions)).assertEqual(true);
expect(Array.isArray(info.moduleInfos)).assertEqual(true);
expect(typeof (info.entryDir)).assertEqual("string");
if (info.moduleSourceDirs.length == 1){
expect(info.moduleInfos[0].moduleName).assertEqual("entry");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}else if(info.moduleSourceDirs.length == 2) {
if (info.moduleInfos[0].moduleName == "myapplication1") {
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication1");
expect(info.moduleInfos[1].moduleName).assertEqual("entry");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}else{
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication2");
expect(info.moduleInfos[1].moduleName).assertEqual("entry");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}
}else {
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication1");
expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication2");
expect(info.moduleInfos[2].moduleName).assertEqual("entry");
expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}
expect(info.name).assertEqual("com.ohos.acecollaboration");
expect(info.description).assertEqual("$string:mainability_description");
expect(info.descriptionId).assertEqual(16777220);
expect(info.systemApp).assertEqual(true);
expect(info.enabled).assertEqual(true);
expect(info.label).assertEqual("$string:entry_MainAbility");
expect(info.labelId).assertEqual("16777218");
expect(info.icon).assertEqual("$media:icon");
expect(info.iconId).assertEqual("16777221");
expect(info.process).assertEqual("");
expect(info.supportedModes).assertEqual(0);
expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
console.log(msg+ "---checkApplicationInfo End--- ");
}
})
})
}
}
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/getAbilityInfoJsunit2.test.ets
浏览文件 @
b5e86514
...
@@ -16,7 +16,7 @@ import {describe, it, expect} from "deccjsunit/index.ets";
...
@@ -16,7 +16,7 @@ import {describe, it, expect} from "deccjsunit/index.ets";
import Utils from './Utils';
import Utils from './Utils';
import ability_featureAbility from '@ohos.ability.featureAbility';
import ability_featureAbility from '@ohos.ability.featureAbility';
export default function get
HapModule
InfoJsunit() {
export default function get
Ability
InfoJsunit() {
describe('appInfoTest', function () {
describe('appInfoTest', function () {
/**
/**
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility2/service.ts
浏览文件 @
b5e86514
...
@@ -33,6 +33,18 @@ class StubTest2 extends rpc.RemoteObject {
...
@@ -33,6 +33,18 @@ class StubTest2 extends rpc.RemoteObject {
}
}
}
}
function
getNowTime
()
{
return
new
Date
().
getTime
();
}
function
getDurationTime
(
msg
,
startTime
,
endTime
)
{
console
.
info
(
msg
+
'
Get Interface startTime:
'
+
startTime
);
console
.
info
(
msg
+
'
Get Interface endTime:
'
+
endTime
);
var
duration
=
(
endTime
-
startTime
)
console
.
info
(
msg
+
'
Get Interface Duration:
'
+
duration
);
return
duration
;
}
async
function
sleep
(
time
:
any
)
{
async
function
sleep
(
time
:
any
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
time
;
var
exitTime
=
now
.
getTime
()
+
time
;
...
@@ -58,7 +70,7 @@ export default {
...
@@ -58,7 +70,7 @@ export default {
"
abilityName
"
:
"
com.ohos.acecollaboration.ServiceAbility
"
,
"
abilityName
"
:
"
com.ohos.acecollaboration.ServiceAbility
"
,
}
}
let
options
=
{
let
options
=
{
onConnect
:
function
(
element
:
any
,
proxy
:
any
)
{
onConnect
:
async
function
(
element
:
any
,
proxy
:
any
)
{
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.deviceId :
'
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.deviceId :
'
+
JSON
.
stringify
(
element
.
deviceId
));
+
JSON
.
stringify
(
element
.
deviceId
));
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.bundleName :
'
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.bundleName :
'
...
@@ -72,7 +84,7 @@ export default {
...
@@ -72,7 +84,7 @@ export default {
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onConnect proxy :
'
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onConnect proxy :
'
+
JSON
.
stringify
(
proxy
));
+
JSON
.
stringify
(
proxy
));
},
},
onDisconnect
:
function
(
element1
:
any
)
{
onDisconnect
:
async
function
(
element1
:
any
)
{
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.deviceId :
'
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.deviceId :
'
+
JSON
.
stringify
(
element1
.
deviceId
));
+
JSON
.
stringify
(
element1
.
deviceId
));
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.bundleName :
'
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.bundleName :
'
...
@@ -84,36 +96,34 @@ export default {
...
@@ -84,36 +96,34 @@ export default {
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.shortName :
'
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.shortName :
'
+
JSON
.
stringify
(
element1
.
shortName
));
+
JSON
.
stringify
(
element1
.
shortName
));
},
},
onFailed
:
function
(
code
:
any
)
{
onFailed
:
async
function
(
code
:
any
)
{
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onFailed errCode :
'
+
code
);
console
.
log
(
'
particleAbility_connectAbility_test_0100 ConnectAbility onFailed errCode :
'
+
code
);
},
},
}
}
let
connection_succeeded
:
any
;
let
connection_succeeded
:
any
;
async
function
connectAbility_service
()
{
console
.
info
(
'
particleAbility_connectAbility_test_0100 start
'
);
console
.
info
(
'
particleAbility_connectAbility_test_0100 start
'
);
var
timeOldStamp
=
getNowTime
();
var
connection
=
particleAbility
.
connectAbility
(
request
,
options
);
var
connection
=
particleAbility
.
connectAbility
(
request
,
options
);
connection_succeeded
=
connection
;
var
timeNewStamp
=
getNowTime
();
console
.
info
(
'
particleAbility_connectAbility_test_0100 service request is:
'
+
JSON
.
stringify
(
request
));
getDurationTime
(
'
particleAbility_connectAbility_test_0100 connectability
'
,
timeOldStamp
,
timeNewStamp
);
console
.
info
(
'
particleAbility_connectAbility_test_0100 options is:
'
+
JSON
.
stringify
(
options
));
connection_succeeded
=
connection
;
console
.
info
(
'
particleAbility_connectAbility_test_0100 data is:
'
+
JSON
.
stringify
(
connection
));
console
.
info
(
'
particleAbility_connectAbility_test_0100 service request is:
'
+
JSON
.
stringify
(
request
));
console
.
info
(
'
particleAbility_connectAbility_test_0100 connection=:
'
+
connection
);
console
.
info
(
'
particleAbility_connectAbility_test_0100 options is:
'
+
JSON
.
stringify
(
options
));
}
console
.
info
(
'
particleAbility_connectAbility_test_0100 data is:
'
+
JSON
.
stringify
(
connection
));
async
function
disconnectAbility_promise
()
{
console
.
info
(
'
particleAbility_connectAbility_test_0100 connection=:
'
+
connection
);
console
.
info
(
'
particleAbility_connectAbility_test_0100 disconnectability start
'
);
await
particleAbility
.
disconnectAbility
(
connection_succeeded
).
then
((
data
:
any
)
=>
{
console
.
info
(
'
particleAbility_connectAbility_test_0100 disconnectability succeeded:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
:
any
)
=>
{
console
.
error
(
'
particleAbility_connectAbility_test_0100 disconnectability failed. Cause:
'
+
JSON
.
stringify
(
error
));
})
}
connectAbility_service
();
console
.
info
(
'
particleAbility_connectAbility_test_0100 sleep start
'
);
sleep
(
5000
);
sleep
(
5000
);
console
.
info
(
'
particleAbility_connectAbility_test_0100 sleep flish
'
);
console
.
info
(
'
particleAbility_connectAbility_test_0100 disconnectability start
'
);
disconnectAbility_promise
();
var
timeOldStamp
=
getNowTime
();
particleAbility
.
disconnectAbility
(
connection_succeeded
).
then
((
data
:
any
)
=>
{
var
timeNewStamp
=
getNowTime
();
getDurationTime
(
'
particleAbility_connectAbility_test_0100 disconnectability
'
,
timeOldStamp
,
timeNewStamp
);
console
.
info
(
'
particleAbility_connectAbility_test_0100 disconnectability succeeded:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
:
any
)
=>
{
console
.
error
(
'
particleAbility_connectAbility_test_0100 disconnectability failed. Cause:
'
+
JSON
.
stringify
(
error
));
})
},
},
onConnect
(
want
)
{
onConnect
(
want
)
{
console
.
info
(
'
ServiceAbility2 onConnect
'
);
console
.
info
(
'
ServiceAbility2 onConnect
'
);
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility3/service.ts
浏览文件 @
b5e86514
...
@@ -33,6 +33,18 @@ class StubTest3 extends rpc.RemoteObject {
...
@@ -33,6 +33,18 @@ class StubTest3 extends rpc.RemoteObject {
}
}
}
}
function
getNowTime
()
{
return
new
Date
().
getTime
();
}
function
getDurationTime
(
msg
,
startTime
,
endTime
)
{
console
.
info
(
msg
+
'
Get Interface startTime:
'
+
startTime
);
console
.
info
(
msg
+
'
Get Interface endTime:
'
+
endTime
);
var
duration
=
(
endTime
-
startTime
)
console
.
info
(
msg
+
'
Get Interface Duration:
'
+
duration
);
return
duration
;
}
async
function
sleep
(
time
:
any
)
{
async
function
sleep
(
time
:
any
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
time
;
var
exitTime
=
now
.
getTime
()
+
time
;
...
@@ -72,7 +84,7 @@ export default {
...
@@ -72,7 +84,7 @@ export default {
console
.
log
(
'
particleAbility_connectAbility_test_0200 ConnectAbility onConnect proxy :
'
console
.
log
(
'
particleAbility_connectAbility_test_0200 ConnectAbility onConnect proxy :
'
+
JSON
.
stringify
(
proxy
));
+
JSON
.
stringify
(
proxy
));
},
},
onDisconnect
:
function
(
element1
:
any
)
{
onDisconnect
:
async
function
(
element1
:
any
)
{
console
.
log
(
'
particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.deviceId :
'
console
.
log
(
'
particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.deviceId :
'
+
JSON
.
stringify
(
element1
.
deviceId
));
+
JSON
.
stringify
(
element1
.
deviceId
));
console
.
log
(
'
particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.bundleName :
'
console
.
log
(
'
particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.bundleName :
'
...
@@ -90,30 +102,29 @@ export default {
...
@@ -90,30 +102,29 @@ export default {
}
}
let
connection_succeeded
:
any
;
let
connection_succeeded
:
any
;
async
function
connectAbility_service
()
{
console
.
info
(
'
particleAbility_connectAbility_test_0200 start
'
);
console
.
info
(
'
particleAbility_connectAbility_test_0200 start
'
);
var
timeOldStamp
=
getNowTime
();
var
connection
=
particleAbility
.
connectAbility
(
request
,
options
);
var
connection
=
particleAbility
.
connectAbility
(
request
,
options
);
connection_succeeded
=
connection
;
var
timeNewStamp
=
getNowTime
();
console
.
info
(
'
particleAbility_connectAbility_test_0200 service request is:
'
+
JSON
.
stringify
(
request
));
getDurationTime
(
'
particleAbility_connectAbility_test_0200 connectability
'
,
timeOldStamp
,
timeNewStamp
);
console
.
info
(
'
particleAbility_connectAbility_test_0200 options is:
'
+
JSON
.
stringify
(
options
));
connection_succeeded
=
connection
;
console
.
info
(
'
particleAbility_connectAbility_test_0200 data is:
'
+
JSON
.
stringify
(
connection
));
console
.
info
(
'
particleAbility_connectAbility_test_0200 service request is:
'
+
JSON
.
stringify
(
request
));
console
.
info
(
'
particleAbility_connectAbility_test_0200 connection=:
'
+
connection
);
console
.
info
(
'
particleAbility_connectAbility_test_0200 options is:
'
+
JSON
.
stringify
(
options
));
}
console
.
info
(
'
particleAbility_connectAbility_test_0200 connection=:
'
+
connection
);
sleep
(
5000
);
async
function
disconnectAbility_callback
()
{
console
.
info
(
'
particleAbility_connectAbility_test_0200 disconnectability start
'
);
console
.
info
(
'
particleAbility_connectAbility_test_0200 disconnectability start
'
);
try
{
particleAbility
.
disconnectAbility
(
connection_succeeded
).
then
((
data
:
any
)
=>
{
var
timeOldStamp
=
getNowTime
();
console
.
info
(
'
particleAbility_connectAbility_test_0200 disconnectability succeeded:
'
+
particleAbility
.
disconnectAbility
(
connection_succeeded
,
(
error
,
data
)
=>
{
JSON
.
stringify
(
data
));
var
timeNewStamp
=
getNowTime
();
}).
catch
((
error
:
any
)
=>
{
getDurationTime
(
'
particleAbility_connectAbility_test_0200 disconnectability
'
,
timeOldStamp
,
timeNewStamp
);
console
.
error
(
'
particleAbility_connectAbility_test_0200 disconnectability failed. Cause:
'
+
console
.
info
(
'
particleAbility_connectAbility_test_0200 disconnectability succeeded:
'
+
JSON
.
stringify
(
data
));
JSON
.
stringify
(
error
));
})
})
}
}
c
onnectAbility_service
();
c
atch
(
error
:
any
){
sleep
(
5000
);
console
.
error
(
'
particleAbility_connectAbility_test_0200 disconnectability failed. Cause:
'
+
disconnectAbility_callback
(
);
JSON
.
stringify
(
error
)
);
sleep
(
5000
);
}
},
},
onConnect
(
want
)
{
onConnect
(
want
)
{
console
.
info
(
'
ServiceAbility3 onConnect
'
);
console
.
info
(
'
ServiceAbility3 onConnect
'
);
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility4/service.ts
浏览文件 @
b5e86514
...
@@ -33,6 +33,18 @@ class StubTest4 extends rpc.RemoteObject {
...
@@ -33,6 +33,18 @@ class StubTest4 extends rpc.RemoteObject {
}
}
}
}
function
getNowTime
()
{
return
new
Date
().
getTime
();
}
function
getDurationTime
(
msg
,
startTime
,
endTime
)
{
console
.
info
(
msg
+
'
Get Interface startTime:
'
+
startTime
);
console
.
info
(
msg
+
'
Get Interface endTime:
'
+
endTime
);
var
duration
=
(
endTime
-
startTime
)
console
.
info
(
msg
+
'
Get Interface Duration:
'
+
duration
);
return
duration
;
}
async
function
sleep
(
time
:
any
)
{
async
function
sleep
(
time
:
any
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
time
;
var
exitTime
=
now
.
getTime
()
+
time
;
...
@@ -59,53 +71,59 @@ export default {
...
@@ -59,53 +71,59 @@ export default {
}
}
let
options
=
{
let
options
=
{
onConnect
:
async
function
(
element
:
any
,
proxy
:
any
)
{
onConnect
:
async
function
(
element
:
any
,
proxy
:
any
)
{
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility service onConnect element.deviceId :
'
+
JSON
.
stringify
(
element
.
deviceId
))
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.deviceId :
'
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.bundleName :
'
+
JSON
.
stringify
(
element
.
bundleName
))
+
JSON
.
stringify
(
element
.
deviceId
))
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.abilityName :
'
+
JSON
.
stringify
(
element
.
abilityName
))
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.bundleName :
'
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.uri :
'
+
JSON
.
stringify
(
element
.
uri
))
+
JSON
.
stringify
(
element
.
bundleName
))
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.shortName :
'
+
JSON
.
stringify
(
element
.
shortName
))
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.abilityName :
'
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onConnect proxy :
'
+
JSON
.
stringify
(
proxy
));
+
JSON
.
stringify
(
element
.
abilityName
))
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.uri :
'
+
JSON
.
stringify
(
element
.
uri
))
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.shortName :
'
+
JSON
.
stringify
(
element
.
shortName
))
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onConnect proxy :
'
+
JSON
.
stringify
(
proxy
));
},
},
onDisconnect
:
function
(
element1
:
any
)
{
onDisconnect
:
async
function
(
element1
:
any
)
{
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.deviceId :
'
+
JSON
.
stringify
(
element1
.
deviceId
));
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.deviceId :
'
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.bundleName :
'
+
JSON
.
stringify
(
element1
.
bundleName
));
+
JSON
.
stringify
(
element1
.
deviceId
));
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.abilityName :
'
+
JSON
.
stringify
(
element1
.
abilityName
));
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.bundleName:
'
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.uri :
'
+
JSON
.
stringify
(
element1
.
uri
));
+
JSON
.
stringify
(
element1
.
bundleName
));
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.shortName :
'
+
JSON
.
stringify
(
element1
.
shortName
));
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.abilityName:
'
+
JSON
.
stringify
(
element1
.
abilityName
));
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.uri:
'
+
JSON
.
stringify
(
element1
.
uri
));
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.shortName :
'
+
JSON
.
stringify
(
element1
.
shortName
));
},
},
onFailed
:
function
(
code
:
any
)
{
onFailed
:
function
(
code
:
any
)
{
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility
service onFailed errCode :
'
+
code
)
console
.
log
(
'
particleAbility_connectAbility_test_0300 ConnectAbility
onFailed errCode :
'
+
code
);
},
},
}
}
let
connection_succeeded
:
any
;
let
connection_succeeded
:
any
;
async
function
connectAbility_service
()
{
console
.
info
(
'
particleAbility_connectAbility_test_0300 start
'
);
console
.
info
(
'
particleAbility_connectAbility_test_0300 start
'
);
var
timeOldStamp
=
getNowTime
();
var
connection
=
particleAbility
.
connectAbility
(
request
,
options
);
var
connection
=
particleAbility
.
connectAbility
(
request
,
options
);
connection_succeeded
=
connection
;
var
timeNewStamp
=
getNowTime
();
console
.
info
(
'
particleAbility_connectAbility_test_0300 service request is:
'
+
JSON
.
stringify
(
request
));
getDurationTime
(
'
particleAbility_connectAbility_test_0300 connectability
'
,
timeOldStamp
,
timeNewStamp
);
console
.
info
(
'
particleAbility_connectAbility_test_0300 options is:
'
+
JSON
.
stringify
(
options
));
connection_succeeded
=
connection
;
console
.
info
(
'
particleAbility_connectAbility_test_0300 data is:
'
+
JSON
.
stringify
(
connection
));
console
.
info
(
'
particleAbility_connectAbility_test_0300 service request is:
'
+
JSON
.
stringify
(
request
));
console
.
info
(
'
particleAbility_connectAbility_test_0300 connection=:
'
+
connection
);
console
.
info
(
'
particleAbility_connectAbility_test_0300 options is:
'
+
JSON
.
stringify
(
options
));
}
console
.
info
(
'
particleAbility_connectAbility_test_0300 data is:
'
+
JSON
.
stringify
(
connection
));
console
.
info
(
'
particleAbility_connectAbility_test_0300 connection=:
'
+
connection
);
async
function
disconnectAbility_promise
()
{
try
{
console
.
info
(
'
particleAbility_connectAbility_test_0300 disconnectability start
'
);
await
particleAbility
.
disconnectAbility
(
connection_succeeded
).
then
((
data
:
any
)
=>
{
console
.
info
(
'
particleAbility_connectAbility_test_0300 disconnectability succeeded:
'
+
JSON
.
stringify
(
data
));
})
}
catch
(
error
:
any
)
{
console
.
error
(
'
particleAbility_connectAbility_test_0300 disconnectability failed. Cause:
'
+
JSON
.
stringify
(
error
));
}
}
connectAbility_service
();
sleep
(
5000
);
disconnectAbility_promise
();
sleep
(
5000
);
sleep
(
5000
);
console
.
info
(
'
particleAbility_connectAbility_test_0300 disconnectability start
'
);
var
timeOldStamp
=
getNowTime
();
particleAbility
.
disconnectAbility
(
connection_succeeded
).
then
((
data
:
any
)
=>
{
var
timeNewStamp
=
getNowTime
();
getDurationTime
(
'
particleAbility_connectAbility_test_0300 disconnectability
'
,
timeOldStamp
,
timeNewStamp
);
console
.
info
(
'
particleAbility_connectAbility_test_0300 disconnectability succeeded:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
:
any
)
=>
{
console
.
error
(
'
particleAbility_connectAbility_test_0300 disconnectability failed. Cause:
'
+
JSON
.
stringify
(
error
));
})
},
},
onConnect
(
want
)
{
onConnect
(
want
)
{
console
.
info
(
'
ServiceAbility4 onConnect
'
);
console
.
info
(
'
ServiceAbility4 onConnect
'
);
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility5/service.ts
浏览文件 @
b5e86514
...
@@ -33,6 +33,18 @@ class StubTest5 extends rpc.RemoteObject {
...
@@ -33,6 +33,18 @@ class StubTest5 extends rpc.RemoteObject {
}
}
}
}
function
getNowTime
()
{
return
new
Date
().
getTime
();
}
function
getDurationTime
(
msg
,
startTime
,
endTime
)
{
console
.
info
(
msg
+
'
Get Interface startTime:
'
+
startTime
);
console
.
info
(
msg
+
'
Get Interface endTime:
'
+
endTime
);
var
duration
=
(
endTime
-
startTime
)
console
.
info
(
msg
+
'
Get Interface Duration:
'
+
duration
);
return
duration
;
}
async
function
sleep
(
time
:
any
)
{
async
function
sleep
(
time
:
any
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
time
;
var
exitTime
=
now
.
getTime
()
+
time
;
...
@@ -85,50 +97,48 @@ export default {
...
@@ -85,50 +97,48 @@ export default {
+
JSON
.
stringify
(
element1
.
shortName
));
+
JSON
.
stringify
(
element1
.
shortName
));
},
},
onFailed
:
function
(
code
:
any
)
{
onFailed
:
function
(
code
:
any
)
{
console
.
log
(
'
particleAbility_connectAbility_test_0400 ConnectAbility
service onFailed errCode:
'
+
code
)
console
.
log
(
'
particleAbility_connectAbility_test_0400 ConnectAbility
onFailed errCode:
'
+
code
);
},
},
}
}
let
connection_succeeded
:
any
;
let
connection_succeeded
:
any
;
async
function
connectAbility_service
()
{
console
.
info
(
'
particleAbility_connectAbility_test_0400 start
'
);
console
.
info
(
'
particleAbility_connectAbility_test_0400 start
'
);
var
timeOldStamp
=
getNowTime
();
var
connection
=
particleAbility
.
connectAbility
(
request
,
options
);
var
connection
=
particleAbility
.
connectAbility
(
request
,
options
);
connection_succeeded
=
connection
;
var
timeNewStamp
=
getNowTime
();
console
.
info
(
'
particleAbility_connectAbility_test_0400 service request is:
'
+
JSON
.
stringify
(
request
));
getDurationTime
(
'
particleAbility_connectAbility_test_0400 connectability
'
,
timeOldStamp
,
timeNewStamp
);
console
.
info
(
'
particleAbility_connectAbility_test_0400 options is:
'
+
JSON
.
stringify
(
options
));
connection_succeeded
=
connection
;
console
.
info
(
'
particleAbility_connectAbility_test_0400 data is:
'
+
JSON
.
stringify
(
connection
));
console
.
info
(
'
particleAbility_connectAbility_test_0400 service request is:
'
+
JSON
.
stringify
(
request
));
console
.
info
(
'
particleAbility_connectAbility_test_0400 connection=:
'
+
connection
);
console
.
info
(
'
particleAbility_connectAbility_test_0400 options is:
'
+
JSON
.
stringify
(
options
));
}
console
.
info
(
'
particleAbility_connectAbility_test_0400 connection=:
'
+
connection
);
sleep
(
5000
);
async
function
disconnectAbility_promise
()
{
console
.
info
(
'
particleAbility_connectAbility_test_0400 disconnectability start
'
);
console
.
info
(
'
particleAbility_connectAbility_test_0400 disconnectability start
'
);
var
timeOldStamp
=
getNowTime
();
await
particleAbility
.
disconnectAbility
(
connection_succeeded
).
then
((
data
:
any
)
=>
{
particleAbility
.
disconnectAbility
(
connection_succeeded
).
then
((
data
:
any
)
=>
{
console
.
info
(
'
particleAbility_connectAbility_test_0400 disconnectability succeeded:
'
+
var
timeNewStamp
=
getNowTime
();
getDurationTime
(
'
particleAbility_connectAbility_test_0400 disconnectability
'
,
timeOldStamp
,
timeNewStamp
);
console
.
info
(
'
particleAbility_connectAbility_test_0400 disconnectability succeeded:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
:
any
)
=>
{
console
.
error
(
'
particleAbility_connectAbility_test_0400 disconnectability failed. Cause:
'
+
JSON
.
stringify
(
error
));
});
sleep
(
5000
);
console
.
info
(
'
particleAbility_connectAbility_test_0400 disconnectability_fail start
'
);
try
{
var
timeOldStamp
=
getNowTime
();
particleAbility
.
disconnectAbility
(
-
1
).
then
((
data
:
any
)
=>
{
var
timeNewStamp
=
getNowTime
();
getDurationTime
(
'
particleAbility_connectAbility_test_0400 disconnectability_fail
'
,
timeOldStamp
,
timeNewStamp
);
console
.
info
(
'
particleAbility_connectAbility_test_0400 disconnectability_fail succeeded:
'
+
JSON
.
stringify
(
data
));
JSON
.
stringify
(
data
));
}).
catch
((
error
:
any
)
=>
{
console
.
error
(
'
particleAbility_connectAbility_test_0400 disconnectability failed. Cause:
'
+
JSON
.
stringify
(
error
));
})
})
}
}
catch
(
error
:
any
)
{
async
function
disconnectAbility_fail
()
{
console
.
error
(
'
particleAbility_connectAbility_test_0400 disconnectability_fail failed. Cause:
'
+
console
.
info
(
'
particleAbility_connectAbility_test_0400 disconnectability_fail start
'
);
JSON
.
stringify
(
error
));
try
{
await
particleAbility
.
disconnectAbility
(
-
1
).
then
((
data
:
any
)
=>
{
console
.
info
(
'
particleAbility_connectAbility_test_0400 disconnectability_fail succeeded:
'
+
JSON
.
stringify
(
data
));
})
}
catch
(
error
:
any
)
{
console
.
error
(
'
particleAbility_connectAbility_test_0400 disconnectability_fail failed. Cause:
'
+
JSON
.
stringify
(
error
));
}
}
}
connectAbility_service
();
sleep
(
5000
);
disconnectAbility_promise
();
sleep
(
5000
);
disconnectAbility_fail
();
},
},
onConnect
(
want
)
{
onConnect
(
want
)
{
console
.
info
(
'
ServiceAbility5 onConnect
'
);
console
.
info
(
'
ServiceAbility5 onConnect
'
);
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility6/service.ts
浏览文件 @
b5e86514
...
@@ -32,16 +32,16 @@ class StubTest6 extends rpc.RemoteObject {
...
@@ -32,16 +32,16 @@ class StubTest6 extends rpc.RemoteObject {
return
true
;
return
true
;
}
}
}
}
function
getNowTime
()
{
return
new
Date
().
getTime
();
}
async
function
sleep
(
time
:
any
)
{
function
getDurationTime
(
msg
,
startTime
,
endTime
)
{
var
now
=
new
Date
();
console
.
info
(
msg
+
'
Get Interface startTime:
'
+
startTime
);
var
exitTime
=
now
.
getTime
()
+
time
;
console
.
info
(
msg
+
'
Get Interface endTime:
'
+
endTime
);
while
(
true
)
{
var
duration
=
(
endTime
-
startTime
)
now
=
new
Date
();
console
.
info
(
msg
+
'
Get Interface Duration:
'
+
duration
);
if
(
now
.
getTime
()
>
exitTime
)
return
duration
;
break
;
}
console
.
info
(
`sleep
${
time
}
over...`
);
}
}
export
default
{
export
default
{
...
@@ -90,18 +90,16 @@ export default {
...
@@ -90,18 +90,16 @@ export default {
},
},
}
}
async
function
connectAbility_service
()
{
console
.
info
(
'
particleAbility_connectAbility_test_0500 errorabilityName start
'
);
console
.
info
(
'
particleAbility_connectAbility_test_0500 errorabilityName start
'
);
var
timeOldStamp
=
getNowTime
();
var
connection
=
particleAbility
.
connectAbility
(
request
,
options
);
var
connection
=
particleAbility
.
connectAbility
(
request
,
options
);
console
.
info
(
'
particleAbility_connectAbility_test_0500 errorabilityName request is:
'
var
timeNewStamp
=
getNowTime
();
+
JSON
.
stringify
(
request
));
getDurationTime
(
'
particleAbility_connectAbility_test_0500 connectability
'
,
timeOldStamp
,
timeNewStamp
);
console
.
info
(
'
particleAbility_connectAbility_test_0500 errorabilityName options is:
'
console
.
info
(
'
particleAbility_connectAbility_test_0500 errorabilityName request is:
'
+
JSON
.
stringify
(
options
));
+
JSON
.
stringify
(
request
));
console
.
info
(
'
particleAbility_connectAbility_test_0500 errorabilityName connection=:
'
+
connection
);
console
.
info
(
'
particleAbility_connectAbility_test_0500 errorabilityName options is:
'
}
+
JSON
.
stringify
(
options
));
console
.
info
(
'
particleAbility_connectAbility_test_0500 errorabilityName connection=:
'
+
connection
);
connectAbility_service
();
sleep
(
6000
);
},
},
onConnect
(
want
)
{
onConnect
(
want
)
{
console
.
info
(
'
ServiceAbility6 onConnect
'
);
console
.
info
(
'
ServiceAbility6 onConnect
'
);
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility7/service.ts
0 → 100644
浏览文件 @
b5e86514
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
particleAbility
from
'
@ohos.ability.particleAbility
'
;
import
rpc
from
'
@ohos.rpc
'
class
StubTest7
extends
rpc
.
RemoteObject
{
constructor
(
des
)
{
super
(
des
)
}
onRemoteRequest
(
code
,
data
,
reply
,
option
)
{
console
.
info
(
'
ServiceAbility7 onRemoteRequest
'
);
if
(
code
===
1
)
{
let
op1
=
data
.
readInt
();
let
op2
=
data
.
readInt
();
reply
.
writeInt
(
op1
+
op2
);
console
.
info
(
'
ServiceAbility7 op1:
'
+
op1
+
'
op2:
'
+
op2
);
}
return
true
;
}
}
function
getNowTime
()
{
return
new
Date
().
getTime
();
}
function
getDurationTime
(
msg
,
startTime
,
endTime
)
{
console
.
info
(
msg
+
'
Get Interface startTime:
'
+
startTime
);
console
.
info
(
msg
+
'
Get Interface endTime:
'
+
endTime
);
var
duration
=
(
endTime
-
startTime
)
console
.
info
(
msg
+
'
Get Interface Duration:
'
+
duration
);
return
duration
;
}
async
function
sleep
(
time
:
any
)
{
var
now
=
new
Date
();
var
exitTime
=
now
.
getTime
()
+
time
;
while
(
true
)
{
now
=
new
Date
();
if
(
now
.
getTime
()
>
exitTime
)
break
;
}
console
.
info
(
`sleep
${
time
}
over...`
);
}
export
default
{
onStart
()
{
console
.
info
(
'
ServiceAbility7 onStart
'
);
},
onStop
()
{
console
.
info
(
'
ServiceAbility7 onStop
'
);
},
onCommand
(
want
,
startId
)
{
console
.
info
(
'
ServiceAbility7 onCommand
'
);
let
request
=
{
"
bundleName
"
:
"
com.example.myapplication
"
,
"
abilityName
"
:
"
com.example.myapplication.ServiceAbility_API8
"
,
}
let
options
=
{
onConnect
:
async
function
(
element
:
any
,
proxy
:
any
)
{
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.deviceId :
'
+
JSON
.
stringify
(
element
.
deviceId
))
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.bundleName :
'
+
JSON
.
stringify
(
element
.
bundleName
))
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.abilityName :
'
+
JSON
.
stringify
(
element
.
abilityName
))
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.uri :
'
+
JSON
.
stringify
(
element
.
uri
))
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.shortName :
'
+
JSON
.
stringify
(
element
.
shortName
))
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onConnect proxy :
'
+
JSON
.
stringify
(
proxy
));
},
onDisconnect
:
async
function
(
element1
:
any
)
{
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.deviceId :
'
+
JSON
.
stringify
(
element1
.
deviceId
));
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.bundleName:
'
+
JSON
.
stringify
(
element1
.
bundleName
));
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.abilityName:
'
+
JSON
.
stringify
(
element1
.
abilityName
));
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.uri :
'
+
JSON
.
stringify
(
element1
.
uri
));
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.shortName :
'
+
JSON
.
stringify
(
element1
.
shortName
));
},
onFailed
:
function
(
code
:
any
)
{
console
.
log
(
'
particleAbility_connectAbility_test_0600 ConnectAbility onFailed errCode:
'
+
code
);
},
}
let
connection_succeeded
:
any
;
console
.
info
(
'
particleAbility_connectAbility_test_0600 start
'
);
var
timeOldStamp
=
getNowTime
();
var
connection
=
particleAbility
.
connectAbility
(
request
,
options
);
var
timeNewStamp
=
getNowTime
();
getDurationTime
(
'
particleAbility_connectAbility_test_0600 connectability
'
,
timeOldStamp
,
timeNewStamp
);
connection_succeeded
=
connection
;
console
.
info
(
'
particleAbility_connectAbility_test_0600 service request is:
'
+
JSON
.
stringify
(
request
));
console
.
info
(
'
particleAbility_connectAbility_test_0600 options is:
'
+
JSON
.
stringify
(
options
));
console
.
info
(
'
particleAbility_connectAbility_test_0600 data is:
'
+
JSON
.
stringify
(
connection
));
console
.
info
(
'
particleAbility_connectAbility_test_0600 connection=:
'
+
connection
);
sleep
(
5000
);
console
.
info
(
'
particleAbility_connectAbility_test_0600 disconnectability start
'
);
var
timeOldStamp
=
getNowTime
();
particleAbility
.
disconnectAbility
(
connection_succeeded
).
then
((
data
:
any
)
=>
{
var
timeNewStamp
=
getNowTime
();
getDurationTime
(
'
particleAbility_connectAbility_test_0600 disconnectability
'
,
timeOldStamp
,
timeNewStamp
);
console
.
info
(
'
particleAbility_connectAbility_test_0600 disconnectability succeeded:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
:
any
)
=>
{
console
.
error
(
'
particleAbility_connectAbility_test_0600 disconnectability failed. Cause:
'
+
JSON
.
stringify
(
error
));
});
},
onConnect
(
want
)
{
console
.
info
(
'
ServiceAbility7 onConnect
'
);
return
new
StubTest7
(
"
test
"
);
},
onDisConnect
(
want
)
{
console
.
info
(
'
ServiceAbility7 onDisConnect
'
);
},
};
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/element/string.json
浏览文件 @
b5e86514
...
@@ -39,6 +39,10 @@
...
@@ -39,6 +39,10 @@
{
{
"name"
:
"description_serviceability6"
,
"name"
:
"description_serviceability6"
,
"value"
:
"hap sample empty service"
"value"
:
"hap sample empty service"
},
{
"name"
:
"description_serviceability7"
,
"value"
:
"hap sample empty service"
}
}
]
]
}
}
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/config.json
0 → 100644
浏览文件 @
b5e86514
{
"app"
:
{
"bundleName"
:
"com.ohos.acecollaboration"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.example.myapplication1"
,
"name"
:
".MyApplication"
,
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
""
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"myapplication1"
,
"moduleType"
:
"feature"
,
"installationFree"
:
false
},
"abilities"
:
[
{
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"MainAbility"
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:description_mainability"
,
"formsEnabled"
:
false
,
"label"
:
"$string:myapplication1_MainAbility"
,
"type"
:
"page"
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/app.ets
0 → 100644
浏览文件 @
b5e86514
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/pages/index.ets
0 → 100644
浏览文件 @
b5e86514
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import testsuite_app1 from "../test/List.test.ets";
import featureAbility from "@ohos.ability.featureAbility";
@Entry
@Component
struct Index {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
console.info('parameters---->' + JSON.stringify(Want.parameters));
configService.setConfig(Want.parameters);
testsuite_app1();
core.execute();
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('myapplication1 page')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/List.test.ets
0 → 100644
浏览文件 @
b5e86514
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import getHapModuleInfoJsunit_app1 from './getHapModuleInfoJsunit_app1.test.ets';
export default function testsuite_app1() {
getHapModuleInfoJsunit_app1();
}
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/Utils.ets
0 → 100644
浏览文件 @
b5e86514
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default class Utils {
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
static getNowTime() {
return new Date().getTime();
}
static getDurationTime(msg,startTime, endTime) {
console.info(msg+'Get Interface startTime: ' + startTime);
console.info(msg+'Get Interface endTime: ' + endTime);
var duration = (endTime - startTime)
console.info(msg+'Get Interface Duration: ' + duration);
return duration;
}
}
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets
0 → 100644
浏览文件 @
b5e86514
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import Utils from './Utils';
import ability_featureAbility from '@ohos.ability.featureAbility';
export default function getHapModuleInfoJsunit() {
describe('appInfoTest', function () {
/**
* @tc.number: context_getHapModuleInfo_test_0300
* @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application.
* @tc.desc: Check the return type of the interface (by Promise)
* @tc.level 0
*/
it('context_getHapModuleInfo_test_0300', 0, async function (done) {
console.info('[context_getHapModuleInfo_test_0300] START');
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var context = ability_featureAbility.getContext();
context.getHapModuleInfo()
.then((data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('context_getHapModuleInfo_test_0300', timeOldStamp, timeNewStamp);
console.info('[context_getHapModuleInfo_test_0300] data is:' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
})
.catch((error) => {
console.error('[context_getHapModuleInfo_test_0300] failed:' + JSON.stringify(error));
})
var promise = await context.getHapModuleInfo();
console.info('---[context_getHapModuleInfo_test_0300] check---');
checkHapModuleInfo_app('context_getHapModuleInfo_test_0300', promise);
console.info('[context_getHapModuleInfo_test_0300] FINISH');
done();
});
function checkHapModuleInfo_app(msg, data) {
console.log(msg + "checkHapModuleInfo start " + JSON.stringify(data));
console.log(msg + "checkHapModuleInfo name : " + data.name);
console.log(msg + "checkHapModuleInfo description : " + data.description);
console.log(msg + "checkHapModuleInfo descriptionId : " + data.descriptionId);
console.log(msg + "checkHapModuleInfo icon : " + data.icon);
console.log(msg + "checkHapModuleInfo label : " + data.label);
console.log(msg + "checkHapModuleInfo labelId : " + data.labelId);
console.log(msg + "checkHapModuleInfo iconId : " + data.iconId);
console.log(msg + "checkHapModuleInfo backgroundImg : " + data.backgroundImg);
console.log(msg + "checkHapModuleInfo supportedModes : " + data.supportedModes);
console.log(msg + "checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length);
for (var j = 0; j < data.reqCapabilities.length; j++) {
console.log(msg + "getHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]);
}
console.log(msg + "checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length);
for (var k = 0; k < data.deviceTypes.length; k++) {
console.log(msg + "getHapModuleInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
}
console.log(msg + "checkHapModuleInfo abilityInfos length : " + data.abilityInfos.length);
console.log(msg + "checkHapModuleInfo moduleName : " + data.moduleName);
console.log(msg + "checkHapModuleInfo mainAbilityName : " + data.mainAbilityName);
console.log(msg + "checkHapModuleInfo installationFree : " + data.installationFree);
expect(typeof (data)).assertEqual("object");
expect(typeof (data.name)).assertEqual("string");
expect(typeof (data.description)).assertEqual("string");
expect(typeof (data.descriptionId)).assertEqual("number");
expect(typeof (data.icon)).assertEqual("string");
expect(typeof (data.label)).assertEqual("string");
expect(typeof (data.labelId)).assertEqual("number");
expect(typeof (data.iconId)).assertEqual("number");
expect(typeof (data.backgroundImg)).assertEqual("string");
expect(typeof (data.supportedModes)).assertEqual("number");
expect(Array.isArray(data.reqCapabilities)).assertEqual(true);
expect(Array.isArray(data.deviceTypes)).assertEqual(true);
expect(Array.isArray(data.abilityInfos)).assertEqual(true);
expect(typeof (data.moduleName)).assertEqual("string");
expect(typeof (data.mainAbilityName)).assertEqual("string");
expect(typeof (data.installationFree)).assertEqual("boolean");
expect(data.name).assertEqual("com.example.myapplication1");
expect(data.description).assertEqual("");
expect(data.descriptionId).assertEqual(0);
expect(data.icon).assertEqual("$media:icon");
expect(data.label).assertEqual("$string:myapplication1_MainAbility");
expect(data.labelId).assertEqual(0);
expect(data.iconId).assertEqual(0);
expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0);
expect(data.deviceTypes[0]).assertEqual("phone");
checkAbilityInfo(msg,data.abilityInfos[0]);
expect(data.moduleName).assertEqual("myapplication1")
expect(data.mainAbilityName).assertEqual("");
expect(data.installationFree).assertEqual(false);
console.log(msg + "---checkHapModuleInfo End---");
}
function checkAbilityInfo(msg,data) {
console.log(msg+ "checkAbilityInfo start " + JSON.stringify(data));
console.log(msg+ "checkAbilityInfo bundleName : " + data.bundleName);
console.log(msg+ "checkAbilityInfo name : " + data.name);
console.log(msg+ "checkAbilityInfo label : " + data.label);
console.log(msg+ "checkAbilityInfo description : " + data.description);
console.log(msg+ "checkAbilityInfo icon : " + data.icon);
console.log(msg+ "checkAbilityInfo descriptionId : " + data.descriptionId);
console.log(msg+ "checkAbilityInfo iconId : " + data.iconId);
console.log(msg+ "checkAbilityInfo moduleName : " + data.moduleName);
console.log(msg+ "checkAbilityInfo process : " + data.process);
console.log(msg+ "checkAbilityInfo targetAbility : " + data.targetAbility);
console.log(msg+ "checkAbilityInfo backgroundModes : " + data.backgroundModes);
console.log(msg+ "checkAbilityInfo isVisible : " + data.isVisible);
console.log(msg+ "checkAbilityInfo formEnabled : " + data.formEnabled);
console.log(msg+ "checkAbilityInfo type : " + data.type)
console.log(msg+ "checkAbilityInfo orientation : " + data.orientation);
console.log(msg+ "checkAbilityInfo launchMode : " + data.launchMode);
console.log(msg+ "checkAbilityInfo permissions length : " + data.permissions.length);
for (var j = 0; j < data.permissions.length; j++) {
console.log(msg+ "getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]);
}
console.log(msg+ "checkAbilityInfo deviceTypes length : " + data.deviceTypes.length);
for (var k = 0; k < data.deviceTypes.length; k++) {
console.log(msg+ "getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
}
console.log(msg+ "checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length);
for (var i = 0; i < data.deviceCapabilities.length; i++) {
console.log(msg+ "getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]);
}
console.log(msg+ "checkAbilityInfo readPermission : " + data.readPermission);
console.log(msg+ "checkAbilityInfo writePermission : " + data.writePermission);
console.log(msg+ "checkAbilityInfo formEntity : " + data.formEntity);
console.log(msg+ "checkAbilityInfo minFormHeight : " + data.minFormHeight);
console.log(msg+ "checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight);
console.log(msg+ "checkAbilityInfo minFormWidth : " + data.minFormWidth);
console.log(msg+ "checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth);
console.log(msg+ "checkAbilityInfo uri : " + data.uri);
console.log(msg+ "checkAbilityInfo labelId : " + data.labelId);
console.log(msg+ "checkAbilityInfo subType : " + data.subType);
expect(typeof (data)).assertEqual("object");
expect(typeof (data.bundleName)).assertEqual("string");
expect(typeof (data.name)).assertEqual("string");
expect(typeof (data.label)).assertEqual("string");
expect(typeof (data.description)).assertEqual("string");
expect(typeof (data.icon)).assertEqual("string");
expect(typeof (data.labelId)).assertEqual("number");
expect(typeof (data.descriptionId)).assertEqual("number");
expect(typeof (data.iconId)).assertEqual("number");
expect(typeof (data.moduleName)).assertEqual("string");
expect(typeof (data.process)).assertEqual("string");
expect(typeof (data.targetAbility)).assertEqual("string");
expect(typeof (data.backgroundModes)).assertEqual("number");
expect(typeof (data.isVisible)).assertEqual("boolean");
expect(typeof (data.formEnabled)).assertEqual("boolean");
expect(typeof (data.type)).assertEqual("number");
expect(typeof (data.subType)).assertEqual("number");
expect(typeof (data.orientation)).assertEqual("number");
expect(typeof (data.launchMode)).assertEqual("number");
expect(Array.isArray(data.permissions)).assertEqual(true);
expect(Array.isArray(data.deviceTypes)).assertEqual(true);
expect(Array.isArray(data.deviceCapabilities)).assertEqual(true);
expect(typeof (data.readPermission)).assertEqual("string");
expect(typeof (data.writePermission)).assertEqual("string");
expect(typeof (data.applicationInfo)).assertEqual("object");
expect(typeof (data.formEntity)).assertEqual("number");
expect(typeof (data.minFormHeight)).assertEqual("number");
expect(typeof (data.defaultFormHeight)).assertEqual("number");
expect(typeof (data.minFormWidth)).assertEqual("number");
expect(typeof (data.defaultFormWidth)).assertEqual("number");
expect(typeof (data.uri)).assertEqual("string");
expect(data.bundleName).assertEqual("com.ohos.acecollaboration");
expect(data.name).assertEqual("com.example.myapplication1.MainAbility");
expect(data.label).assertEqual("$string:myapplication1_MainAbility");
expect(data.description).assertEqual("$string:description_mainability");
expect(data.icon).assertEqual("$media:icon");
expect(data.descriptionId).assertEqual(16777220);
expect(data.iconId).assertEqual(16777221);
expect(data.moduleName).assertEqual("myapplication1");
expect(data.process).assertEqual("");
expect(data.targetAbility).assertEqual("");
expect(data.backgroundModes).assertEqual(0);
expect(data.isVisible).assertEqual(true);
expect(data.formEnabled).assertEqual(false);
expect(data.type).assertEqual(1);
expect(data.orientation).assertEqual(0);
expect(data.launchMode).assertEqual(1);
expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.readPermission).assertEqual("");
expect(data.writePermission).assertEqual("");
checkApplicationInfo(msg,data.applicationInfo);
expect(data.formEntity).assertEqual(0);
expect(data.minFormHeight).assertEqual(0);
expect(data.defaultFormHeight).assertEqual(0);
expect(data.minFormWidth).assertEqual(0);
expect(data.defaultFormWidth).assertEqual(0);
expect(data.uri).assertEqual("");
expect(data.labelId).assertEqual(16777218);
expect(data.subType).assertEqual(0);
console.log(msg+ "---checkAbilityInfo End--- ");
}
function checkApplicationInfo(msg,info) {
console.log(msg+ "checkApplicationInfo start : " + JSON.stringify(info));
console.log(msg+ "checkApplicationInfo name : " + info.name);
console.log(msg+ "checkApplicationInfo description : " + info.description);
console.log(msg+ "checkApplicationInfo descriptionId : " + info.descriptionId);
console.log(msg+ "checkApplicationInfo systemApp : " + info.systemApp);
console.log(msg+ "checkApplicationInfo enabled : " + info.enabled);
console.log(msg+ "checkApplicationInfo label : " + info.label);
console.log(msg+ "checkApplicationInfo labelId : " + info.labelId);
console.log(msg+ "checkApplicationInfo icon : " + info.icon);
console.log(msg+ "checkApplicationInfo iconId : " + info.iconId);
console.log(msg+ "checkApplicationInfo process : " + info.process);
console.log(msg+ "checkApplicationInfo supportedModes : " + info.supportedModes);
console.log(msg+ "checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
for (var j = 0; j < info.moduleSourceDirs.length; j++) {
console.log(msg+ "checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
}
console.log(msg+ "checkApplicationInfo permissions length : " + info.permissions.length);
for (var k = 0; k < info.permissions.length; k++) {
console.log(msg+ "checkApplicationInfo info.permissions[" + k + "] : " + info.permissions[k]);
}
console.log(msg+ "checkApplicationInfo moduleInfos length : " + info.moduleInfos.length);
for (var i = 0; i < info.moduleInfos.length; i++) {
console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleName : " + info.moduleInfos[i].moduleName);
console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleSourceDir : " + info.moduleInfos[i].moduleSourceDir);
}
console.log(msg+ "checkApplicationInfo entryDir : " + info.entryDir);
expect(typeof (info)).assertEqual("object");
expect(typeof (info.name)).assertEqual("string");
expect(typeof (info.description)).assertEqual("string");
expect(typeof (info.descriptionId)).assertEqual("number");
expect(typeof (info.systemApp)).assertEqual("boolean");
expect(typeof (info.enabled)).assertEqual("boolean");
expect(typeof (info.label)).assertEqual("string");
expect(typeof (info.labelId)).assertEqual("string");
expect(typeof (info.icon)).assertEqual("string");
expect(typeof (info.iconId)).assertEqual("string");
expect(typeof (info.process)).assertEqual("string");
expect(typeof (info.supportedModes)).assertEqual("number");
expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
expect(Array.isArray(info.permissions)).assertEqual(true);
expect(Array.isArray(info.moduleInfos)).assertEqual(true);
expect(typeof (info.entryDir)).assertEqual("string");
expect(info.name).assertEqual("com.ohos.acecollaboration");
expect(info.description).assertEqual("$string:mainability_description");
expect(info.descriptionId).assertEqual(16777220);
expect(info.systemApp).assertEqual(true);
expect(info.enabled).assertEqual(true);
expect(info.label).assertEqual("$string:entry_MainAbility");
expect(info.labelId).assertEqual("16777218");
expect(info.icon).assertEqual("$media:icon");
expect(info.iconId).assertEqual("16777221");
expect(info.process).assertEqual("");
expect(info.supportedModes).assertEqual(0);
if (info.moduleSourceDirs.length == 1){
expect(info.moduleInfos[0].moduleName).assertEqual("entry");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}else if(info.moduleSourceDirs.length == 2) {
if (info.moduleInfos[0].moduleName == "myapplication1") {
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication1");
expect(info.moduleInfos[1].moduleName).assertEqual("entry");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}else{
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication2");
expect(info.moduleInfos[1].moduleName).assertEqual("entry");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}
}else {
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication1");
expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication2");
expect(info.moduleInfos[2].moduleName).assertEqual("entry");
expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}
expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
console.log(msg+ "---checkApplicationInfo End--- ");
}
})
}
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
b5e86514
{
"string"
:
[
{
"name"
:
"myapplication1_MainAbility"
,
"value"
:
"myapplication1_MainAbility"
},
{
"name"
:
"description_mainability"
,
"value"
:
"eTS_Empty Ability"
}
]
}
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
b5e86514
6.6 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录