Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a30b837d
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看板
未验证
提交
a30b837d
编写于
7月 31, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 31, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9401 【元能力】提供共享沙箱路径xts补充
Merge pull request !9401 from wangkailong/getcontextdir
上级
e0ad68d5
12285b41
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
201 addition
and
0 deletion
+201
-0
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/ets/entryability/EntryAbility.ts
...oupdirhap/entry/src/main/ets/entryability/EntryAbility.ts
+14
-0
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/ets/entryability2/EntryAbility2.ts
...pdirhap/entry/src/main/ets/entryability2/EntryAbility2.ts
+58
-0
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/module.json
...roupdirtest/actsgetgroupdirhap/entry/src/main/module.json
+8
-0
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/resources/base/element/string.json
...pdirhap/entry/src/main/resources/base/element/string.json
+8
-0
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/resources/en_US/element/string.json
...dirhap/entry/src/main/resources/en_US/element/string.json
+8
-0
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/resources/zh_CN/element/string.json
...dirhap/entry/src/main/resources/zh_CN/element/string.json
+8
-0
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/signature/openharmony_sx.p7b
...updirtest/actsgetgroupdirhap/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirtest/entry/src/main/ets/test/ActsGetgroupdirTest.test.ets
...test/entry/src/main/ets/test/ActsGetgroupdirTest.test.ets
+91
-0
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirtest/entry/src/main/module.json
...oupdirtest/actsgetgroupdirtest/entry/src/main/module.json
+6
-0
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirtest/signature/openharmony_sx.p7b
...pdirtest/actsgetgroupdirtest/signature/openharmony_sx.p7b
+0
-0
未找到文件。
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/ets/entryability/EntryAbility.ts
浏览文件 @
a30b837d
...
...
@@ -15,6 +15,7 @@
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
;
import
commonEvent
from
'
@ohos.commonEventManager
'
;
import
Window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
Ability
{
...
...
@@ -23,6 +24,19 @@ export default class EntryAbility extends Ability {
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onCreate
'
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
want param:
'
+
JSON
.
stringify
(
want
)
??
''
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
launchParam:
'
+
JSON
.
stringify
(
launchParam
)
??
''
);
this
.
context
.
getGroupDir
(
'
context_hap1
'
).
then
(
data
=>
{
let
commonEventData
=
{
parameters
:{
res
:
data
,
}
};
console
.
error
(
'
getgroupdirhap2 getGroupDir ====> result data
'
+
data
);
commonEvent
.
publish
(
'
ACTS_GETGROUP1_EVENT
'
,
commonEventData
,
(
err
)
=>
{
console
.
log
(
'
getgroupdirhap2 getGroupDir publish err:
'
+
JSON
.
stringify
(
err
));
});
}).
catch
((
error
)
=>
{
console
.
error
(
'
getgroupdirhap2 getGroupDir ====> result err
'
+
JSON
.
stringify
(
error
));
});
}
onDestroy
()
{
...
...
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/ets/entryability2/EntryAbility2.ts
0 → 100755
浏览文件 @
a30b837d
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.app.ability.UIAbility
'
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
));
}
export
default
class
EntryAbility2
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
this
.
context
.
getGroupDir
(
'
context_hap2
'
).
then
(
data
=>
{
let
commonEventData
=
{
parameters
:{
res
:
data
,
}
};
console
.
error
(
'
getgroupdirhap2 getGroupDir ====> result data
'
+
data
);
commonEvent
.
publish
(
'
ACTS_GETGROUP2_EVENT
'
,
commonEventData
,
(
err
)
=>
{
console
.
log
(
'
getgroupdirhap2 getGroupDir publish err:
'
+
JSON
.
stringify
(
err
));
});
}).
catch
((
error
)
=>
{
console
.
error
(
'
getgroupdirhap2 getGroupDir ====> result err
'
+
JSON
.
stringify
(
error
));
});
}
onDestroy
()
{
console
.
log
(
'
[Demo] EntryAbility2 onDestroy
'
);
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
[Demo] EntryAbility2 onWindowStageCreate
'
);
windowStage
.
setUIContent
(
this
.
context
,
'
pages/Index
'
,
null
);
}
onWindowStageDestroy
()
{
console
.
log
(
'
[Demo] EntryAbility2 onWindowStageDestroy
'
);
}
onForeground
()
{
console
.
log
(
'
[Demo] EntryAbility2 onForeground
'
);
}
onBackground
()
{
console
.
log
(
'
[Demo] EntryAbility2 onBackground
'
);
}
};
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/module.json
浏览文件 @
a30b837d
...
...
@@ -31,6 +31,14 @@
]
}
]
},
{
"name"
:
"EntryAbility2"
,
"srcEntrance"
:
"./ets/entryability2/EntryAbility2.ts"
,
"description"
:
"$string:EntryAbility2_desc"
,
"icon"
:
"$media:icon"
,
"visible"
:
true
,
"label"
:
"$string:EntryAbility2_label"
}
]
}
...
...
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/resources/base/element/string.json
浏览文件 @
a30b837d
...
...
@@ -11,6 +11,14 @@
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"EntryAbility2_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility2_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/resources/en_US/element/string.json
浏览文件 @
a30b837d
...
...
@@ -11,6 +11,14 @@
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"EntryAbility2_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility2_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/entry/src/main/resources/zh_CN/element/string.json
浏览文件 @
a30b837d
...
...
@@ -11,6 +11,14 @@
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"EntryAbility2_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility2_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirhap/signature/openharmony_sx.p7b
浏览文件 @
a30b837d
无法预览此类型文件
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirtest/entry/src/main/ets/test/ActsGetgroupdirTest.test.ets
浏览文件 @
a30b837d
...
...
@@ -15,6 +15,11 @@
import hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import commonEvent from '@ohos.commonEventManager'
var ACTS_GetGroupFunction = {
events: ['ACTS_GETGROUP1_EVENT', 'ACTS_GETGROUP2_EVENT']
};
export default function ActsGetgroupdirTest() {
describe('ActsGetgroupdirTest', function () {
...
...
@@ -127,5 +132,91 @@ export default function ActsGetgroupdirTest() {
done();
})
})
/*
* @tc.number AMS_getGroupDir_007
* @tc.name getGroupDir
* @tc.desc Function test
* @tc.level 0
*/
it('AMS_getGroupDir_007',0, async function (done) {
var subscriber;
var res;
console.log("start AMS_getGroupDir_007 =====>");
commonEvent.createSubscriber(ACTS_GetGroupFunction).then(async (data) => {
console.debug('====>AMS_getGroupDir_007 Create Subscribe');
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
await globalThis.myContext.getGroupDir("context_hap1", (err, data) => {
res = data;
expect(err).assertNull();
})
globalThis.myContext.startAbility({
bundleName: 'com.example.getgroupdirhap2',
abilityName: 'EntryAbility',
moduleName: 'entry',
},(err) => {
console.debug('====>AMS_getGroupDir_007 startAbility err:' + JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
console.debug('====>AMS_getGroupDir_007 subscribeCallBack data:' + JSON.stringify(data));
if (data.event === 'ACTS_GETGROUP1_EVENT') {
expect(data.parameters.res).assertContain("/data/storage/el2/group");
expect(data.parameters.res === res).assertFalse();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
console.debug('====>AMS_getGroupDir_007 unSubscribeCallback');
done();
}
})
/*
* @tc.number AMS_getGroupDir_008
* @tc.name getGroupDir
* @tc.desc Function test
* @tc.level 0
*/
it('AMS_getGroupDir_008',0, async function (done) {
var subscriber;
var res;
console.log("start AMS_getGroupDir_008 =====>");
commonEvent.createSubscriber(ACTS_GetGroupFunction).then(async (data) => {
console.debug('====>AMS_getGroupDir_008 Create Subscribe');
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
await globalThis.myContext.getGroupDir("context_hap2", (err, data) => {
res = data;
expect(err).assertNull();
})
globalThis.myContext.startAbility({
bundleName: 'com.example.getgroupdirhap2',
abilityName: 'EntryAbility2',
moduleName: 'entry',
},(err) => {
console.debug('====>AMS_getGroupDir_008 startAbility err:' + JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
console.debug('====>AMS_getGroupDir_008 subscribeCallBack data:' + JSON.stringify(data));
if (data.event === 'ACTS_GETGROUP2_EVENT') {
expect(data.parameters.res).assertContain("/data/storage/el2/group");
expect(data.parameters.res).assertEqual(res);
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
console.debug('====>AMS_getGroupDir_008 unSubscribeCallback');
done();
}
})
})
}
\ No newline at end of file
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirtest/entry/src/main/module.json
浏览文件 @
a30b837d
...
...
@@ -42,6 +42,12 @@
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:start_window_background"
}
],
"requestPermissions"
:
[
{
"name"
:
"ohos.permission.START_ABILITIES_FROM_BACKGROUND"
,
"reason"
:
"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
}
\ No newline at end of file
ability/ability_runtime/stage/actsgetgroupdirtest/actsgetgroupdirtest/signature/openharmony_sx.p7b
浏览文件 @
a30b837d
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录