Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2a4eff4f
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看板
提交
2a4eff4f
编写于
8月 22, 2022
作者:
X
xuchenghua09
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
Signed-off-by:
N
xuchenghua09
<
xuchenghua09@huawei.com
>
上级
0ac9c25e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
107 addition
and
38 deletion
+107
-38
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts
...abilitytest/entry/src/main/ets/MainAbility/MainAbility.ts
+2
-1
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
...ytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
+12
-12
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets
...est/entry/src/main/ets/test/manyusersabilitytest.test.ets
+91
-23
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/module.json
...s/actsmanyuserthirdabilitytest/entry/src/main/module.json
+2
-2
未找到文件。
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
2a4eff4f
...
...
@@ -20,6 +20,7 @@ export default class MainAbility extends Ability {
// Ability is creating, initialize resources for this ability
console
.
log
(
"
MainAbility onCreate
"
)
globalThis
.
abilityWant
=
want
;
globalThis
.
abilityContext
=
this
.
context
}
onDestroy
()
{
...
...
@@ -30,7 +31,7 @@ export default class MainAbility extends Ability {
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
MainAbility onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/index
"
,
null
)
}
...
...
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
浏览文件 @
2a4eff4f
...
...
@@ -97,8 +97,8 @@ export default class ServiceAbility extends ServiceExtension {
if
(
want
.
action
==
"
Seven
"
)
{
extensionContext
.
connectAbility
(
{
bundleName
:
"
com.example.manyusersabilitytest
"
,
abilityName
:
"
com.example.manyusersabilitytest.ServiceAbility2
"
,
bundleName
:
"
com.example.
acts
manyusersabilitytest
"
,
abilityName
:
"
com.example.
acts
manyusersabilitytest.ServiceAbility2
"
,
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
...
...
@@ -109,8 +109,8 @@ export default class ServiceAbility extends ServiceExtension {
if
(
want
.
action
==
"
Eight
"
)
{
extensionContext
.
connectAbility
(
{
bundleName
:
"
com.example.manyusersabilitytesta
"
,
abilityName
:
"
com.example.manyusersabilitytest.ServiceAbility3
"
,
bundleName
:
"
com.example.
acts
manyusersabilitytesta
"
,
abilityName
:
"
com.example.
acts
manyusersabilitytest.ServiceAbility3
"
,
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
...
...
@@ -122,8 +122,8 @@ export default class ServiceAbility extends ServiceExtension {
console
.
log
(
'
connectAbility 111
'
);
let
num
=
this
.
context
.
connectAbility
(
{
bundleName
:
'
com.example.manyusersabilitytest
'
,
abilityName
:
'
com.example.manyusersabilitytest.ServiceAbility2
'
bundleName
:
'
com.example.
acts
manyusersabilitytest
'
,
abilityName
:
'
com.example.
acts
manyusersabilitytest.ServiceAbility2
'
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
...
...
@@ -140,8 +140,8 @@ export default class ServiceAbility extends ServiceExtension {
console
.
log
(
'
connectAbility 222
'
);
let
num
=
this
.
context
.
connectAbility
(
{
bundleName
:
'
com.example.manyusersabilitytest
'
,
abilityName
:
'
com.example.manyusersabilitytest.ServiceAbility2
'
bundleName
:
'
com.example.
acts
manyusersabilitytest
'
,
abilityName
:
'
com.example.
acts
manyusersabilitytest.ServiceAbility2
'
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
...
...
@@ -158,8 +158,8 @@ export default class ServiceAbility extends ServiceExtension {
console
.
log
(
'
connectAbility 333
'
);
let
num
=
this
.
context
.
connectAbility
(
{
bundleName
:
'
com.example.manyusersabilitytest
'
,
abilityName
:
'
com.example.manyusersabilitytest.ServiceAbility2
'
bundleName
:
'
com.example.
acts
manyusersabilitytest
'
,
abilityName
:
'
com.example.
acts
manyusersabilitytest.ServiceAbility2
'
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
...
...
@@ -176,8 +176,8 @@ export default class ServiceAbility extends ServiceExtension {
console
.
log
(
'
connectAbility 444
'
);
let
num
=
this
.
context
.
connectAbility
(
{
bundleName
:
'
com.example.manyusersabilitytest
'
,
abilityName
:
'
com.example.manyusersabilitytest.ServiceAbility2
'
bundleName
:
'
com.example.
acts
manyusersabilitytest
'
,
abilityName
:
'
com.example.
acts
manyusersabilitytest.ServiceAbility2
'
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
...
...
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets
浏览文件 @
2a4eff4f
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect
} from "deccjsunit/index"
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect
} from "deccjsunit/index"
import commonEvent from '@ohos.commonEvent'
...
...
@@ -67,6 +67,26 @@ var unsubscriberInfoStartAbility_0200 = {
const START_ABILITY_TIMEOUT = 1000;
globalThis.number = 0;
function onConnectCallback(element, remote) {
console.log(' ACTS_ConnectAbility onConnectCallback====> element=' + JSON.stringify(element));
console.log(' ACTS_ConnectAbility onConnectCallback====> remote=' + JSON.stringify(remote));
// setTimeout(()=> {
// console.log('====>in timeout');
// console.debug("====>flag is====>" + JSON.stringify(flag));
// if(flag == true) {
// console.debug('ACTS_ThirdPartyExtensionStartAbility_0600 - timeout');
// commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
// }
// }, 1000);
}
function onDisconnectCallback(element) {
console.log('ACTS_ConnectAbility onDisconnectCallback====> element=' + JSON.stringify(element));
}
function onFailedCallback(code) {
console.log('ACTS_ConnectAbility onFailedCallback====> code=' + JSON.stringify(code))
}
export default function abilityTest(abilityContext) {
describe('manyuserability', function () {
...
...
@@ -74,6 +94,11 @@ export default function abilityTest(abilityContext) {
console.log('ACTS_ConnectAbility_0200 Connectability errcode:' + code);
}
/*
* @tc.number : ACTS_ThirdPartyConnectAbility_0100
* @tc.name : connect ability
* @tc.desc : Start an ability with the parameter startability with options failed.(callback)
*/
it('ACTS_ThirdPartyConnectAbility_0100', 0, async function (done) {
console.log('ACTS_ThirdPartyConnectAbility_0100====<begin');
console.log('========ACTS_ConnectAbility_0100 1 called');
...
...
@@ -81,7 +106,6 @@ export default function abilityTest(abilityContext) {
let id;
let connId;
function subscribeCallBack(err, data) {
console.debug("====>ACTS_ThirdPartyConnectAbility_0100 7 CallBack data:====>" + JSON.stringify(data));
clearTimeout(id);
...
...
@@ -95,10 +119,8 @@ export default function abilityTest(abilityContext) {
);
console.debug("====>ACTS_ThirdPartyConnectAbility_0100 6 ");
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
}
commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => {
console.debug("====>ACTS_ThirdPartyConnectAbility_0100 2 Subscriber1====>");
subscriber = data;
...
...
@@ -128,11 +150,19 @@ export default function abilityTest(abilityContext) {
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
action: "one",
},
},{
onConnect:onConnectCallback,
onDisconnect:onDisconnectCallback,
onFailed: onFailedCallback
}
);
console.debug("====>ACTS_ThirdPartyConnectAbility_0100 4 ");
})
it('ACTS_ThirdPartyConnectAbility_0200', 0, async function (done) {
console.log('ACTS_ThirdPartyConnectAbility_0200====<begin');
console.log('========StartConnect called');
...
...
@@ -142,7 +172,7 @@ export default function abilityTest(abilityContext) {
function subscribeCallBack(err, data) {
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
console.debug("====>
ACTS_ThirdPartyConnectAbility_0200
Subscribe CallBack data:====>" + JSON.stringify(data));
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0200_commonEvent");
...
...
@@ -150,13 +180,13 @@ export default function abilityTest(abilityContext) {
}
commonEvent.createSubscriber(subscriberInfoStartAbility_0200).then(async (data) => {
console.debug("====>Create Subscriber====>");
console.debug("====>
ACTS_ThirdPartyConnectAbility_0200
Create Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack);
})
function unSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
console.debug("====>
ACTS_ThirdPartyConnectAbility_0200
UnSubscribe CallBack====>");
done();
}
...
...
@@ -176,8 +206,6 @@ export default function abilityTest(abilityContext) {
{
onFailed: onFailedCallBack,
},
);
})
...
...
@@ -213,10 +241,10 @@ export default function abilityTest(abilityContext) {
function unSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
setTimeout(()=>
{
setTimeout(() => {
done()
}, 1000)};
}, 1000)
};
function timeout() {
expect().assertFail();
...
...
@@ -236,7 +264,11 @@ export default function abilityTest(abilityContext) {
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
action: "Three",
},
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0100 4====>");
})
...
...
@@ -312,7 +344,11 @@ export default function abilityTest(abilityContext) {
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
action: "Four",
},
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
console.debug("====>connId is:====>" + JSON.stringify(connId));
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0200 1010 Subscriber====>");
...
...
@@ -380,7 +416,11 @@ export default function abilityTest(abilityContext) {
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
action: "Five",
},
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0300 4 ");
})
...
...
@@ -455,7 +495,11 @@ export default function abilityTest(abilityContext) {
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
action: "Six",
},
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
console.debug("====>connId is:====>" + JSON.stringify(connId));
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0400 1010 Subscriber====>");
...
...
@@ -524,7 +568,11 @@ export default function abilityTest(abilityContext) {
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
action: "Seven",
},
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
console.debug("====>ACTS_ThirdPartyExtensionConnectAbility_0100 4 ");
...
...
@@ -585,7 +633,11 @@ export default function abilityTest(abilityContext) {
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
action: "Eight",
},
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
console.debug("====>ACTS_ThirdPartyExtensionConnectAbility_0200 4 ");
...
...
@@ -646,7 +698,11 @@ export default function abilityTest(abilityContext) {
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
action: "Nine",
},
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0100 4 ");
...
...
@@ -708,7 +764,11 @@ export default function abilityTest(abilityContext) {
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
action: "Ten",
},
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0200 4 ");
...
...
@@ -769,7 +829,11 @@ export default function abilityTest(abilityContext) {
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
action: "Ten one",
},
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0300 4 ");
...
...
@@ -830,7 +894,11 @@ export default function abilityTest(abilityContext) {
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
action: "Ten two",
},
}, {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback
}
);
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0400 4 ");
...
...
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/module.json
浏览文件 @
2a4eff4f
...
...
@@ -36,7 +36,7 @@
"extensionAbilities"
:
[
{
"srcEntrance"
:
"./ets/ServiceAbility/ServiceAbility.ts"
,
"name"
:
"com.example.acts
connectabilitysystem
abilitytest.ServiceAbility"
,
"name"
:
"com.example.acts
manyusers
abilitytest.ServiceAbility"
,
"icon"
:
"$media:icon"
,
"srcLanguage"
:
"ets"
,
"description"
:
"$string:phone_entry_main"
,
...
...
@@ -45,7 +45,7 @@
},
{
"srcEntrance"
:
"./ets/ServiceAbility2/ServiceAbility2.ts"
,
"name"
:
"com.example.acts
connectabilitysystem
abilitytest.ServiceAbility2"
,
"name"
:
"com.example.acts
manyusers
abilitytest.ServiceAbility2"
,
"icon"
:
"$media:icon"
,
"srcLanguage"
:
"ets"
,
"description"
:
"$string:phone_entry_main"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录