Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
02a6eeb8
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看板
提交
02a6eeb8
编写于
8月 08, 2023
作者:
X
xinking129
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
changdetails
Signed-off-by:
N
xinking129
<
xinxin13@huawei.com
>
上级
7364cc70
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
456 addition
and
436 deletion
+456
-436
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/entryability/EntryAbility.ts
...otherrely/entry/src/main/ets/entryability/EntryAbility.ts
+3
-3
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/pages/Index.ets
...ensionabilityotherrely/entry/src/main/ets/pages/Index.ets
+3
-2
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/pages/PageThree.ets
...onabilityotherrely/entry/src/main/ets/pages/PageThree.ets
+1
-2
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/shareextensionability/ActsShareExtensionAbility.ts
...in/ets/shareextensionability/ActsShareExtensionAbility.ts
+9
-4
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts
...elf/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts
+85
-86
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/Index.ets
...reextensionabilityself/entry/src/main/ets/pages/Index.ets
+10
-7
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/Page.ets
...areextensionabilityself/entry/src/main/ets/pages/Page.ets
+5
-5
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/PageThree.ets
...tensionabilityself/entry/src/main/ets/pages/PageThree.ets
+0
-1
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/shareextensionability/ActsShareExtensionAbility.ts
...in/ets/shareextensionability/ActsShareExtensionAbility.ts
+9
-4
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/feature/src/main/ets/featureability/FeatureAbility.ts
...elf/feature/src/main/ets/featureability/FeatureAbility.ts
+1
-1
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/feature/src/main/ets/shareextensionability/FeatureShareExtensionAbility.ts
...ets/shareextensionability/FeatureShareExtensionAbility.ts
+3
-1
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+2
-2
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/test/Ability.test.ets
...nsionabilitytest/entry/src/main/ets/test/Ability.test.ets
+261
-257
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/testability/TestAbility.ets
...bilitytest/entry/src/main/ets/testability/TestAbility.ets
+35
-35
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/testability/pages/Index.ets
...bilitytest/entry/src/main/ets/testability/pages/Index.ets
+29
-26
未找到文件。
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/entryability/EntryAbility.ts
浏览文件 @
02a6eeb8
...
...
@@ -14,7 +14,7 @@
*/
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
window
from
'
@ohos.window
'
;
import
type
window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
UIAbility
{
onCreate
(
want
,
launchParam
)
{
...
...
@@ -28,8 +28,8 @@ export default class EntryAbility extends UIAbility {
parameters
:
{
'
ability.want.params.uiExtensionType
'
:
'
share
'
}
}).
catch
((
err
)
=>
{
console
.
info
(
'
====>ShareExtensionAbility_0100 err:
'
+
JSON
.
stringify
(
err
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
====>ShareExtensionAbility_0100 err:
'
+
JSON
.
stringify
(
err
));
})
}
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/pages/Index.ets
浏览文件 @
02a6eeb8
...
...
@@ -26,6 +26,7 @@ struct Index {
'ability.want.params.uiExtensionType': 'share'
}
}
build() {
Row() {
Column() {
...
...
@@ -33,9 +34,9 @@ struct Index {
.fontSize(50)
.fontWeight(FontWeight.Bold)
UIExtensionComponent(this.want)
.size({
width:'100%',height:'100'
})
.size({
width: '100%', height: '100'
})
.backgroundColor(Color.Blue)
.border({
width:5,color:Color.Red
})
.border({
width: 5, color: Color.Red
})
Button('StartAbilityForResult')
.fontSize(30)
.fontWeight(FontWeight.Bold)
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/pages/PageThree.ets
浏览文件 @
02a6eeb8
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import commonEvent from '@ohos.commonEventManager'
import commonEvent from '@ohos.commonEventManager'
;
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
let storage = LocalStorage.GetShared();
...
...
@@ -21,7 +21,6 @@ let storage = LocalStorage.GetShared();
@Entry(storage)
@Component
struct PageThree {
build() {
Row() {
Column() {
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/shareextensionability/ActsShareExtensionAbility.ts
浏览文件 @
02a6eeb8
...
...
@@ -15,11 +15,13 @@
import
ShareExtensionAbility
from
'
@ohos.app.ability.ShareExtensionAbility
'
;
import
commonEventManager
from
'
@ohos.commonEventManager
'
;
var
count
=
0
;
let
count
=
0
;
const
TIME_OUT
=
500
;
export
default
class
ActsShareExtensionAbility
extends
ShareExtensionAbility
{
storage
:
LocalStorage
;
message
:
string
;
onCreate
()
{
console
.
log
(
'
====>ActsShareExtensionAbility onCreate called
'
);
count
++
;
...
...
@@ -33,13 +35,15 @@ export default class ActsShareExtensionAbility extends ShareExtensionAbility {
'
count
'
:
count
}
}
commonEventManager
.
publish
(
'
ACTS_TEST_FOREGROUND
'
,
options
,
function
(){});
commonEventManager
.
publish
(
'
ACTS_TEST_FOREGROUND
'
,
options
,
function
()
{
});
}
onBackground
()
{
console
.
log
(
'
====>ActsShareExtensionAbility onBackground called
'
);
count
++
;
commonEventManager
.
publish
(
'
ACTS_TEST_BACKGROUND
'
,
function
(){});
commonEventManager
.
publish
(
'
ACTS_TEST_BACKGROUND
'
,
function
()
{
});
setTimeout
(()
=>
{
globalThis
.
session
.
terminateSelf
();
},
TIME_OUT
);
...
...
@@ -66,7 +70,8 @@ export default class ActsShareExtensionAbility extends ShareExtensionAbility {
'
count
'
:
count
}
}
commonEventManager
.
publish
(
'
ACTS_TEST_DESTROY
'
,
options
,
function
(){});
commonEventManager
.
publish
(
'
ACTS_TEST_DESTROY
'
,
options
,
function
()
{
});
}
onSessionDestroy
(
session
)
{
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts
浏览文件 @
02a6eeb8
...
...
@@ -238,7 +238,6 @@ export default class UiExtAbility extends ShareExtensionAbility {
let
applicationInfo
=
this
.
context
.
applicationInfo
;
let
commonEventData
=
{
parameters
:
{
name
:
applicationInfo
.
name
,
...
...
@@ -335,7 +334,7 @@ export default class UiExtAbility extends ShareExtensionAbility {
}
if
(
want
.
action
===
'
Acts_ShareExtensionAbility_3000
'
)
{
var
moduleContext
=
this
.
context
.
createModuleContext
(
'
entry
'
);
let
moduleContext
=
this
.
context
.
createModuleContext
(
'
entry
'
);
let
options
=
{
parameters
:
{
'
bundleName
'
:
moduleContext
.
applicationInfo
.
name
...
...
@@ -347,7 +346,7 @@ export default class UiExtAbility extends ShareExtensionAbility {
}
if
(
want
.
action
===
'
Acts_ShareExtensionAbility_3100
'
)
{
var
moduleContext
=
this
.
context
.
createModuleContext
(
'
entry_test
'
);
let
moduleContext
=
this
.
context
.
createModuleContext
(
'
entry_test
'
);
let
options
=
{
parameters
:
{
'
bundleName
'
:
moduleContext
.
applicationInfo
.
name
...
...
@@ -360,7 +359,7 @@ export default class UiExtAbility extends ShareExtensionAbility {
if
(
want
.
action
===
'
Acts_ShareExtensionAbility_3200
'
)
{
try
{
var
moduleContext
=
this
.
context
.
createModuleContext
(
'
entry_assist
'
);
let
moduleContext
=
this
.
context
.
createModuleContext
(
'
entry_assist
'
);
}
catch
{
console
.
log
(
'
createModuleContext err
'
);
}
...
...
@@ -376,7 +375,7 @@ export default class UiExtAbility extends ShareExtensionAbility {
if
(
want
.
action
===
'
Acts_ShareExtensionAbility_3300
'
)
{
try
{
var
moduleContext
=
this
.
context
.
createModuleContext
(
'
abc
'
);
let
moduleContext
=
this
.
context
.
createModuleContext
(
'
abc
'
);
}
catch
{
console
.
log
(
'
createModuleContext err
'
);
}
...
...
@@ -392,7 +391,7 @@ export default class UiExtAbility extends ShareExtensionAbility {
if
(
want
.
action
===
'
Acts_ShareExtensionAbility_3400
'
)
{
try
{
var
moduleContext
=
this
.
context
.
createModuleContext
(
undefined
);
let
moduleContext
=
this
.
context
.
createModuleContext
(
undefined
);
}
catch
{
console
.
log
(
'
createModuleContext err
'
);
}
...
...
@@ -407,7 +406,7 @@ export default class UiExtAbility extends ShareExtensionAbility {
}
if
(
want
.
action
===
'
Acts_ShareExtensionAbility_3500
'
)
{
var
applicationContext
=
this
.
context
.
getApplicationContext
();
let
applicationContext
=
this
.
context
.
getApplicationContext
();
let
options
=
{
parameters
:
{
'
applicationContext
'
:
applicationContext
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/Index.ets
浏览文件 @
02a6eeb8
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Want from '@ohos.app.ability.Want';
import commonEventManager from '@ohos.commonEventManager'
import commonEventManager from '@ohos.commonEventManager'
;
@Entry
@Component
...
...
@@ -27,6 +27,7 @@ struct Index {
'ability.want.params.uiExtensionType': 'share'
}
}
build() {
Row() {
Column() {
...
...
@@ -34,9 +35,9 @@ struct Index {
.fontSize(50)
.fontWeight(FontWeight.Bold)
UIExtensionComponent(this.want)
.size({
width:'100%',height:'100'
})
.size({
width: '100%', height: '100'
})
.backgroundColor(Color.Blue)
.border({
width:5,color:Color.Red
})
.border({
width: 5, color: Color.Red
})
.onRemoteReady((proxy) => {
console.log('====>onRemoteReady will send data');
setTimeout(() => {
...
...
@@ -47,7 +48,7 @@ struct Index {
});
}, 1000);
})
.onResult((data)
=>
{
.onResult((data)
=>
{
let onResultEvent = 'ACTS_UIExtension_OnResult';
let options = {
parameters: {
...
...
@@ -58,7 +59,7 @@ struct Index {
console.log('ACTS_UIExtension_OnResult');
});
})
.onReceive((data)
=>
{
.onReceive((data)
=>
{
let onReceiveEvent = 'ACTS_UIExtension_OnReceive';
let options = {
parameters: {
...
...
@@ -76,7 +77,8 @@ struct Index {
'err': err
}
}
commonEventManager.publish('ACTS_TEST_START_ERR', options, function (){});
commonEventManager.publish('ACTS_TEST_START_ERR', options, function () {
});
})
.onRelease((releaseCode) => {
console.log('====>UIExtensionComponent onRelease releaseCode: ' + JSON.stringify(releaseCode));
...
...
@@ -85,7 +87,8 @@ struct Index {
'releaseCode': releaseCode
}
}
commonEventManager.publish('ACTS_TEST_RELEASE', options, function (){});
commonEventManager.publish('ACTS_TEST_RELEASE', options, function () {
});
})
}
.width('100%')
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/Page.ets
浏览文件 @
02a6eeb8
...
...
@@ -38,8 +38,8 @@ struct Page {
let terminateSelfWithResultEvent = 'ACTS_UIExtension_TerminateSelfWithResult';
let sendDataEvent = 'ACTS_UIExtension_SendData';
var
subscriber;
var
subscribeInfo = {
let
subscriber;
let
subscribeInfo = {
events: [terminateSelfWithResultEvent, sendDataEvent]
};
commonEventManager.createSubscriber(subscribeInfo).then(async (data) => {
...
...
@@ -90,9 +90,9 @@ struct Page {
.fontSize(30)
.fontWeight(FontWeight.Bold)
UIExtensionComponent(this.want)
.size({width:'100%',height:'100'
})
.size({ width: '100%', height: '100'
})
.backgroundColor(Color.Blue)
.border({width:5,color:Color.Red
})
.border({ width: 5, color: Color.Red
})
}
.width('100%')
}
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/PageThree.ets
浏览文件 @
02a6eeb8
...
...
@@ -18,7 +18,6 @@ let storage = LocalStorage.GetShared();
@Entry(storage)
@Component
struct Index3 {
build() {
Row() {
Column() {
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/shareextensionability/ActsShareExtensionAbility.ts
浏览文件 @
02a6eeb8
...
...
@@ -15,11 +15,13 @@
import
ShareExtensionAbility
from
'
@ohos.app.ability.ShareExtensionAbility
'
;
import
commonEventManager
from
'
@ohos.commonEventManager
'
;
var
count
=
0
;
let
count
=
0
;
const
TIME_OUT
=
500
;
export
default
class
ActsShareExtensionAbility
extends
ShareExtensionAbility
{
storage
:
LocalStorage
;
message
:
string
;
onCreate
()
{
console
.
log
(
'
====>ActsShareExtensionAbility onCreate called
'
);
count
++
;
...
...
@@ -33,13 +35,15 @@ export default class ActsShareExtensionAbility extends ShareExtensionAbility {
'
count
'
:
count
}
}
commonEventManager
.
publish
(
'
ACTS_TEST_FOREGROUND
'
,
options
,
function
(){});
commonEventManager
.
publish
(
'
ACTS_TEST_FOREGROUND
'
,
options
,
function
()
{
});
}
onBackground
()
{
console
.
log
(
'
====>ActsShareExtensionAbility onBackground called
'
);
count
++
;
commonEventManager
.
publish
(
'
ACTS_TEST_BACKGROUND
'
,
function
(){});
commonEventManager
.
publish
(
'
ACTS_TEST_BACKGROUND
'
,
function
()
{
});
setTimeout
(()
=>
{
globalThis
.
session
.
terminateSelf
();
},
TIME_OUT
);
...
...
@@ -66,7 +70,8 @@ export default class ActsShareExtensionAbility extends ShareExtensionAbility {
'
count
'
:
count
}
}
commonEventManager
.
publish
(
'
ACTS_TEST_DESTROY
'
,
options
,
function
(){});
commonEventManager
.
publish
(
'
ACTS_TEST_DESTROY
'
,
options
,
function
()
{
});
}
onSessionDestroy
(
session
)
{
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/feature/src/main/ets/featureability/FeatureAbility.ts
浏览文件 @
02a6eeb8
...
...
@@ -14,7 +14,7 @@
*/
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
window
from
'
@ohos.window
'
;
import
type
window
from
'
@ohos.window
'
;
export
default
class
FeatureAbility
extends
UIAbility
{
onCreate
(
want
,
launchParam
)
{
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/feature/src/main/ets/shareextensionability/FeatureShareExtensionAbility.ts
浏览文件 @
02a6eeb8
...
...
@@ -18,6 +18,7 @@ import commonEventManager from '@ohos.commonEventManager';
export
default
class
FeatureShareExtensionAbility
extends
ShareExtensionAbility
{
storage
:
LocalStorage
;
message
:
string
;
onCreate
()
{
}
...
...
@@ -31,7 +32,8 @@ export default class FeatureShareExtensionAbility extends ShareExtensionAbility
onSessionCreate
(
want
,
session
)
{
console
.
log
(
'
====>FeatureShareExtensionAbility onSessionCreate called
'
);
commonEventManager
.
publish
(
'
ACTS_FEATURE_CREATE
'
,
function
(){});
commonEventManager
.
publish
(
'
ACTS_FEATURE_CREATE
'
,
function
()
{
});
if
(
want
.
action
===
'
Acts_ShareExtensionAbility_0400
'
)
{
this
.
context
.
startAbility
({
bundleName
:
'
com.example.actsshareextensionabilitytest
'
,
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
浏览文件 @
02a6eeb8
...
...
@@ -16,8 +16,8 @@ import hilog from '@ohos.hilog';
import
TestRunner
from
'
@ohos.application.testRunner
'
;
import
AbilityDelegatorRegistry
from
'
@ohos.app.ability.abilityDelegatorRegistry
'
;
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
let
abilityDelegator
=
undefined
let
abilityDelegatorArguments
=
undefined
async
function
onAbilityCreateCallback
()
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
onAbilityCreateCallback
'
);
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
02a6eeb8
...
...
@@ -13,18 +13,19 @@
* limitations under the License.
*/
import
hilog
from
'@ohos.hilog'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'@ohos/hypium'
import
commonEvent
from
'@ohos.commonEventManager'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'@ohos/hypium'
;
import
commonEvent
from
'@ohos.commonEventManager'
;
import
abilityDelegatorRegistry
from
'@ohos.app.ability.abilityDelegatorRegistry'
;
import
{
Driver
,
ON
}
from
'@ohos.UiTest'
;
let
abilityDelegator
=
abilityDelegatorRegistry
.
getAbilityDelegator
()
var
ACTS_CallFunction
=
{
let
ACTS_CallFunction
=
{
events
:
[
'ACTS_CALL_EVENT'
,
'ACTS_CALL_EVENT_ANOTHER'
]
};
var
ACTS_EVENT
=
{
let
ACTS_EVENT
=
{
events
:
[
'ACTS_TEST_FOREGROUND'
,
'ACTS_TEST_DESTROY'
,
'ACTS_TEST_RELEASE'
,
'ACTS_TEST_START_ERR'
]
};
export
default
function
abilityTest
()
{
describe
(
'ActsAbilityTest'
,
function
()
{
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
...
...
@@ -49,8 +50,8 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: With the same application with the same module, test ShareExtensionAbility lifecycle.
*/
it
(
'Acts_ShareExtensionAbility_0100'
,
0
,
async
function
(
done
)
{
var
subscriber
;
it
(
'Acts_ShareExtensionAbility_0100'
,
0
,
async
function
(
done
)
{
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_EVENT
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0100 createSubscriber ${data}`
);
subscriber
=
data
;
...
...
@@ -69,8 +70,8 @@ export default function abilityTest() {
expect
(
data
.
parameters
.
count
)
.
assertEqual
(
3
);
await
abilityDelegator
.
executeShellCommand
(
'aa dump -a'
)
.
then
((
data
)
=>
{
console
.
info
(
'====>Acts_ShareExtensionAbility_0100 : data : '
+
JSON
.
stringify
(
data
.
stdResult
));
var
firstString
=
data
.
stdResult
.
split
(
"entry/ActsShareExtensionAbility"
);
var
result
=
firstString
[
1
]
.
split
(
"uri"
);
let
firstString
=
data
.
stdResult
.
split
(
"entry/ActsShareExtensionAbility"
);
let
result
=
firstString
[
1
]
.
split
(
"uri"
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0100 result aa string: '
+
JSON
.
stringify
(
result
[
0
]));
try
{
expect
(
result
[
0
])
.
assertContain
(
"main name [ActsShareExtensionAbility]"
);
...
...
@@ -106,7 +107,7 @@ export default function abilityTest() {
await
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_0100'
);
await
globalThis
.
terminateCalledAbility
(
'Acts_ShareExtensionAbility_0100'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0100 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0100 unSubscribeCallback'
);
done
();
},
2000
);
}
...
...
@@ -118,8 +119,8 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: With the same application with the different module, test ShareExtensionAbility lifecycle.
*/
it
(
'Acts_ShareExtensionAbility_0200'
,
0
,
async
function
(
done
)
{
var
subscriber
;
it
(
'Acts_ShareExtensionAbility_0200'
,
0
,
async
function
(
done
)
{
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_EVENT
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0200 createSubscriber ${data}`
);
subscriber
=
data
;
...
...
@@ -138,8 +139,8 @@ export default function abilityTest() {
expect
(
data
.
parameters
.
count
)
.
assertEqual
(
3
);
await
abilityDelegator
.
executeShellCommand
(
'aa dump -a'
)
.
then
((
data
)
=>
{
console
.
info
(
'====>Acts_ShareExtensionAbility_0200 : data : '
+
JSON
.
stringify
(
data
.
stdResult
));
var
firstString
=
data
.
stdResult
.
split
(
"entry/ActsShareExtensionAbility"
);
var
result
=
firstString
[
1
]
.
split
(
"uri"
);
let
firstString
=
data
.
stdResult
.
split
(
"entry/ActsShareExtensionAbility"
);
let
result
=
firstString
[
1
]
.
split
(
"uri"
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0200 result aa string: '
+
JSON
.
stringify
(
result
[
0
]));
try
{
expect
(
result
[
0
])
.
assertContain
(
"main name [ActsShareExtensionAbility]"
);
...
...
@@ -148,7 +149,7 @@ export default function abilityTest() {
expect
(
result
[
0
])
.
assertContain
(
"app state #FOREGROUND"
);
}
catch
{
expect
()
.
assertFail
();
}
;
}
})
setTimeout
(()
=>
{
globalThis
.
context
.
startAbility
({
...
...
@@ -174,7 +175,7 @@ export default function abilityTest() {
await
globalThis
.
featureTerminate
(
'Acts_ShareExtensionAbility_0200'
);
await
globalThis
.
terminateCalledAbility
(
'Acts_ShareExtensionAbility_0200'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0200 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0200 unSubscribeCallback'
);
done
();
},
2000
);
}
...
...
@@ -186,8 +187,8 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: With the different application, test ShareExtensionAbility lifecycle.
*/
it
(
'Acts_ShareExtensionAbility_0300'
,
0
,
async
function
(
done
)
{
var
subscriber
;
it
(
'Acts_ShareExtensionAbility_0300'
,
0
,
async
function
(
done
)
{
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_EVENT
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0300 createSubscriber ${data}`
);
subscriber
=
data
;
...
...
@@ -206,8 +207,8 @@ export default function abilityTest() {
expect
(
data
.
parameters
.
count
)
.
assertEqual
(
3
);
await
abilityDelegator
.
executeShellCommand
(
'aa dump -a'
)
.
then
((
data
)
=>
{
console
.
info
(
'====>Acts_ShareExtensionAbility_0300 : data : '
+
JSON
.
stringify
(
data
.
stdResult
));
var
firstString
=
data
.
stdResult
.
split
(
"entry_assist/ActsShareExtensionAbility"
);
var
result
=
firstString
[
1
]
.
split
(
"uri"
);
let
firstString
=
data
.
stdResult
.
split
(
"entry_assist/ActsShareExtensionAbility"
);
let
result
=
firstString
[
1
]
.
split
(
"uri"
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0300 result aa string: '
+
JSON
.
stringify
(
result
[
0
]));
try
{
expect
(
result
[
0
])
.
assertContain
(
"main name [ActsShareExtensionAbility]"
);
...
...
@@ -241,12 +242,12 @@ export default function abilityTest() {
async
function
unSubscribeCallback
()
{
await
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_0300'
);
var
cmd
=
'aa force-stop com.example.actsshareextensionabilityrely'
;
let
cmd
=
'aa force-stop com.example.actsshareextensionabilityrely'
;
await
abilityDelegator
.
executeShellCommand
(
cmd
)
.
catch
((
error
)
=>
{
console
.
log
(
"====>Acts_ShareExtensionAbility_0300 executeShellCommand error : "
+
JSON
.
stringify
(
error
));
});
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0300 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0300 unSubscribeCallback'
);
done
();
},
2000
);
}
...
...
@@ -258,9 +259,9 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Start the same ShareExtensionAbility with different UI components, and the test is successful.
*/
it
(
'Acts_ShareExtensionAbility_0400'
,
0
,
async
function
(
done
)
{
var
subscriber
;
var
ACTS_MODULE
=
{
it
(
'Acts_ShareExtensionAbility_0400'
,
0
,
async
function
(
done
)
{
let
subscriber
;
let
ACTS_MODULE
=
{
events
:
[
'ACTS_FEATURE_CREATE'
]
};
commonEvent
.
createSubscriber
(
ACTS_MODULE
)
.
then
(
async
(
data
)
=>
{
...
...
@@ -275,7 +276,8 @@ export default function abilityTest() {
expect
(
err
.
code
)
.
assertEqual
(
0
);
})
var
count
=
0
;
let
count
=
0
;
function
subscribeCallBack
(
err
,
data
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0400 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
);
if
(
data
.
event
==
'ACTS_FEATURE_CREATE'
)
{
...
...
@@ -290,7 +292,7 @@ export default function abilityTest() {
await
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_0400'
);
await
globalThis
.
featureTerminate
(
'Acts_ShareExtensionAbility_0400'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0400 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0400 unSubscribeCallback'
);
done
();
},
2000
);
}
...
...
@@ -302,8 +304,8 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Start ShareExtensionAbility with invalid bundleName, start failed.
*/
it
(
'Acts_ShareExtensionAbility_0500'
,
0
,
async
function
(
done
)
{
var
subscriber
;
it
(
'Acts_ShareExtensionAbility_0500'
,
0
,
async
function
(
done
)
{
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_EVENT
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0500 createSubscriber ${data}`
);
subscriber
=
data
;
...
...
@@ -316,20 +318,21 @@ export default function abilityTest() {
expect
(
err
.
code
)
.
assertEqual
(
0
);
})
var
flag
=
true
;
let
flag
=
true
;
function
subscribeCallBack
(
err
,
data
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0500 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
);
if
(
data
.
event
==
'ACTS_TEST_START_ERR'
&&
flag
)
{
flag
=
false
;
expect
(
data
.
parameters
.
err
.
code
)
.
assertEqual
(
1011
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
;
}
}
async
function
unSubscribeCallback
()
{
await
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_0500'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0500 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0500 unSubscribeCallback'
);
done
();
},
2000
);
}
...
...
@@ -341,8 +344,8 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Start ShareExtensionAbility with invalid abilityName, start failed.
*/
it
(
'Acts_ShareExtensionAbility_0600'
,
0
,
async
function
(
done
)
{
var
subscriber
;
it
(
'Acts_ShareExtensionAbility_0600'
,
0
,
async
function
(
done
)
{
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_EVENT
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0600 createSubscriber ${data}`
);
subscriber
=
data
;
...
...
@@ -355,20 +358,21 @@ export default function abilityTest() {
expect
(
err
.
code
)
.
assertEqual
(
0
);
})
var
flag
=
true
;
let
flag
=
true
;
function
subscribeCallBack
(
err
,
data
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0600 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
);
if
(
data
.
event
==
'ACTS_TEST_START_ERR'
&&
flag
)
{
flag
=
false
;
expect
(
data
.
parameters
.
err
.
code
)
.
assertEqual
(
1011
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
;
}
}
function
unSubscribeCallback
()
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_0600'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0600 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0600 unSubscribeCallback'
);
done
();
},
2000
);
}
...
...
@@ -380,8 +384,8 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Start ShareExtensionAbility with invalid parameters, start failed.
*/
it
(
'Acts_ShareExtensionAbility_0700'
,
0
,
async
function
(
done
)
{
var
subscriber
;
it
(
'Acts_ShareExtensionAbility_0700'
,
0
,
async
function
(
done
)
{
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_EVENT
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0700 createSubscriber ${data}`
);
subscriber
=
data
;
...
...
@@ -394,20 +398,21 @@ export default function abilityTest() {
expect
(
err
.
code
)
.
assertEqual
(
0
);
})
var
flag
=
true
;
let
flag
=
true
;
function
subscribeCallBack
(
err
,
data
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0700 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
);
if
(
data
.
event
==
'ACTS_TEST_START_ERR'
&&
flag
)
{
flag
=
false
;
expect
(
data
.
parameters
.
err
.
code
)
.
assertEqual
(
1011
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
;
}
}
function
unSubscribeCallback
()
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_0700'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0700 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0700 unSubscribeCallback'
);
done
();
},
2000
);
}
...
...
@@ -419,13 +424,13 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Test terminateSelfWithResultEvent successful.
*/
it
(
'Acts_ShareExtensionAbility_0800'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_0800'
,
0
,
async
function
(
done
)
{
let
appearEvent
=
'ACTS_UIExtension_AboutToAppear'
;
let
onResultEvent
=
'ACTS_UIExtension_OnResult'
;
let
terminateSelfWithResultEvent
=
'ACTS_UIExtension_TerminateSelfWithResult'
;
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
appearEvent
,
onResultEvent
]
}
await
commonEvent
.
createSubscriber
(
subscribeInfo
)
.
then
(
async
(
data
)
=>
{
...
...
@@ -457,7 +462,7 @@ export default function abilityTest() {
expect
(
result
.
want
.
action
)
.
assertEqual
(
'SHARE'
);
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_0800'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0800 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0800 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -478,13 +483,13 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Test sendData successful.
*/
it
(
'Acts_ShareExtensionAbility_0900'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_0900'
,
0
,
async
function
(
done
)
{
let
appearEvent
=
'ACTS_UIExtension_AboutToAppear'
;
let
onReceiveEvent
=
'ACTS_UIExtension_OnReceive'
;
let
sendDataEvent
=
'ACTS_UIExtension_SendData'
;
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
appearEvent
,
onReceiveEvent
]
}
await
commonEvent
.
createSubscriber
(
subscribeInfo
)
.
then
(
async
(
data
)
=>
{
...
...
@@ -521,7 +526,7 @@ export default function abilityTest() {
expect
(
JSON
.
stringify
(
result
))
.
assertEqual
(
JSON
.
stringify
(
resultCheck
));
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_0900'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_0900 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_0900 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -542,32 +547,32 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Test the startAbility interface in callback form.
*/
it
(
'Acts_ShareExtensionAbility_1000'
,
0
,
async
function
(
done
)
{
var
subscriber
it
(
'Acts_ShareExtensionAbility_1000'
,
0
,
async
function
(
done
)
{
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_CallFunction
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1000 createSubscriber ${data}`
)
subscriber
=
data
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
console
.
info
(
`====>Acts_ShareExtensionAbility_1000 createSubscriber ${data}`
)
;
subscriber
=
data
;
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
;
globalThis
.
context
.
startAbility
({
bundleName
:
'com.example.actsshareextensionabilitytest'
,
abilityName
:
'EntryAbility'
,
action
:
'Acts_ShareExtensionAbility_1000'
},(
err
)
=>
{
},
(
err
)
=>
{
console
.
info
(
'====>Acts_ShareExtensionAbility_1000 startAbility err:'
+
JSON
.
stringify
(
err
));
})
})
function
subscribeCallBack
(
err
,
data
)
{
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1000 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
)
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1000 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
)
;
expect
(
data
.
parameters
.
num
)
.
assertEqual
(
0
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
}
}
function
unSubscribeCallback
()
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1000 unSubscribeCallback 'ACTS_CALL_EVENT'`
)
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1000'
)
console
.
info
(
"====>Acts_ShareExtensionAbility_1000 unSubscribeCallback 'ACTS_CALL_EVENT'"
);
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1000'
)
;
setTimeout
(()
=>
{
done
();
},
2000
);
...
...
@@ -579,23 +584,23 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Test the startAbility interface in promiss form.
*/
it
(
'Acts_ShareExtensionAbility_1100'
,
0
,
async
function
(
done
)
{
var
subscriber
it
(
'Acts_ShareExtensionAbility_1100'
,
0
,
async
function
(
done
)
{
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_CallFunction
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1100 createSubscriber ${data}`
)
subscriber
=
data
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
console
.
info
(
`====>Acts_ShareExtensionAbility_1100 createSubscriber ${data}`
)
;
subscriber
=
data
;
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
;
globalThis
.
context
.
startAbility
({
bundleName
:
'com.example.actsshareextensionabilitytest'
,
abilityName
:
'EntryAbility'
,
action
:
'Acts_ShareExtensionAbility_1100'
},(
err
)
=>
{
},
(
err
)
=>
{
console
.
info
(
'====>Acts_ShareExtensionAbility_1100 startAbility err:'
+
JSON
.
stringify
(
err
));
})
})
function
subscribeCallBack
(
err
,
data
)
{
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1100 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
+
JSON
.
stringify
(
data
))
expect
(
data
.
parameters
.
str
)
.
assertEqual
(
'success'
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
...
...
@@ -603,8 +608,8 @@ export default function abilityTest() {
}
function
unSubscribeCallback
()
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1100 unSubscribeCallback 'ACTS_CALL_EVENT'`
)
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1100'
)
console
.
info
(
"====>Acts_ShareExtensionAbility_1100 unSubscribeCallback 'ACTS_CALL_EVENT'"
);
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1100'
)
;
setTimeout
(()
=>
{
done
();
},
2000
);
...
...
@@ -616,32 +621,32 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Test the startAbility interface with invalid want.
*/
it
(
'Acts_ShareExtensionAbility_1200'
,
0
,
async
function
(
done
)
{
var
subscriber
it
(
'Acts_ShareExtensionAbility_1200'
,
0
,
async
function
(
done
)
{
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_CallFunction
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1200 createSubscriber ${data}`
)
subscriber
=
data
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
console
.
info
(
`====>Acts_ShareExtensionAbility_1200 createSubscriber ${data}`
)
;
subscriber
=
data
;
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
;
globalThis
.
context
.
startAbility
({
bundleName
:
'com.example.actsshareextensionabilitytest'
,
abilityName
:
'EntryAbility'
,
action
:
'Acts_ShareExtensionAbility_1200'
},(
err
)
=>
{
},
(
err
)
=>
{
console
.
info
(
'====>Acts_ShareExtensionAbility_1200 startAbility err:'
+
JSON
.
stringify
(
err
));
})
})
function
subscribeCallBack
(
err
,
data
)
{
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1200 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
+
JSON
.
stringify
(
data
))
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1200 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
+
JSON
.
stringify
(
data
))
;
expect
(
data
.
parameters
.
num
)
.
assertEqual
(
16000001
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
;
}
}
function
unSubscribeCallback
()
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1200 unSubscribeCallback 'ACTS_CALL_EVENT'`
)
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1200'
)
console
.
info
(
"====>Acts_ShareExtensionAbility_1200 unSubscribeCallback 'ACTS_CALL_EVENT'"
);
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1200'
)
;
setTimeout
(()
=>
{
done
();
},
2000
);
...
...
@@ -653,24 +658,24 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Test the startAbilityForResult interface in callback form.
*/
it
(
'Acts_ShareExtensionAbility_1300'
,
0
,
async
function
(
done
)
{
var
subscriber
it
(
'Acts_ShareExtensionAbility_1300'
,
0
,
async
function
(
done
)
{
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_CallFunction
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1300 createSubscriber ${data}`
)
subscriber
=
data
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
console
.
info
(
`====>Acts_ShareExtensionAbility_1300 createSubscriber ${data}`
)
;
subscriber
=
data
;
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
;
globalThis
.
context
.
startAbility
({
bundleName
:
'com.example.actsshareextensionabilitytest'
,
abilityName
:
'EntryAbility'
,
action
:
'Acts_ShareExtensionAbility_1300'
},(
err
)
=>
{
},
(
err
)
=>
{
console
.
info
(
'====>Acts_ShareExtensionAbility_1300 startAbility err:'
+
JSON
.
stringify
(
err
));
})
})
function
subscribeCallBack
(
err
,
data
)
{
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1300 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
)
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1300 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
)
;
expect
(
data
.
parameters
.
str
)
.
assertEqual
(
'SHARE'
);
expect
(
data
.
parameters
.
result
)
.
assertEqual
(
0
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
...
...
@@ -678,7 +683,7 @@ export default function abilityTest() {
}
function
unSubscribeCallback
()
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1300 unSubscribeCallback 'ACTS_CALL_EVENT'`
)
console
.
info
(
"====>Acts_ShareExtensionAbility_1300 unSubscribeCallback 'ACTS_CALL_EVENT'"
);
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1300'
)
setTimeout
(()
=>
{
done
();
...
...
@@ -691,34 +696,34 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Test the startAbilityForResult interface in promiss form.
*/
it
(
'Acts_ShareExtensionAbility_1400'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
)
var
subscriber
it
(
'Acts_ShareExtensionAbility_1400'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
)
;
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_CallFunction
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1400 createSubscriber ${data}`
)
subscriber
=
data
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
console
.
info
(
`====>Acts_ShareExtensionAbility_1400 createSubscriber ${data}`
)
;
subscriber
=
data
;
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
;
globalThis
.
context
.
startAbility
({
bundleName
:
'com.example.actsshareextensionabilitytest'
,
abilityName
:
'EntryAbility'
,
action
:
'Acts_ShareExtensionAbility_1400'
},(
err
)
=>
{
},
(
err
)
=>
{
console
.
info
(
'====>Acts_ShareExtensionAbility_1400 startAbility err:'
+
JSON
.
stringify
(
err
));
})
})
function
subscribeCallBack
(
err
,
data
)
{
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1400 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
)
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1400 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
)
;
expect
(
data
.
parameters
.
str
)
.
assertEqual
(
'SHARE'
);
expect
(
data
.
parameters
.
result
)
.
assertEqual
(
0
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
;
}
}
function
unSubscribeCallback
()
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1400 unSubscribeCallback 'ACTS_CALL_EVENT'`
)
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1400'
)
console
.
info
(
"====>Acts_ShareExtensionAbility_1400 unSubscribeCallback 'ACTS_CALL_EVENT'"
);
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1400'
)
;
setTimeout
(()
=>
{
done
();
},
2000
);
...
...
@@ -730,25 +735,25 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Test the startAbilityForResult interface with invalid want.
*/
it
(
'Acts_ShareExtensionAbility_1500'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_1500'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
let
subscriber
;
commonEvent
.
createSubscriber
(
ACTS_CallFunction
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1500 createSubscriber ${data}`
)
subscriber
=
data
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
console
.
info
(
`====>Acts_ShareExtensionAbility_1500 createSubscriber ${data}`
)
;
subscriber
=
data
;
commonEvent
.
subscribe
(
data
,
subscribeCallBack
)
;
globalThis
.
context
.
startAbility
({
bundleName
:
'com.example.actsshareextensionabilitytest'
,
abilityName
:
'EntryAbility'
,
action
:
'Acts_ShareExtensionAbility_1500'
},(
err
)
=>
{
},
(
err
)
=>
{
console
.
info
(
'====>Acts_ShareExtensionAbility_1400 start Own Ability err:'
+
JSON
.
stringify
(
err
));
})
})
function
subscribeCallBack
(
err
,
data
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1500 subscribeCallBack all ${data.event}`
)
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1500 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`
)
expect
(
data
.
parameters
.
num
)
.
assertEqual
(
16000001
);
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
)
...
...
@@ -756,7 +761,7 @@ export default function abilityTest() {
}
function
unSubscribeCallback
()
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1500 unSubscribeCallback 'ACTS_CALL_EVENT'`
)
console
.
info
(
"====>Acts_ShareExtensionAbility_1500 unSubscribeCallback 'ACTS_CALL_EVENT'"
);
setTimeout
(()
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1500'
)
done
();
...
...
@@ -769,10 +774,10 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Test setReceiveDataCallback successful.
*/
it
(
'Acts_ShareExtensionAbility_1600'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_1600'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'setReceiveDataCallback'
]
}
await
commonEvent
.
createSubscriber
(
subscribeInfo
)
.
then
(
async
(
data
)
=>
{
...
...
@@ -797,7 +802,7 @@ export default function abilityTest() {
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1600'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1600 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_1600 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -811,10 +816,10 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Use ui components continuously to start two ShareExtensionAbility.
*/
it
(
'Acts_ShareExtensionAbility_1700'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_1700'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'setReceiveDataCallback'
]
}
globalThis
.
context
.
startAbility
({
...
...
@@ -836,7 +841,7 @@ export default function abilityTest() {
});
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1700'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1700 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_1700 unSubscribeCallback'
);
done
();
},
2000
);
})
...
...
@@ -846,10 +851,10 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Test starts ShareExtensionAbility using startAbility interface.
*/
it
(
'Acts_ShareExtensionAbility_1800'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_1800'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
await
commonEvent
.
createSubscriber
(
subscribeInfo
)
.
then
(
async
(
data
)
=>
{
...
...
@@ -877,7 +882,7 @@ export default function abilityTest() {
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1800'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1800 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_1800 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -893,8 +898,8 @@ export default function abilityTest() {
*/
it
(
'Acts_ShareExtensionAbility_1900'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
...
...
@@ -913,40 +918,40 @@ export default function abilityTest() {
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
try
{
let
context
=
data
.
parameters
.
context
;
console
.
log
(
`Acts_ShareExtensionAbility_1900 context: `
+
context
+
JSON
.
stringify
(
context
));
console
.
log
(
'Acts_ShareExtensionAbility_1900 context: '
+
context
+
JSON
.
stringify
(
context
));
expect
(
context
!=
null
)
.
assertTrue
();
let
hapModuleInfo
=
context
.
currentHapModuleInfo
;
console
.
log
(
`Acts_ShareExtensionAbility_1900 context: `
+
hapModuleInfo
+
JSON
.
stringify
(
hapModuleInfo
));
console
.
log
(
'Acts_ShareExtensionAbility_1900 context: '
+
hapModuleInfo
+
JSON
.
stringify
(
hapModuleInfo
));
expect
(
hapModuleInfo
!=
null
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_1900 hapModuleInfo.name: `
+
hapModuleInfo
.
name
);
console
.
log
(
'Acts_ShareExtensionAbility_1900 hapModuleInfo.name: '
+
hapModuleInfo
.
name
);
expect
(
hapModuleInfo
.
name
==
"entry"
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_1900 hapModuleInfo.icon: `
+
hapModuleInfo
.
icon
);
console
.
log
(
'Acts_ShareExtensionAbility_1900 hapModuleInfo.icon: '
+
hapModuleInfo
.
icon
);
expect
(
hapModuleInfo
.
icon
==
"
$media
:icon"
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_1900 hapModuleInfo.iconId: `
+
hapModuleInfo
.
iconId
);
console
.
log
(
'Acts_ShareExtensionAbility_1900 hapModuleInfo.iconId: '
+
hapModuleInfo
.
iconId
);
expect
(
typeof
(
hapModuleInfo
.
iconId
)
==
'number'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_1900 hapModuleInfo.label: `
+
hapModuleInfo
.
label
);
console
.
log
(
'Acts_ShareExtensionAbility_1900 hapModuleInfo.label: '
+
hapModuleInfo
.
label
);
expect
(
hapModuleInfo
.
label
==
"
$string
:EntryAbility_label"
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_1900 hapModuleInfo.labelId: `
+
hapModuleInfo
.
labelId
);
console
.
log
(
'Acts_ShareExtensionAbility_1900 hapModuleInfo.labelId: '
+
hapModuleInfo
.
labelId
);
expect
(
typeof
(
hapModuleInfo
.
labelId
)
==
'number'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_1900 hapModuleInfo.description: `
+
hapModuleInfo
.
description
);
console
.
log
(
'Acts_ShareExtensionAbility_1900 hapModuleInfo.description: '
+
hapModuleInfo
.
description
);
expect
(
hapModuleInfo
.
description
==
"
$string
:module_desc"
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_1900 hapModuleInfo.descriptionId: `
+
hapModuleInfo
.
descriptionId
);
console
.
log
(
'Acts_ShareExtensionAbility_1900 hapModuleInfo.descriptionId: '
+
hapModuleInfo
.
descriptionId
);
expect
(
typeof
(
hapModuleInfo
.
descriptionId
)
==
'number'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_1900 hapModuleInfo.mainElementName: `
+
hapModuleInfo
.
mainElementName
);
console
.
log
(
'Acts_ShareExtensionAbility_1900 hapModuleInfo.mainElementName: '
+
hapModuleInfo
.
mainElementName
);
expect
(
hapModuleInfo
.
mainElementName
==
"EntryAbility"
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_1900 hapModuleInfo.metadata: `
+
hapModuleInfo
.
metadata
.
length
);
console
.
log
(
'Acts_ShareExtensionAbility_1900 hapModuleInfo.metadata: '
+
hapModuleInfo
.
metadata
.
length
);
expect
(
hapModuleInfo
.
metadata
.
length
>=
0
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_1900 success`
);
console
.
log
(
'Acts_ShareExtensionAbility_1900 success'
);
done
();
}
catch
(
err
)
{
console
.
log
(
`Acts_ShareExtensionAbility_1900 fail: `
+
err
);
console
.
log
(
'Acts_ShareExtensionAbility_1900 fail: '
+
err
);
expect
()
.
assertFail
();
done
();
}
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_1900'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_1900 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_1900 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -962,8 +967,8 @@ export default function abilityTest() {
*/
it
(
'Acts_ShareExtensionAbility_2100'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
...
...
@@ -984,31 +989,31 @@ export default function abilityTest() {
expect
(
data
.
parameters
.
context
!=
null
)
.
assertTrue
();
let
extensionAbilityInfo
=
data
.
parameters
.
context
.
extensionAbilityInfo
;
expect
(
extensionAbilityInfo
!=
null
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2100 extensionAbilityInfo: `
+
JSON
.
stringify
(
extensionAbilityInfo
));
console
.
log
(
'Acts_ShareExtensionAbility_2100 extensionAbilityInfo: '
+
JSON
.
stringify
(
extensionAbilityInfo
));
expect
(
extensionAbilityInfo
.
bundleName
==
'com.example.actsshareextensionabilitytest'
)
.
assertTrue
();
console
.
log
(
`extensionAbilityInfo.descriptionId: `
+
JSON
.
stringify
(
extensionAbilityInfo
.
descriptionId
));
console
.
log
(
'extensionAbilityInfo.descriptionId: '
+
JSON
.
stringify
(
extensionAbilityInfo
.
descriptionId
));
expect
(
typeof
(
extensionAbilityInfo
.
descriptionId
)
==
'number'
)
.
assertTrue
();
console
.
log
(
`extensionAbilityInfo.enabled: `
+
JSON
.
stringify
(
extensionAbilityInfo
.
enabled
));
console
.
log
(
'extensionAbilityInfo.enabled: '
+
JSON
.
stringify
(
extensionAbilityInfo
.
enabled
));
expect
(
typeof
(
extensionAbilityInfo
.
enabled
)
==
'boolean'
)
.
assertTrue
();
console
.
log
(
`extensionAbilityInfo.exported: `
+
JSON
.
stringify
(
extensionAbilityInfo
.
exported
));
console
.
log
(
'extensionAbilityInfo.exported: '
+
JSON
.
stringify
(
extensionAbilityInfo
.
exported
));
expect
(
typeof
(
extensionAbilityInfo
.
exported
)
==
'boolean'
)
.
assertTrue
();
console
.
log
(
`extensionAbilityInfo.extensionAbilityType: `
+
JSON
.
stringify
(
extensionAbilityInfo
.
extensionAbilityType
));
console
.
log
(
'extensionAbilityInfo.extensionAbilityType: '
+
JSON
.
stringify
(
extensionAbilityInfo
.
extensionAbilityType
));
expect
(
extensionAbilityInfo
.
extensionAbilityType
==
16
)
.
assertTrue
();
console
.
log
(
`extensionAbilityInfo.iconId: `
+
JSON
.
stringify
(
extensionAbilityInfo
.
iconId
));
console
.
log
(
'extensionAbilityInfo.iconId: '
+
JSON
.
stringify
(
extensionAbilityInfo
.
iconId
));
expect
(
typeof
(
extensionAbilityInfo
.
iconId
)
==
'number'
)
.
assertTrue
();
console
.
log
(
`extensionAbilityInfo.isVisible: `
+
JSON
.
stringify
(
extensionAbilityInfo
.
isVisible
));
console
.
log
(
'extensionAbilityInfo.isVisible: '
+
JSON
.
stringify
(
extensionAbilityInfo
.
isVisible
));
expect
(
typeof
(
extensionAbilityInfo
.
isVisible
)
==
'boolean'
)
.
assertTrue
();
console
.
log
(
`extensionAbilityInfo.labelId: `
+
JSON
.
stringify
(
extensionAbilityInfo
.
labelId
));
console
.
log
(
'extensionAbilityInfo.labelId: '
+
JSON
.
stringify
(
extensionAbilityInfo
.
labelId
));
expect
(
typeof
(
extensionAbilityInfo
.
labelId
)
==
'number'
)
.
assertTrue
();
console
.
log
(
`extensionAbilityInfo.moduleName: `
+
JSON
.
stringify
(
extensionAbilityInfo
.
moduleName
));
console
.
log
(
'extensionAbilityInfo.moduleName: '
+
JSON
.
stringify
(
extensionAbilityInfo
.
moduleName
));
expect
(
extensionAbilityInfo
.
moduleName
==
'entry'
)
.
assertTrue
();
console
.
log
(
`extensionAbilityInfo.name: `
+
JSON
.
stringify
(
extensionAbilityInfo
.
name
));
console
.
log
(
'extensionAbilityInfo.name: '
+
JSON
.
stringify
(
extensionAbilityInfo
.
name
));
expect
(
extensionAbilityInfo
.
name
==
'UIExtAbility'
)
.
assertTrue
();
setTimeout
(
async
()
=>
{
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_2100'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_2100 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_2100 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1016,7 +1021,7 @@ export default function abilityTest() {
}
catch
(
err
)
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_2100'
);
setTimeout
(()
=>
{
console
.
log
(
`Acts_ShareExtensionAbility_2100 fail: `
+
err
);
console
.
log
(
'Acts_ShareExtensionAbility_2100 fail: '
+
err
);
expect
()
.
assertFail
();
},
2000
);
}
...
...
@@ -1032,8 +1037,8 @@ export default function abilityTest() {
*/
it
(
'Acts_ShareExtensionAbility_2000'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
...
...
@@ -1055,20 +1060,20 @@ export default function abilityTest() {
expect
(
context
!=
null
)
.
assertTrue
();
let
config
=
context
.
config
;
expect
(
config
!=
null
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2000 config.colorMode: `
+
config
.
colorMode
);
console
.
log
(
'Acts_ShareExtensionAbility_2000 config.colorMode: '
+
config
.
colorMode
);
expect
(
typeof
(
config
.
colorMode
)
==
'number'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2000 config.direction: `
+
config
.
direction
);
console
.
log
(
'Acts_ShareExtensionAbility_2000 config.direction: '
+
config
.
direction
);
expect
(
typeof
(
config
.
direction
)
==
'number'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2000 success`
);
console
.
log
(
'Acts_ShareExtensionAbility_2000 success'
);
}
catch
(
err
)
{
console
.
log
(
`Acts_ShareExtensionAbility_2000 fail: `
+
err
);
console
.
log
(
'Acts_ShareExtensionAbility_2000 fail: '
+
err
);
expect
()
.
assertFail
();
}
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_2000'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_2000 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_2000 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1084,8 +1089,8 @@ export default function abilityTest() {
*/
it
(
'Acts_ShareExtensionAbility_2200'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
...
...
@@ -1108,7 +1113,7 @@ export default function abilityTest() {
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_2200'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_2200 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_2200 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1124,8 +1129,8 @@ export default function abilityTest() {
*/
it
(
'Acts_ShareExtensionAbility_2300'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
...
...
@@ -1142,27 +1147,27 @@ export default function abilityTest() {
commonEvent
.
subscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
console
.
log
(
"SubscribeInfoCallback : "
+
JSON
.
stringify
(
data
));
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
console
.
log
(
`Acts_ShareExtensionAbility_2300 applicationInfo.name: `
+
data
.
parameters
.
name
);
console
.
log
(
'Acts_ShareExtensionAbility_2300 applicationInfo.name: '
+
data
.
parameters
.
name
);
expect
(
data
.
parameters
.
name
==
'com.example.actsshareextensionabilitytest'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2300 applicationInfo.description: `
+
data
.
parameters
.
description_length
);
console
.
log
(
'Acts_ShareExtensionAbility_2300 applicationInfo.description: '
+
data
.
parameters
.
description_length
);
expect
(
data
.
parameters
.
description_length
>=
0
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2300 applicationInfo.descriptionId: `
+
data
.
parameters
.
descriptionId
);
console
.
log
(
'Acts_ShareExtensionAbility_2300 applicationInfo.descriptionId: '
+
data
.
parameters
.
descriptionId
);
expect
(
data
.
parameters
.
descriptionId
==
0
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2300 applicationInfo.label: `
+
data
.
parameters
.
label
);
console
.
log
(
'Acts_ShareExtensionAbility_2300 applicationInfo.label: '
+
data
.
parameters
.
label
);
expect
(
data
.
parameters
.
label
==
'$string:app_name'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2300 applicationInfo.labelId: `
+
data
.
parameters
.
labelId
);
console
.
log
(
'Acts_ShareExtensionAbility_2300 applicationInfo.labelId: '
+
data
.
parameters
.
labelId
);
expect
(
data
.
parameters
.
labelId
!=
null
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2300 applicationInfo.icon: `
+
data
.
parameters
.
icon
);
console
.
log
(
'Acts_ShareExtensionAbility_2300 applicationInfo.icon: '
+
data
.
parameters
.
icon
);
expect
(
data
.
parameters
.
icon
==
'$media:app_icon'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2300 applicationInfo.iconId: `
+
data
.
parameters
.
iconId
);
console
.
log
(
'Acts_ShareExtensionAbility_2300 applicationInfo.iconId: '
+
data
.
parameters
.
iconId
);
expect
(
data
.
parameters
.
iconId
!=
null
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2300 applicationInfo.codePath: `
+
data
.
parameters
.
codePath
);
console
.
log
(
'Acts_ShareExtensionAbility_2300 applicationInfo.codePath: '
+
data
.
parameters
.
codePath
);
expect
(
data
.
parameters
.
codePath
==
'string'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2300 success`
);
console
.
log
(
'Acts_ShareExtensionAbility_2300 success'
);
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_2300'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_2300 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_2300 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1178,8 +1183,8 @@ export default function abilityTest() {
*/
it
(
'Acts_ShareExtensionAbility_2400'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
...
...
@@ -1197,14 +1202,14 @@ export default function abilityTest() {
console
.
log
(
"SubscribeInfoCallback : "
+
JSON
.
stringify
(
data
));
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
let
cacheDir
=
data
.
parameters
.
cacheDir
;
console
.
log
(
`Acts_ShareExtensionAbility_2400 cacheDir:`
+
cacheDir
);
console
.
log
(
'Acts_ShareExtensionAbility_2400 cacheDir:'
+
cacheDir
);
expect
(
typeof
(
cacheDir
)
==
'string'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2400 success`
);
console
.
log
(
'Acts_ShareExtensionAbility_2400 success'
);
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_2400'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_2400 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_2400 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1220,8 +1225,8 @@ export default function abilityTest() {
*/
it
(
'Acts_ShareExtensionAbility_2500'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
...
...
@@ -1239,14 +1244,14 @@ export default function abilityTest() {
console
.
log
(
"SubscribeInfoCallback : "
+
JSON
.
stringify
(
data
));
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
let
tempDir
=
data
.
parameters
.
tempDir
;
console
.
log
(
`Acts_ShareExtensionAbility_2500 tempDir:`
+
tempDir
);
console
.
log
(
'Acts_ShareExtensionAbility_2500 tempDir:'
+
tempDir
);
expect
(
typeof
(
tempDir
)
==
'string'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2500 success`
);
console
.
log
(
'Acts_ShareExtensionAbility_2500 success'
);
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_2500'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_2500 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_2500 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1262,8 +1267,8 @@ export default function abilityTest() {
*/
it
(
'Acts_ShareExtensionAbility_2600'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
...
...
@@ -1281,14 +1286,14 @@ export default function abilityTest() {
console
.
log
(
"SubscribeInfoCallback : "
+
JSON
.
stringify
(
data
));
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
let
filesDir
=
data
.
parameters
.
filesDir
;
console
.
log
(
`Acts_ShareExtensionAbility_2600 filesDir:`
+
filesDir
);
console
.
log
(
'Acts_ShareExtensionAbility_2600 filesDir:'
+
filesDir
);
expect
(
typeof
(
filesDir
)
==
'string'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2600 success`
);
console
.
log
(
'Acts_ShareExtensionAbility_2600 success'
);
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_2600'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_2600 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_2600 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1304,8 +1309,8 @@ export default function abilityTest() {
*/
it
(
'Acts_ShareExtensionAbility_2700'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
...
...
@@ -1323,14 +1328,14 @@ export default function abilityTest() {
console
.
log
(
"SubscribeInfoCallback : "
+
JSON
.
stringify
(
data
));
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
let
databaseDir
=
data
.
parameters
.
databaseDir
;
console
.
log
(
`Acts_ShareExtensionAbility_2700 databaseDir:`
+
databaseDir
);
console
.
log
(
'Acts_ShareExtensionAbility_2700 databaseDir:'
+
databaseDir
);
expect
(
typeof
(
databaseDir
)
==
'string'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2700 success`
);
console
.
log
(
'Acts_ShareExtensionAbility_2700 success'
);
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_2700'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_2700 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_2700 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1346,8 +1351,8 @@ export default function abilityTest() {
*/
it
(
'Acts_ShareExtensionAbility_2800'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
...
...
@@ -1365,14 +1370,14 @@ export default function abilityTest() {
console
.
log
(
"SubscribeInfoCallback : "
+
JSON
.
stringify
(
data
));
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
let
preferencesDir
=
data
.
parameters
.
preferencesDir
;
console
.
log
(
`Acts_ShareExtensionAbility_2800 preferencesDir:`
+
preferencesDir
);
console
.
log
(
'Acts_ShareExtensionAbility_2800 preferencesDir:'
+
preferencesDir
);
expect
(
typeof
(
preferencesDir
)
==
'string'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2800 success`
);
console
.
log
(
'Acts_ShareExtensionAbility_2800 success'
);
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_2800'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_2800 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_2800 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1388,8 +1393,8 @@ export default function abilityTest() {
*/
it
(
'Acts_ShareExtensionAbility_2900'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_CALL_EVENT'
]
}
...
...
@@ -1407,14 +1412,14 @@ export default function abilityTest() {
console
.
log
(
"SubscribeInfoCallback : "
+
JSON
.
stringify
(
data
));
if
(
data
.
event
==
'ACTS_CALL_EVENT'
)
{
let
bundleCodeDir
=
data
.
parameters
.
bundleCodeDir
;
console
.
log
(
`Acts_ShareExtensionAbility_2900 bundleCodeDir:`
+
bundleCodeDir
);
console
.
log
(
'Acts_ShareExtensionAbility_2900 bundleCodeDir:'
+
bundleCodeDir
);
expect
(
typeof
(
bundleCodeDir
)
==
'string'
)
.
assertTrue
();
console
.
log
(
`Acts_ShareExtensionAbility_2900 success`
);
console
.
log
(
'Acts_ShareExtensionAbility_2900 success'
);
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_2900'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_2900 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_2900 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1428,10 +1433,10 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Context calls createModuleContext, passing in the moduleName of the current application hap1
*/
it
(
'Acts_ShareExtensionAbility_3000'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_3000'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_TEST_CONTEXT'
]
};
await
commonEvent
.
createSubscriber
(
subscribeInfo
)
.
then
(
async
(
data
)
=>
{
...
...
@@ -1454,7 +1459,7 @@ export default function abilityTest() {
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3000'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_3000 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_3000 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1462,7 +1467,7 @@ export default function abilityTest() {
}
catch
(
err
)
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3000'
);
setTimeout
(()
=>
{
console
.
log
(
`Acts_ShareExtensionAbility_3000 fail: `
+
err
);
console
.
log
(
'Acts_ShareExtensionAbility_3000 fail: '
+
err
);
expect
()
.
assertFail
();
},
2000
);
}
...
...
@@ -1476,10 +1481,10 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Context calls createModuleContext, passing in the moduleName of the current application hap2
*/
it
(
'Acts_ShareExtensionAbility_3100'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_3100'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_TEST_CONTEXT'
]
};
await
commonEvent
.
createSubscriber
(
subscribeInfo
)
.
then
(
async
(
data
)
=>
{
...
...
@@ -1502,7 +1507,7 @@ export default function abilityTest() {
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3000'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_3000 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_3000 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1510,7 +1515,7 @@ export default function abilityTest() {
}
catch
(
err
)
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3100'
);
setTimeout
(()
=>
{
console
.
log
(
`Acts_ShareExtensionAbility_3100 fail: `
+
err
);
console
.
log
(
'Acts_ShareExtensionAbility_3100 fail: '
+
err
);
expect
()
.
assertFail
();
},
2000
);
}
...
...
@@ -1524,10 +1529,10 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Context calls createModuleContext, passing in the moduleName of the cross-application hap1
*/
it
(
'Acts_ShareExtensionAbility_3200'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_3200'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_TEST_CONTEXT'
]
};
await
commonEvent
.
createSubscriber
(
subscribeInfo
)
.
then
(
async
(
data
)
=>
{
...
...
@@ -1549,7 +1554,7 @@ export default function abilityTest() {
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3200'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_3200 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_3200 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1557,7 +1562,7 @@ export default function abilityTest() {
}
catch
(
err
)
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3200'
);
setTimeout
(()
=>
{
console
.
log
(
`Acts_ShareExtensionAbility_3200 fail: `
+
err
);
console
.
log
(
'Acts_ShareExtensionAbility_3200 fail: '
+
err
);
expect
()
.
assertFail
();
},
2000
);
}
...
...
@@ -1571,10 +1576,10 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Context calls createModuleContext, passing in a non-existing moduleName
*/
it
(
'Acts_ShareExtensionAbility_3300'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_3300'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_TEST_CONTEXT'
]
};
await
commonEvent
.
createSubscriber
(
subscribeInfo
)
.
then
(
async
(
data
)
=>
{
...
...
@@ -1596,7 +1601,7 @@ export default function abilityTest() {
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3300'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_3300 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_3300 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1604,7 +1609,7 @@ export default function abilityTest() {
}
catch
(
err
)
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3300'
);
setTimeout
(()
=>
{
console
.
log
(
`Acts_ShareExtensionAbility_3300 fail: `
+
err
);
console
.
log
(
'Acts_ShareExtensionAbility_3300 fail: '
+
err
);
expect
()
.
assertFail
();
},
2000
);
}
...
...
@@ -1618,10 +1623,10 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: Context calls createModuleContext, and the incoming moduleName is undefined
*/
it
(
'Acts_ShareExtensionAbility_3400'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_3400'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_TEST_CONTEXT'
]
};
await
commonEvent
.
createSubscriber
(
subscribeInfo
)
.
then
(
async
(
data
)
=>
{
...
...
@@ -1643,7 +1648,7 @@ export default function abilityTest() {
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3400'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_3400 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_3400 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1651,7 +1656,7 @@ export default function abilityTest() {
}
catch
(
err
)
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3400'
);
setTimeout
(()
=>
{
console
.
log
(
`Acts_ShareExtensionAbility_3400 fail: `
+
err
);
console
.
log
(
'Acts_ShareExtensionAbility_3400 fail: '
+
err
);
expect
()
.
assertFail
();
},
2000
);
}
...
...
@@ -1665,10 +1670,10 @@ export default function abilityTest() {
* @tc.name: Test ShareExtensionAbility basic function.
* @tc.desc: test getApplicationContext return not empty
*/
it
(
'Acts_ShareExtensionAbility_3500'
,
0
,
async
function
(
done
)
{
it
(
'Acts_ShareExtensionAbility_3500'
,
0
,
async
function
(
done
)
{
await
Driver
.
create
()
.
delayMs
(
2000
);
var
subscriber
;
var
subscribeInfo
=
{
let
subscriber
;
let
subscribeInfo
=
{
events
:
[
'ACTS_TEST_CONTEXT'
]
};
await
commonEvent
.
createSubscriber
(
subscribeInfo
)
.
then
(
async
(
data
)
=>
{
...
...
@@ -1690,7 +1695,7 @@ export default function abilityTest() {
commonEvent
.
unsubscribe
(
subscriber
,
async
(
err
,
data
)
=>
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3500'
);
setTimeout
(()
=>
{
console
.
info
(
`====>Acts_ShareExtensionAbility_3500 unSubscribeCallback`
);
console
.
info
(
'====>Acts_ShareExtensionAbility_3500 unSubscribeCallback'
);
done
();
},
2000
);
});
...
...
@@ -1698,7 +1703,7 @@ export default function abilityTest() {
}
catch
(
err
)
{
globalThis
.
terminate
(
'Acts_ShareExtensionAbility_3500'
);
setTimeout
(()
=>
{
console
.
log
(
`Acts_ShareExtensionAbility_3500 fail: `
+
err
);
console
.
log
(
'Acts_ShareExtensionAbility_3500 fail: '
+
err
);
expect
()
.
assertFail
();
},
2000
);
}
...
...
@@ -1706,6 +1711,5 @@ export default function abilityTest() {
});
})
})
})
}
\ No newline at end of file
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/testability/TestAbility.ets
浏览文件 @
02a6eeb8
...
...
@@ -23,11 +23,11 @@ export default class TestAbility extends UIAbility {
onCreate(want, launchParam) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'
+ JSON.stringify(launchParam) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'
+ JSON.stringify(launchParam) ?? '');
globalThis.context = this.context;
var
abilityDelegator: any
let
abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var
abilityDelegatorArguments: any
let
abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/testability/pages/Index.ets
浏览文件 @
02a6eeb8
...
...
@@ -20,7 +20,9 @@ struct Index {
aboutToAppear() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
}
@State message: string = 'Hello World';
build() {
Row() {
Column() {
...
...
@@ -31,18 +33,19 @@ struct Index {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
}
.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>
{
.onClick(() =>
{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录