提交 587b5dca 编写于 作者: Z zhaoyuan17

Update xts code 1213

Signed-off-by: Nzhaoyuan17 <zhaoyuan17@huawei.com>
上级 a8dd248a
......@@ -22,6 +22,24 @@ group("aafwk_standard") {
"amsabilitymanager/amsMissionSnapshotTestSingleton:amsMissionSnapshotTestSingleton",
"amsabilitymanager/amsMissionSnapshotTestSingletonS:amsMissionSnapshotTestSingletonS",
"amsdatauriutils:ActsAmsDataUriUtilsTest",
"amsmultiapp/MultiAppPage:ActsAmsMultiPageApp",
"amsmultiapp/MultiAppPageConnectService:ActsAmsMultiPageAppConnectService",
"amsmultiapp/MultiAppPageConnect_Service:ActsAmsMultiAppPageConnectService",
"amsmultiapp/MultiAppPagePermission:ActsAmsMultiPageAppPermission",
"amsmultiapp/MultiAppPagePermission_Page:ActsAmsMultiAppPagePermission",
"amsmultiapp/MultiAppPage_PSS:ActsAmsMultiPageAppS",
"amsmultiapp/MultiAppPage_Page:ActsAmsMultiAppPage",
"amsmultiapp/MultiAppPage_Service:ActsAmsMultiAppPageService",
"amsmultiapp/MultiAppSimultaneousOnline:ActsAmsMultiAppSimultaneousOnline",
"amsmultiapp/MultiAppSimultaneousOnline_test:ActsAmsMultiAppPageClone",
"amsmultiapp/MultiAppTermination:ActsAmsMultiAppTermination",
"amsmultiapp/MultiAppTermination_test:ActsAmsMultiAppPageCloneTermination",
"amsmultiapp/amsmultiapppageexecutor:MultiAppPageExecutor",
"amsmultiapp/amsmultiappserviceexecutor:MultiAppServiceExecutor",
"amsmultiapp/amsmultiappservicestarter:MultiAppServiceStarter",
"amsmultiapp/amsmultiapptester:MultiAppTester",
"amsmultiapp/amsmultidataabilityclone:amsMultiDataAbilityClone",
"amsmultiapp/amsmultidataabilityself:amsMultiDataAbilitySelf",
"amszipfileunzipfilest:ActsAmsZipfileUnzipfileSTest",
"context:context",
"featureability:featureability",
......
{
"description": "Configuration for hjunit demo Tests"
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "18000",
"package": "com.amsst.amsMissionSnapshotTest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"amsMissionSnapshotTest.hap",
"amsMissionSnapshotTestSingleton.hap",
"amsMissionSnapshotTestSingletonS.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
......@@ -31,11 +31,13 @@ export default {
},
onShow() {
console.debug('ACTS_MissionSnapshot_onShow');
commonEvent.publish("ACTS_MissionSnapshot_onShow", (err,data) =>{
console.debug("=ACTS_MissionSnapshot_onShow err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
});
setTimeout(()=>{
commonEvent.publish("ACTS_MissionSnapshot_onShow", (err,data) =>{
console.debug("=ACTS_MissionSnapshot_onShow err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
});
}, 3000);
},
}
\ No newline at end of file
......@@ -31,11 +31,13 @@ export default {
},
onShow() {
console.debug('ACTS_MissionSnapshot_onShow');
setTimeout(()=>{
commonEvent.publish("ACTS_MissionSnapshot_onShow", (err,data) =>{
console.debug("=ACTS_MissionSnapshot_onShow err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
});
}, 3000);
},
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiPageApp") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiPageApp"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultipageapp",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiPageApp.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultipageapp",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultipageapp",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultipageapp.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import commonEvent from '@ohos.commonevent'
describe('ActsAmsMultiPageApp', function () {
console.info('----ActsAmsMultiPageApp----');
beforeAll(async function (done) {
await featureAbility.startAbility(
{
want:
{
bundleName: "com.example.actsamsmultiapppage",
abilityName: "com.example.actsamsmultiapppage.MainAbility",
},
},
);
});
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiPageAppConnectService") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiPageAppConnectService"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultipageappconnectservice",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiPageAppConnectService.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultipageappconnectservice",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultipageappconnectservice",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultipageappconnectservice.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
MultiAppPageConnectServiceA
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bundle from "@ohos.bundle"
import featureAbility from '@ohos.ability.featureability'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import commonEvent from '@ohos.commonevent'
describe('ActsAmsMultiPageAppConnectService', function () {
console.info('----ActsAmsMultiPageAppConnectService----');
beforeAll(async function (done) {
console.info('----ActsAmsMultiPageAppConnectService----');
var connId = await featureAbility.connectAbility(
{
bundleName: "com.example.actsamsmultiapppageconnectservice",
abilityName: "com.example.actsamsmultiapppageconnectservice.MainAbility",
},
{
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback,
},
);
console.log('ActsAmsMultiPageAppConnectService ConnectAbility connId : ' + connId);
done();
function onConnectCallback(element, remote) {
console.log('ActsAmsMultiPageAppConnectService ConnectAbility onConnect element.deviceId : '
+ element.deviceId)
console.log('ActsAmsMultiPageAppConnectService ConnectAbility onConnect element.bundleName : '
+ element.bundleName)
console.log('ActsAmsMultiPageAppConnectService ConnectAbility onConnect element.abilityName : '
+ element.abilityName)
console.log('ActsAmsMultiPageAppConnectService ConnectAbility onConnect remote : ' + remote);
console.log('ActsAmsMultiPageAppConnectService ConnectAbility onConnect remote 是否为proxy:'
+ (remote instanceof rpc.RemoteProxy));
}
function onDisconnectCallback(element) {
commonEvent.publish("DISCONNECT", ()=>{console.log('disconnect finish')});
console.log('ActsAmsMultiPageAppConnectService ConnectAbility onDisconnect element.deviceId : '
+ element.deviceId)
console.log('ActsAmsMultiPageAppConnectService ConnectAbility onDisconnect element.bundleName : '
+ element.bundleName)
console.log('ActsAmsMultiPageAppConnectService ConnectAbility onDisconnect element.abilityName : '
+ element.abilityName)
}
function onFailedCallback(code) {
console.log('ActsAmsMultiPageAppConnectService ConnectAbility onFailed errCode : ' + code)
}
});
/*
* @tc.number : AMS_MultiApp_0300
* @tc.name : connectAbility : connect pageAbility
* @tc.desc : pageAbility->serviceAbility
*/
it('AMS_MultiApp_0300', 0, async function (done) {
var subscriber;
var CommonEventSubscribeInfo = {
events: ["ACTS_MultiAppPageConnectService_onConnect1",
"ACTS_MultiAppPageConnectService_onConnect2"],
};
function unsubscribe(caller, subscriber) {
commonEvent.unsubscribe(subscriber, (err, data) => {
console.debug("=ACTS_MissionSnapshot_unsubscribe (err,data)=======>"
+ (caller)
+ (" , json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
done();
});
}
commonEvent.createSubscriber(CommonEventSubscribeInfo).then(async (data) => {
console.debug("=AMS_MultiApp_0300 createSubscriber .then(data)=======>"
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,data=" + data);
subscriber = data;
await commonEvent.subscribe(subscriber, async (err, data) => {
console.debug("=AMS_MultiApp_0300 subscribe (err,data)=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
if (data.event == "ACTS_MultiAppPageConnectService_onConnect2")
{
console.debug("=======AMS_MultiApp_0300 Ontology=======");
expect(data.event).assertEqual("ACTS_MultiAppPageConnectService_onConnect2");
}
else if (data.event == "ACTS_MultiAppPageConnectService_onConnect1")
{
console.debug("=======AMS_MultiApp_0300 Clone=======");
expect(data.event).assertEqual("ACTS_MultiAppPageConnectService_onConnect1");
}
unsubscribe("subscribe", subscriber);
});
});
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiAppPageConnectService") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiAppPageConnectService"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultiapppageconnectservice",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiAppPageConnectService.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultiapppageconnectservice",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultiapppageconnectservice",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultiapppageconnectservice.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "service",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
MultiAppPageConnectServiceB
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
import rpc from "@ohos.rpc"
import commonEvent from '@ohos.commonevent'
import particleAbility from '@ohos.ability.particleability'
import bundle from "@ohos.bundle"
let mMyStub;
const MIN_CLONEUID = 20000000;
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish ')
},
onStart(want) {
console.debug('AMS_MultiApp ====>onStart'
+ want + " , JSON." + JSON.stringify(want));
class MyStub extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, message, reply, option) {
console.log("AMS_MultiApp code:" + code);
if (code === 1) {
let getContextObject = rpc.IPCSkeleton.getContextObject();
let getCallingPid = rpc.IPCSkeleton.getCallingPid();
let getCallingUid = rpc.IPCSkeleton.getCallingUid();
let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID();
let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID();
let isLocalCalling = rpc.IPCSkeleton.isLocalCalling();
let remoteObject = new rpc.RemoteObject("aaa", 3);
let flushCommands = rpc.IPCSkeleton.flushCommands(remoteObject);
let resetCallingIdentity = rpc.IPCSkeleton.resetCallingIdentity();
let setCallingIdentity = rpc.IPCSkeleton.setCallingIdentity("aaa", 3);
let num = message.readInt();
let msg = message.readString();
console.log("num is " + num + "msg is " + msg);
reply.writeString("Success");
return true;
}
}
}
mMyStub = new MyStub("ServiceAbility-test");
},
async onConnect(want) {
console.info('onConnect finish')
console.info('AMS_MultiApp_0800 want'
+ JSON.stringify(want));
console.info('particleAbility--------------------------1');
var featureData = await particleAbility.getWant();
console.info('particleAbility--------------------------2');
console.info('AMS_MultiApp_0800 featureData' + featureData);
console.info('AMS_MultiApp_0800 featureData' + JSON.stringify(featureData));
console.info('AMS_MultiApp_0800 featureData-->bundleName' + featureData.bundleName);
var flag=0;
if((featureData.bundleName) == ("com.example.actsamsmultiapppageconnectservice"))
{
if ((featureData.abilityName) == ("com.example.actsamsmultiapppageconnectservice.MainAbility"))
{
flag = 1;
}
}
console.info('AMS_MultiApp_0800 flag' + JSON.stringify(flag));
var info = await particleAbility.getAbilityInfo();
console.info('AMS_MultiApp_0800 particleAbility.getAbilityInfo() '
+ JSON.stringify(info));
console.info('AMS_MultiApp_0800 particleAbility.getAbilityInfo() '
+ info);
console.info('AMS_MultiApp_0800 particleAbility.getAbilityInfo() '
+ JSON.stringify(info.applicationInfo));
bundle.getBundleInfo("com.example.actsamsmultiapppageconnectservice", 1, async(err, data) => {
console.info('AMS_MultiApp_0800 bundle.getBundleInfo '
+ JSON.stringify(data));
if (data.uid >= MIN_CLONEUID) {
console.info('AMS_MultiApp_0800 Clone info ' + JSON.stringify(info.applicationInfo));
if (info.applicationInfo.isCloned == true)
{
flag = 1;
}
} else {
console.info('AMS_MultiApp_0800 Ontology info ' + JSON.stringify(info.applicationInfo));
if (info.applicationInfo.isCloned == false)
{
flag = 2;
}
}
commonEvent.publish("ACTS_MultiAppPageConnectService_onConnect" + flag, err =>{
console.info('AMS_MultiApp resultflag' + JSON.stringify(flag));
console.debug("=ACTS_MultiAppPageConnectService_onConnect err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json flag【") + JSON.stringify(flag) + ("")
+ " ,err=" + err + " ,flag=" + flag);
});
return mMyStub;
})
},
onCommand(want,restart,startId) {
console.info('onCommand finish')
commonEvent.publish("ACTS_MultiAppPageConnectService_onCommand", (err,data) =>{
console.debug("=ACTS_MultiAppPageConnectService_onCommand err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
});
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiPageAppPermission") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiPageAppPermission"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultipageapppermission",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiPageAppPermission.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultipageapppermission",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultipageapppermission",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultipageapppermission.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
MultiAppPagePermissionA
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import commonEvent from '@ohos.commonevent'
var subscriberInfoStartAbility = {
events: ["ACTS_StartAbility_CommonEvent"],
};
describe('ActsAmsMultiAppPermission', function () {
console.info('----ActsAmsMultiAppPermission----');
/*
* @tc.number : AMS_MultiApp_Permission_Verification_0100
* @tc.name : startAbility : start pageAbility
* @tc.desc : pageAbility start pageAbility without permission
*/
it('AMS_MultiApp_Permission_Verification_0100', 0, async function (done) {
var subscriber;
commonEvent.createSubscriber(subscriberInfoStartAbility).then(async (data) => {
console.debug("====>Create Subscriber====>");
subscriber = data;
console.debug("====>Create Subscriber====> subscriber" + subscriber);
await commonEvent.subscribe(subscriber, subscribeCallBack);
})
await featureAbility.startAbility(
{
want:
{
bundleName: "com.example.actsamsmultiapppagepermission",
abilityName: "com.example.actsamsmultiapppagepermission.MainAbility",
},
},
);
function subscribeCallBack(err, data) {
console.debug("====>subscribeCallBack====> data.event " + data.event);
expect(data.event).assertEqual("ACTS_StartAbility_CommonEvent error");
done();
}
setTimeout(()=>{
unsubscribe("subscribe", subscriber);
expect("true").assertEqual("true");
}, 5000);
function unsubscribe(caller, subscriber) {
commonEvent.unsubscribe(subscriber, (err, data) => {
console.debug("=ACTS_AmsMultiAppPermission_unsubscribe (err,data)=======>"
+ (caller)
+ (" , json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
done();
});
}
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiAppPagePermission") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiAppPagePermission"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultiapppagepermission",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiAppPagePermission.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultiapppagepermission",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultiapppagepermission",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultiapppagepermission.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
import commonEvent from '@ohos.commonevent'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish LJ')
commonEvent.publish("ACTS_StartAbility_CommonEvent", (err,data) =>{
console.debug("=ACTS_StartAbility_CommonEvent err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
});
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiPageAppS") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiPageAppS"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultipageapps",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiPageAppS.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultipageapps",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultipageapps",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultipageapps.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
MultiAppPageStartServiceA
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import commonEvent from '@ohos.commonevent'
describe('ActsAmsMultiPageAppS', function () {
console.info('----ActsAmsMultiPageAppS----');
beforeAll(async function (done) {
await featureAbility.startAbility(
{
want:
{
bundleName: "com.example.actsamsmultipageappservice",
abilityName: "com.example.actsamsmultipageappservice.MainAbility",
},
},
);
done();
});
/*
* @tc.number : AMS_MultiApp_0200
* @tc.name : startAbility : start serviceAbility
* @tc.desc : pageAbility->ServiceAbility
*/
it('AMS_MultiApp_0200', 0, async function (done) {
var subscriber;
var CommonEventSubscribeInfo = {
events: ["ACTS_MultiAppPageService_onConnect1","ACTS_MultiAppPageService_onConnect2"],
};
commonEvent.createSubscriber(CommonEventSubscribeInfo).then(async (data) => {
console.debug("=AMS_MultiApp_0200 createSubscriber .then(data)=======>"
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,data=" + data);
subscriber = data;
commonEvent.subscribe(subscriber, async (err, data) => {
console.debug("=AMS_MultiApp_0200 subscribe (err,data)=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
if (data.event == "ACTS_MultiAppPageService_onConnect2")
{
console.debug("=======AMS_MultiApp_0200 Ontology=======");
expect(data.event).assertEqual("ACTS_MultiAppPageService_onConnect2");
}
else if (data.event == "ACTS_MultiAppPageService_onConnect1")
{
console.debug("=======AMS_MultiApp_0200 Clone=======");
expect(data.event).assertEqual("ACTS_MultiAppPageService_onConnect1");
}
unsubscribe("subscribe", subscriber);
});
})
function unsubscribe(caller, subscriber) {
commonEvent.unsubscribe(subscriber, (err, data) => {
console.debug("=ACTS_MultiAppPageService_unsubscribe (err,data)=======>"
+ (caller)
+ (" , json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
done();
});
}
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiAppPage") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiAppPage"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultiapppage",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiAppPage.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultiapppage",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultiapppage",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultiapppage.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import bundle from "@ohos.bundle"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const MIN_CLONEUID = 20000000;
describe('ActsAmsMultiAppPage', function () {
console.info('----ActsAmsMultiAppPage----');
/*
* @tc.number : AMS_MultiApp_0100
* @tc.name : startAbility : start pageAbility
* @tc.desc : pageAbility->pageAbility
*/
it('AMS_MultiApp_0100', 0, async function (done) {
var data = await featureAbility.getWant();
expect(data.bundleName).assertEqual("com.example.actsamsmultiapppage");
expect(data.abilityName).assertEqual("com.example.actsamsmultiapppage.MainAbility");
console.info('AMS_MultiApp_0100 data.bundleName '
+ JSON.stringify(data.bundleName));
console.info('AMS_MultiApp_0100 data.abilityName '
+ JSON.stringify(data.abilityName));
var info = await featureAbility.getAbilityInfo();
bundle.getBundleInfo("com.example.actsamsmultiapppage", 1, (err, data) => {
console.debug("=AMS_MultiApp_0100 err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
console.info('AMS_MultiApp Clone info.applicationInfo '
+ JSON.stringify(info.applicationInfo));
if (data.uid >= MIN_CLONEUID) {
console.info('AMS_MultiApp_0100 Clone info.applicationInfo.isCloned '
+ JSON.stringify(info.applicationInfo.isCloned));
console.debug("=======AMS_MultiApp_0100 Clone=======");
expect(info.applicationInfo.isCloned).assertEqual(true);
done();
} else {
console.info('AMS_MultiApp_0100 Clone info.applicationInfo.isCloned '
+ JSON.stringify(info.applicationInfo.isCloned));
console.debug("=======AMS_MultiApp_0100 Ontology=======");
expect(info.applicationInfo.isCloned).assertEqual(false);
done();
}
})
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiAppPageService") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiAppPageService"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultipageappservice",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiAppPageService.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultipageappservice",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultipageappservice",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultipageappservice.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "service",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
MultiAppPageStartServiceB
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
import rpc from "@ohos.rpc"
import commonEvent from '@ohos.commonevent'
import particleAbility from '@ohos.ability.particleability'
import bundle from "@ohos.bundle"
let mMyStub;
const MIN_CLONEUID = 20000000;
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onReady() {
console.debug('ACTS_SerivceAbilityServer ====<onReady');
},
onReconnect(want) {
console.debug('ACTS_SerivceAbilityServer ====>onReconnect='
+ want + " , JSON." + JSON.stringify(want));
},
onActive() {
console.debug('ACTS_SerivceAbilityServer ====<onActive');
},
onShow() {
console.info('onShow finish ')
},
onReady() {
console.info('onReady');
},
onConnect(want) {
console.debug('ACTS_SerivceAbilityServer ====>onConnect=')
},
onStart(want) {
console.debug('AMS_MultiApp ====>onStart='
+ want + " , JSON." + JSON.stringify(want));
class MyStub extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, message, reply, option) {
console.log("AMS_MultiApp called ");
console.log("AMS_MultiApp code:" + code);
if (code === 1) {
let getContextObject = rpc.IPCSkeleton.getContextObject();
let getCallingPid = rpc.IPCSkeleton.getCallingPid();
let getCallingUid = rpc.IPCSkeleton.getCallingUid();
let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID();
let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID();
let isLocalCalling = rpc.IPCSkeleton.isLocalCalling();
let remoteObject = new rpc.RemoteObject("aaa", 3);
let flushCommands = rpc.IPCSkeleton.flushCommands(remoteObject);
let resetCallingIdentity = rpc.IPCSkeleton.resetCallingIdentity();
let setCallingIdentity = rpc.IPCSkeleton.setCallingIdentity("aaa", 3);
let num = message.readInt();
let msg = message.readString();
console.log("num is " + num + "msg is " + msg);
reply.writeString("Success");
return true;
}
}
}
mMyStub = new MyStub("ServiceAbility-test");
},
async onCommand(want, restart, startId) {
console.info('onCommand finish')
console.info('AMS_MultiApp want'
+ JSON.stringify(want));
console.info('particleAbility--------------------------1');
var featureData = await particleAbility.getWant();
console.info('particleAbility--------------------------2');
console.info('AMS_MultiApp featureData' + featureData);
console.info('AMS_MultiApp featureData' + JSON.stringify(featureData));
console.info('AMS_MultiApp featureData-->bundleName' + featureData.bundleName);
var flag = 0;
if((featureData.bundleName) == ("com.example.actsamsmultipageappservice"))
{
if ((featureData.abilityName) == ("com.example.actsamsmultipageappservice.MainAbility"))
{
flag = 1;
}
}
console.info('AMS_MultiApp flag' + JSON.stringify(flag));
var info = await particleAbility.getAbilityInfo();
console.info('AMS_MultiApp particleAbility.getAbilityInfo() '
+ JSON.stringify(info));
console.info('AMS_MultiApp particleAbility.getAbilityInfo() '
+ info);
console.info('AMS_MultiApp particleAbility.getAbilityInfo() '
+ JSON.stringify(info.applicationInfo));
bundle.getBundleInfo("com.example.actsamsmultipageappservice", 1, async(err, data) => {
console.info('AMS_MultiApp bundle.getBundleInfo '
+ JSON.stringify(data));
if (data.uid >= MIN_CLONEUID) {
console.info('AMS_MultiApp Clone info ' + JSON.stringify(info.applicationInfo));
if (info.applicationInfo.isCloned == true)
{
flag = 1;
}
} else {
console.info('AMS_MultiApp Ontology info ' + JSON.stringify(info.applicationInfo));
if (info.applicationInfo.isCloned == false)
{
flag = 2;
}
}
commonEvent.publish("ACTS_MultiAppPageService_onConnect" + flag, err =>{
console.info('AMS_MultiApp resultflag' + JSON.stringify(flag));
console.debug("=ACTS_MultiAppPageService_onConnect err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json flag【") + JSON.stringify(flag) + ("")
+ " ,err=" + err + " ,flag=" + flag);
});
return mMyStub;
})
},
OnAbilityConnectDone(element, remoteObject,resultCode){
console.debug('ACTS_SerivceAbilityServer ====>OnAbilityConnectDone='
+ element + " , JSON." + JSON.stringify(element)
+ remoteObject + " , JSON." + JSON.stringify(remoteObject)
+ resultCode + " , JSON." + JSON.stringify(resultCode)
);
},
onDisconnect(want) {
console.debug('ACTS_SerivceAbilityServer ====>onDisConnect='
+ want + " , JSON." + JSON.stringify(want));
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiAppSimultaneousOnline") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiAppSimultaneousOnline"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultiapppageontology",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiAppPageOntology.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultiapppageontology",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultiapppageontology",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultiapppageontology.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
MultiAppSimultaneousOnlineA
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import commonEvent from "@ohos.commonevent"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
var subscriberInfoStartAbility = {
events: ["ACTS_StartAbility_CommonEvent", "ACTS_StartAbility_FinishEvent", "DISCONNECT"],
};
const MIN_CLONEUID = 20000000;
describe('ActsAmsMultiAppSimultaneousOnline', function () {
console.info('----ActsAmsMultiAppSimultaneousOnline----');
/*
* @tc.number : AMS_MultiApp_Simultaneous_Online_0100
* @tc.name : startAbility : start pageAbility
* @tc.desc : Ontology application and clone application are online at the same time
*/
it('AMS_MultiApp_Simultaneous_Online_0100', 0, async function (done) {
var subscriber;
commonEvent.createSubscriber(subscriberInfoStartAbility).then(async (data) => {
console.debug("====>Create Subscriber====>");
subscriber = data;
console.debug("====>subscriber====>" + JSON.stringify(subscriber));
await commonEvent.subscribe(subscriber, subscribeCallBack);
})
await featureAbility.startAbility(
{
want:
{
bundleName: "com.example.actsamsmultiapppageclone",
abilityName: "com.example.actsamsmultiapppageclone.MainAbility",
},
},
);
async function subscribeCallBack(err, data) {
console.debug("====>ActsAmsMultiAppSimultaneousOnline CallBack data:====>"
+ JSON.stringify(data));
console.debug("====>ActsAmsMultiAppSimultaneousOnline CallBack data.event:====>"
+ JSON.stringify(data.event));
if(data.event == "ACTS_StartAbility_CommonEvent"){
console.debug("====> if data.event====>");
await featureAbility.startAbility(
{
want:
{
bundleName: "com.example.actsamsmultiapppageclone",
abilityName: "com.example.actsamsmultiapppageclone.MainAbility",
},
},
);
}
if(data.event == "ACTS_StartAbility_FinishEvent") {
function unSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
done();
}
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
}
}
var processInfos = await abilitymanager.getActiveProcessInfos();
var cloneFlag = 0;
var selfFlag = 0;
for (var i = 0; i < processInfos.length; i++) {
console.info('ActsAmsMultiAppTermination process name ' + processInfos[i].processName);
if (processInfos[i].processName == "com.example.actsamsmultiapppageclonetermination") {
console.info('process uid = ' + processInfos[i].uid);
if (processInfos[i].uid >= MIN_CLONEUID) {
cloneFlag = 1;
} else {
selfFlag = 1;
}
}
}
expect(cloneFlag).assertEqual(1);
expect(selfFlag).assertEqual(1);
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiAppPageClone") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiAppPageClone"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultiapppageclone",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiAppClone.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultiapppageclone",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultiapppageclone",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultiapppageclone.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
MultiAppSimultaneousOnlineB
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import commonEvent from '@ohos.commonevent'
import bundle from "@ohos.bundle"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const MIN_CLONEUID = 20000000;
describe('ActsAmsMultiAppPageClone', function () {
console.info('----ActsAmsMultiAppPageClone----');
/*
* @tc.number : AMS_MultiApp_Simultaneous_Online_0100
* @tc.name : startAbility : start pageAbility
* @tc.desc : Ontology application and clone application are online at the same time
*/
it('AMS_MultiApp_Simultaneous_Online_0100', 0, async function (done) {
function PublishCallBackOne(err) {
console.debug("====>Publish CallBack ACTS_StartAbility_CommonEvent Ontology ====>"+err);
done();
}
function PublishCallBackTwo(err) {
console.debug("====>Publish CallBack ACTS_StartAbility_CommonEvent Clone ====>"+err);
done();
}
var data = await featureAbility.getWant();
expect(data.bundleName).assertEqual("com.example.actsamsmultiapppageclone");
expect(data.abilityName).assertEqual("com.example.actsamsmultiapppageclone.MainAbility");
var info = await featureAbility.getAbilityInfo();
bundle.getBundleInfo("com.example.actsamsmultiapppageclone", 1, (err, data) => {
console.info('AMS_MultiApp_Simultaneous_Online_0100 data.uid '
+ JSON.stringify(data.uid));
if (data.uid >= MIN_CLONEUID) {
console.info('AMS_MultiApp_Simultaneous_Online_0100 Clone info '
+ JSON.stringify(info.applicationInfo));
expect(info.applicationInfo.isCloned).assertEqual(true);
commonEvent.publish("ACTS_StartAbility_CommonEvent", PublishCallBackTwo);
} else {
console.info('AMS_MultiApp_Simultaneous_Online_0100 Ontology info '
+ JSON.stringify(info.applicationInfo));
expect(info.applicationInfo.isCloned).assertEqual(false);
commonEvent.publish("ACTS_StartAbility_FinishEvent", PublishCallBackOne);
}
})
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiAppTermination") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiAppTermination"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultiapptermination",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiAppTermination.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultiapptermination",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultiapptermination",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultiapptermination.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import commonEvent from "@ohos.commonevent"
import abilitymanager from '@ohos.app.abilitymanager'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
var subscriberInfoStartAbility = {
events: ["ACTS_StartAbility_CommonEvent", "ACTS_StartAbility_Terminate", "DISCONNECT"],
};
const MIN_CLONEUID = 20000000;
function sleep(delay) {
var start = (new Date()).getTime();
while ((new Date()).getTime() - start < delay) {
continue;
}
}
describe('ActsAmsMultiAppTermination', function () {
console.info('----ActsAmsMultiAppTermination----');
/*
* @tc.number : AMS_MultiApp_Termination_Ontology_0100
* @tc.name : startAbility : start pageAbility
* @tc.desc : The Ontology application and the clone application are online at the same time,
* and the Ontology application is terminated
*/
it('AMS_MultiApp_Termination_Ontology_0100', 0, async function (done) {
var subscriber;
commonEvent.createSubscriber(subscriberInfoStartAbility).then(async (data) => {
console.debug("====>Create Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack);
})
await featureAbility.startAbility(
{
want:
{
bundleName: "com.example.actsamsmultiapppageclonetermination",
abilityName: "com.example.actsamsmultiapppageclonetermination.MainAbility",
},
},
);
async function subscribeCallBack(err, data) {
if(data.event == "ACTS_StartAbility_CommonEvent"){
console.debug("====> if data.event====>");
await featureAbility.startAbility(
{
want:
{
bundleName: "com.example.actsamsmultiapppageclonetermination",
abilityName: "com.example.actsamsmultiapppageclonetermination.MainAbility",
},
},
);
}
if(data.event == "ACTS_StartAbility_Terminate") {
async function unSubscribeCallback() {
console.info('ActsAmsMultiAppTermination unSubscribe');
}
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
console.debug("====>ActsAmsMultiAppTermination unSubscribeCallback====>" );
}
}
sleep(3000);
var processInfos = await abilitymanager.getActiveProcessInfos();
var cloneFlag = 0;
var selfFlag = 0;
for (var i = 0; i < processInfos.length; i++) {
console.info('ActsAmsMultiAppTermination process name ' + processInfos[i].processName);
if (processInfos[i].processName == "com.example.actsamsmultiapppageclonetermination") {
console.info('process uid = ' + processInfos[i].uid);
if (processInfos[i].uid >= MIN_CLONEUID) {
cloneFlag = 1;
} else {
selfFlag = 1;
}
}
}
console.info('ActsAmsMultiAppTermination cloneFlag ' + cloneFlag);
console.info('ActsAmsMultiAppTermination selfFlag ' + selfFlag);
expect(cloneFlag).assertEqual(1);
expect(selfFlag).assertEqual(0);
done();
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsMultiAppPageCloneTermination") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsMultiAppPageCloneTermination"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.actsamsmultiapppageclonetermination",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsMultiAppPageCloneTermination.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamsmultiapppageclonetermination",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamsmultiapppageclonetermination",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamsmultiapppageclonetermination.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
MultiAppTerminationB
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import commonEvent from '@ohos.commonevent'
import bundle from "@ohos.bundle"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const MIN_CLONEUID = 20000000;
describe('ActsAmsMultiAppPageCloneTermination', function () {
console.info('----ActsAmsMultiAppPageCloneTermination----');
/*
* @tc.number : AMS_MultiApp_PageClone_Termination_0100
* @tc.name : startAbility : start pageAbility
* @tc.desc : The Ontology application and the clone application are online at the same time,
* and the Ontology application is terminated
*/
it('AMS_MultiApp_PageClone_Termination_0100', 0, async function (done) {
function PublishCallBackOne(err) {
console.debug("====>Publish CallBack ACTS_StartAbility_CommonEvent Ontology ====>"+err);
done();
}
function PublishCallBackTwo(err) {
console.debug("====>Publish CallBack ACTS_StartAbility_CommonEvent Clone ====>"+err);
done();
}
var data = await featureAbility.getWant();
console.info('AMS_MultiApp_PageClone_Termination_0100 data '
+ JSON.stringify(data));
expect(data.bundleName).assertEqual("com.example.actsamsmultiapppageclonetermination");
expect(data.abilityName).assertEqual("com.example.actsamsmultiapppageclonetermination.MainAbility");
var info = await featureAbility.getAbilityInfo();
console.info('AMS_MultiApp_PageClone_Termination_0100 Clone info '
+ JSON.stringify(info.applicationInfo));
bundle.getBundleInfo("com.example.actsamsmultiapppageclonetermination", 1, async (err, data) => {
console.info('AMS_MultiApp_PageClone_Termination_0100 data.uid '
+ JSON.stringify(data.uid));
if (data.uid >= MIN_CLONEUID) {
expect(info.applicationInfo.isCloned).assertEqual(true);
commonEvent.publish("ACTS_StartAbility_CommonEvent",PublishCallBackTwo);
} else {
expect(info.applicationInfo.isCloned).assertEqual(false);
console.info('AMS_MultiApp_PageClone_Termination_0100 terminateSelf1 ');
featureAbility.terminateSelf(async () => {
commonEvent.publish("ACTS_StartAbility_Terminate",PublishCallBackOne);
console.info('AMS_MultiApp_PageClone_Termination_0100 terminateSelf async callback publish ');
});
}
})
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("MultiAppPageExecutor") {
hap_profile = "./src/main/config.json"
hap_name = "MultiAppPageExecutor"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/js/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
}
{
"app": {
"bundleName": "com.example.amsmultiapppageexecutor",
"vendor": "neusoft",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.amsmultiapppageexecutor",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.amsmultiapppageexecutor.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import bundle from "@ohos.bundle"
import commonEvent from '@ohos.commonevent'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
let code;
const MIN_CLONEUID = 20000000;
function publishCallBack() {
console.debug("====>Publish CallBack ====>");
}
async function onStartTest() {
var abilityWant = await featureAbility.getWant();
var result = "";
var bundleInfo;
console.log('PageExecutor bundleName' + abilityWant.bundleName);
console.log('PageExecutor abilityName' + abilityWant.abilityName);
if ((abilityWant.bundleName == "com.example.amsmultiapppageexecutor") &&
(abilityWant.abilityName == "com.example.amsmultiapppageexecutor.MainAbility")) {
code = 1;
} else {
code = 2;
}
console.log('PageExecutor onStart code =' + code );
var info = await featureAbility.getAbilityInfo();
console.log('PageExecutor onStart info =' + JSON.stringify(info));
bundleInfo = await bundle.getBundleInfo("com.example.amsmultiapppageexecutor", 1);
console.info('PageExecutor getBundleInfo =' + JSON.stringify(bundleInfo));
if (bundleInfo.uid >= MIN_CLONEUID) {
if (info.applicationInfo.isCloned == true) {
result = "isCloned";
}
} else {
if (info.applicationInfo.isCloned == false) {
result = "notCloned";
}
}
var CommonEventPublishData = {
code: code,
data: result,
isOrdered: false
}
console.log('PageExecutor onStart publish');
commonEvent.publish("subscriberInfoMultiAppPageByServiceStart", CommonEventPublishData, publishCallBack);
}
export default {
data: {
title: "PageExecutor"
},
onInit() {
this.title = "PageExecutor";
},
onShow() {
console.log('PageExecutor onShow start');
try {
onStartTest();
} catch (err) {
console.log('PageExecutor err = ' + err);
}
},
onStart() {
console.log('PageExecutor onStart');
},
onStop() {
console.log('PageExecutor onStop');
},
}
{
"string": [
{
"name": "app_name",
"value": "particletestserver"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("MultiAppServiceExecutor") {
hap_profile = "./src/main/config.json"
hap_name = "MultiAppServiceExecutor"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/js/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
}
{
"app": {
"bundleName": "com.example.amsmultiappserviceexecutor",
"vendor": "neusoft",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.amsmultiappserviceexecutor",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.amsmultiappserviceexecutor.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "service",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import rpc from "@ohos.rpc"
import particleAbility from '@ohos.ability.particleability'
import bundle from "@ohos.bundle"
import commonEvent from '@ohos.commonevent'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
let mMyStub;
let code;
const MIN_CLONEUID = 20000000;
function publishCallBack() {
console.debug("====>Publish CallBack ====>");
}
async function onCommandTest(want) {
var abilityWant = await particleAbility.getWant();
var result = "";
var bundleInfo;
console.log('ServiceExecutor onCommandTest');
if ((abilityWant.bundleName == "com.example.amsmultiappserviceexecutor") &&
(abilityWant.abilityName == "com.example.amsmultiappserviceexecutor.MainAbility")) {
code = 1;
} else {
code = 2;
}
console.log('ServiceExecutor onCommand code =' + code );
var info = await particleAbility.getAbilityInfo();
console.log('ServiceExecutor onCommand info =' + JSON.stringify(info));
bundleInfo = await bundle.getBundleInfo("com.example.amsmultiappserviceexecutor", 1);
console.info('ServiceExecutor getBundleInfo =' + JSON.stringify(bundleInfo));
if (bundleInfo.uid >= MIN_CLONEUID) {
if (info.applicationInfo.isCloned == true) {
result = "isCloned";
}
} else {
if (info.applicationInfo.isCloned == false) {
result = "notCloned";
}
}
var CommonEventPublishData = {
code: code,
data: result,
isOrdered: false
}
if (want.action == 'StartSerciveExecutor') {
console.log('ServiceExecutor onCommand publish');
commonEvent.publish("subscriberInfoMultiAppServiceByServiceStart", CommonEventPublishData, publishCallBack);
}
}
async function onConnectTest(want) {
var abilityWant = await particleAbility.getWant();
var result = "";
var bundleInfo;
console.log('ServiceExecutor onConnectTest');
if ((abilityWant.bundleName == "com.example.amsmultiappserviceexecutor") &&
(abilityWant.abilityName == "com.example.amsmultiappserviceexecutor.MainAbility")) {
code = 1;
} else {
code = 2;
}
console.log('ServiceExecutor onCommand code =' + code);
var info = await particleAbility.getAbilityInfo();
console.info('ServiceExecutor MultiApp service executor info ' + JSON.stringify(info));
bundleInfo = await bundle.getBundleInfo("com.example.amsmultiappserviceexecutor", 1);
console.info('ServiceExecutor MultiApp service executor bundleInfo ' + JSON.stringify(bundleInfo));
if (bundleInfo.uid >= MIN_CLONEUID) {
if (info.applicationInfo.isCloned == true) {
result = "isCloned";
}
} else {
if (info.applicationInfo.isCloned == false) {
result = "notCloned";
}
}
var CommonEventPublishData = {
code: code,
data: result,
isOrdered: false
}
if (want.action == 'ConnectSerciveExecutor') {
console.log('ServiceExecutor onConnect publish' + want.action);
commonEvent.publish("subscriberInfoMultiAppServiceByServiceConnect", CommonEventPublishData, publishCallBack);
}
}
export default {
data: {
title: "ServiceExecutor"
},
onInit() {
this.title = "ServiceExecutor";
},
onStart(want) {
console.log('ServiceExecutor onStart');
class MyStub extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, message, reply, option) {
console.log("RPCTestServer onRemoteRequest called 1111");
console.log("RPCTestServer onRemoteRequest code:" + code);
if (code === 1) {
let getContextObject = rpc.IPCSkeleton.getContextObject();
let getCallingPid = rpc.IPCSkeleton.getCallingPid();
let getCallingUid = rpc.IPCSkeleton.getCallingUid();
let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID();
let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID();
let isLocalCalling = rpc.IPCSkeleton.isLocalCalling();
let remoteObject = new rpc.RemoteObject("aaa", 3);
let flushCommands = rpc.IPCSkeleton.flushCommands(remoteObject);
let resetCallingIdentity = rpc.IPCSkeleton.resetCallingIdentity();
let setCallingIdentity = rpc.IPCSkeleton.setCallingIdentity("aaa", 3);
let num = message.readInt();
let msg = message.readString();
console.log("num is " + num + "msg is " + msg);
reply.writeString("Success");
return true;
}
}
}
mMyStub = new MyStub("ServiceStarter-test");
},
onStop() {
console.log('ServiceExecutor onStop');
},
onConnect(want) {
console.log('stub ServiceExecutor OnConnect' + JSON.stringify(want));
onConnectTest(want);
return mMyStub;
},
onReconnect(want) {
console.log('ServiceExecutor onReconnect');
},
onDisconnect() {
console.log('ServiceExecutor OnDisConnect');
},
onCommand(want, restart, startId) {
console.log('ServiceExecutor onCommand' + JSON.stringify(want));
onCommandTest(want);
},
}
{
"string": [
{
"name": "app_name",
"value": "particletestserver"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("MultiAppServiceStarter") {
hap_profile = "./src/main/config.json"
hap_name = "MultiAppServiceStarter"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/js/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
}
{
"app": {
"bundleName": "com.example.amsmultiappservicestarter",
"vendor": "neusoft",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.amsmultiappservicestarter",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.amsmultiappservicestarter.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "service",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import rpc from "@ohos.rpc"
import particleAbility from '@ohos.ability.particleability'
import commonEvent from '@ohos.commonevent'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
let mMyStub;
let bundleName = "com.example.amsmultiappserviceexecutor";
let abilityName = "com.example.amsmultiappserviceexecutor.MainAbility";
let pageBundleName = "com.example.amsmultiapppageexecutor";
let pageAbilityName = "com.example.amsmultiapppageexecutor.MainAbility";
let connId;
var mRemote;
function onConnectCallback(element, remote) {
console.log('ServiceStarter ConnectAbility onConnect element.deviceId : ' + element.deviceId)
console.log('ServiceStarter ConnectAbility onConnect element.bundleName : ' + element.bundleName)
console.log('ServiceStarter ConnectAbility onConnect element.abilityName : ' + element.abilityName)
console.log('ServiceStarter ConnectAbility onConnect element.uri : ' + element.uri)
console.log('ServiceStarter ConnectAbility onConnect element.shortName : ' + element.shortName)
console.log('ServiceStarter ConnectAbility onConnect remote : ' + remote);
mRemote = remote;
console.log('ServiceStarter ConnectAbility onConnect remote 是否为proxy:' + (remote instanceof rpc.RemoteProxy));
particleAbility.disconnectAbility(
connId,
(error, data) => {
console.log('MultiAppService DisconnectAbility result errCode : ' + error.code + " data: " + data)
},
);
}
function onDisconnectCallback(element) {
commonEvent.publish("DISCONNECT_0100", ()=>{console.log('disconnect finish1')});
console.log('ServiceStarter ConnectAbility onDisconnect element.deviceId : ' + element.deviceId)
console.log('ServiceStarter ConnectAbility onDisconnect element.bundleName : ' + element.bundleName)
console.log('ServiceStarter ConnectAbility onDisconnect element.abilityName : ' + element.abilityName)
console.log('ServiceStarter ConnectAbility onDisconnect element.uri : ' + element.uri)
console.log('ServiceStarter ConnectAbility onDisconnect element.shortName : ' + element.shortName)
}
function onFailedCallback(code) {
console.log('ServiceStarter ConnectAbility onFailed errCode : ' + code)
}
async function connectSerciveExecutor() {
console.log('ServiceStarter StartSerciveExecutor ConnectAbility set time before : ');
connId = await particleAbility.connectAbility(
{
bundleName: bundleName,
abilityName: abilityName,
action: "ConnectSerciveExecutor"
},
{
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback,
},
);
console.log('ServiceStarter StartSerciveExecutor ConnectAbility connId : ' + connId);
}
export default {
data: {
title: "ServiceStarter"
},
onInit() {
this.title = "ServiceStarter";
},
onStart(want) {
console.log('ServiceStarter onStart');
class MyStub extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, message, reply, option) {
console.log("RPCTestServer onRemoteRequest called 1111");
console.log("RPCTestServer onRemoteRequest code:" + code);
if (code === 1) {
let getContextObject = rpc.IPCSkeleton.getContextObject();
let getCallingPid = rpc.IPCSkeleton.getCallingPid();
let getCallingUid = rpc.IPCSkeleton.getCallingUid();
let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID();
let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID();
let isLocalCalling = rpc.IPCSkeleton.isLocalCalling();
let remoteObject = new rpc.RemoteObject("aaa", 3);
let flushCommands = rpc.IPCSkeleton.flushCommands(remoteObject);
let resetCallingIdentity = rpc.IPCSkeleton.resetCallingIdentity();
let setCallingIdentity = rpc.IPCSkeleton.setCallingIdentity("aaa", 3);
let num = message.readInt();
let msg = message.readString();
console.log("num is " + num + "msg is " + msg);
reply.writeString("Success");
return true;
}
}
}
mMyStub = new MyStub("ServiceStarter-test");
},
onStop() {
console.log('ServiceStarter onStop');
},
onConnect(want) {
console.log('stub ServiceStarter OnConnect' + JSON.stringify(want));
if (want.action == 'ConnectSerciveExecutor') {
console.log('ServiceStarter ConnectSerciveExecutor IN')
connectSerciveExecutor();
}
if (want.action == 'StartSerciveExecutor') {
console.log('stub ServiceStarter OnConnect start service executor')
particleAbility.startAbility(
{
want:
{
action: "StartSerciveExecutor",
type: "MIMETYPE",
deviceId: "",
bundleName: bundleName,
abilityName: abilityName,
uri: ""
},
}
);
}
if (want.action == 'StartPageExecutor') {
console.log('stub ServiceStarter start page executor')
particleAbility.startAbility(
{
want:
{
action: "StartPageExecutor",
deviceId: "",
bundleName: pageBundleName,
abilityName: pageAbilityName,
uri: ""
},
}
);
}
return mMyStub;
},
onReconnect(want) {
console.log('ServiceStarter onReconnect');
},
onDisconnect() {
console.log('ServiceStarter OnDisConnect');
},
onCommand(want, restart, startId) {
console.log('ServiceStarter onCommand');
},
}
{
"string": [
{
"name": "app_name",
"value": "amsmultiappservicestarter"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("MultiAppTester") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "MultiAppTester"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.example.amsmultiapptester",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"MultiAppTester.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.amsmultiapptester",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.amsmultiapptester",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.amsmultiapptester.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import commonEvent from '@ohos.commonevent'
const START_ABILITY_TIMEOUT = 4000;
var subscriberInfoMultiApp0700 = {
events: ["subscriberInfoMultiAppServiceByServiceStart", "DISCONNECT"]
};
var subscriberInfoMultiApp0800 = {
events: ["subscriberInfoMultiAppServiceByServiceConnect", "DISCONNECT"]
};
var subscriberInfoMultiApp0600 = {
events: ["subscriberInfoMultiAppPageByServiceStart", "DISCONNECT"]
};
describe('MultiAppTester', function () {
console.info('----MultiAppTester----');
let bundleName = "com.example.amsmultiappservicestarter";
let abilityName = "com.example.amsmultiappservicestarter.MainAbility";
var mRemote;
function onConnectCallback(element, remote) {
console.log('StartMultiAppTester ConnectAbility onConnect element.deviceId : ' + element.deviceId)
console.log('StartMultiAppTester ConnectAbility onConnect element.bundleName : ' + element.bundleName)
console.log('StartMultiAppTester ConnectAbility onConnect element.abilityName : ' + element.abilityName)
console.log('StartMultiAppTester ConnectAbility onConnect element.uri : ' + element.uri)
console.log('StartMultiAppTester ConnectAbility onConnect element.shortName : ' + element.shortName)
console.log('StartMultiAppTester ConnectAbility onConnect remote : ' + remote);
mRemote = remote;
console.log('StartMultiAppTester ConnectAbility onConnect remote 是否为proxy:'
+ (remote instanceof rpc.RemoteProxy));
}
function onDisconnectCallback(element) {
commonEvent.publish("DISCONNECT", ()=>{console.log('disconnect finish1')});
console.log('StartMultiAppTester ConnectAbility onDisconnect element.deviceId : ' + element.deviceId)
console.log('StartMultiAppTester ConnectAbility onDisconnect element.bundleName : ' + element.bundleName)
console.log('StartMultiAppTester ConnectAbility onDisconnect element.abilityName : ' + element.abilityName)
console.log('StartMultiAppTester ConnectAbility onDisconnect element.uri : ' + element.uri)
console.log('StartMultiAppTester ConnectAbility onDisconnect element.shortName : ' + element.shortName)
}
function onFailedCallback(code) {
console.log('StartMultiAppTester ConnectAbility onFailed errCode : ' + code)
}
/*
* @tc.number: AMS_MultiApp_0700
* @tc.name: Connects a service ability, which is used to start another cloned service ability.
* @tc.desc: Check the event data of executor service ability publishes
*/
it('AMS_MultiApp_0700', 0, async function (done) {
console.log('AMS_MultiApp_0700====<begin');
var subscriber;
let id;
let connId;
let events = new Map();
function subscribeCallBack(err, data) {
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
events.set(data.event, 0);
if(events.size == 1) {
if(data.event == "DISCONNECT") {
expect(data.event).assertEqual("DISCONNECT");
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
} else {
clearTimeout(id);
expect(data.event).assertEqual("subscriberInfoMultiAppServiceByServiceStart");
expect(data.data).assertEqual("notCloned");
expect(data.code).assertEqual(1);
featureAbility.disconnectAbility(
connId,
(error, data) => {
console.log('MultiAppService DisconnectAbility result errCode : '
+ error.code + " data: " + data)
},
);
}
} else {
expect(data.event).assertEqual("DISCONNECT");
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
}
}
commonEvent.createSubscriber(subscriberInfoMultiApp0700).then(async (data) => {
console.debug("====>Create Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack);
})
function unSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
}
function timeout() {
expect().assertFail();
console.debug('StartMultiAppTester timeout');
featureAbility.disconnectAbility(
connId,
(error, data) => {
console.log('StartMultiAppTester DisconnectAbility result errCode : '
+ error.code + " data: " + data)
},
);
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.log('StartMultiAppTester ConnectAbility id : ' + id);
connId = await featureAbility.connectAbility(
{
bundleName: bundleName,
abilityName: abilityName,
action: "StartSerciveExecutor"
},
{
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback,
},
);
console.log('StartMultiAppTester ConnectAbility connId : ' + connId);
})
/*
* @tc.number: AMS_MultiApp_0800
* @tc.name: Connects a service ability, which is used to connect another cloned service ability.
* @tc.desc: Check the event data of executor service ability publishes
*/
it('AMS_MultiApp_0800', 0, async function (done) {
console.log('AMS_MultiApp_0800====<begin');
var subscriber;
let id;
let connId;
let events = new Map();
function subscribeCallBack(err, data) {
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
events.set(data.event, 0);
if(events.size == 1) {
if(data.event == "DISCONNECT") {
expect(data.event).assertEqual("DISCONNECT");
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
} else {
clearTimeout(id);
expect(data.event).assertEqual("subscriberInfoMultiAppServiceByServiceConnect");
expect(data.data).assertEqual("notCloned");
expect(data.code).assertEqual(1);
featureAbility.disconnectAbility(
connId,
(error, data) => {
console.log('MultiAppService DisconnectAbility result errCode : '
+ error.code + " data: " + data)
},
);
}
} else {
expect(data.event).assertEqual("DISCONNECT");
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
}
}
commonEvent.createSubscriber(subscriberInfoMultiApp0800).then(async (data) => {
console.debug("====>Create Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack);
})
function unSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
}
function timeout() {
expect().assertFail();
console.debug('StartMultiAppTester timeout');
featureAbility.disconnectAbility(
connId,
(error, data) => {
console.log('StartMultiAppTester DisconnectAbility result errCode : '
+ error.code + " data: " + data)
},
);
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.log('StartMultiAppTester ConnectAbility id : ' + id);
connId = await featureAbility.connectAbility(
{
bundleName: bundleName,
abilityName: abilityName,
action: "ConnectSerciveExecutor"
},
{
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback,
},
);
console.log('StartMultiAppTester ConnectAbility connId : ' + connId);
})
/*
* @tc.number: AMS_MultiApp_0600
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it('AMS_MultiApp_0600', 0, async function (done) {
console.log('AMS_MultiApp_0600====<begin');
console.log('========StartConnect called');
var subscriber;
let id;
let connId;
let events = new Map();
function subscribeCallBack(err, data) {
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
events.set(data.event, 0);
if(events.size == 1) {
if(data.event == "DISCONNECT") {
expect(data.event).assertEqual("DISCONNECT");
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
} else {
clearTimeout(id);
expect(data.event).assertEqual("subscriberInfoMultiAppPageByServiceStart");
expect(data.data).assertEqual("notCloned");
expect(data.code).assertEqual(1);
featureAbility.disconnectAbility(
connId,
(error, data) => {
console.log('MultiAppService DisconnectAbility result errCode : '
+ error.code + " data: " + data);
},
);
}
} else {
expect(data.event).assertEqual("DISCONNECT");
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
}
}
commonEvent.createSubscriber(subscriberInfoMultiApp0600).then(async (data) => {
console.debug("====>Create Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack);
})
function unSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
}
function timeout() {
expect().assertFail();
console.debug('StartMultiAppTester timeout');
featureAbility.disconnectAbility(
connId,
(error, data) => {
console.log('StartMultiAppTester DisconnectAbility result errCode : '
+ error.code + " data: " + data);
},
);
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.log('StartMultiAppTester AMS_MultiApp_0600 ConnectAbility id : ' + id);
connId = await featureAbility.connectAbility(
{
bundleName: bundleName,
abilityName: abilityName,
action: "StartPageExecutor"
},
{
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback,
},
);
console.log('StartMultiAppTester AMS_MultiApp_0600 ConnectAbility connId : ' + connId);
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("amsMultiDataAbilityClone") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "amsMultiDataAbilityClone"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.amsst.amsmultidataabilityclone",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"amsMultiDataAbility.hap",
"./resource/appexecfwk/amsStDataAbility.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.amsst.amsmultidataabilityclone",
"vendor": "amsst",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.amsmultidataabilityclone",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.amsst.amsmultidataabilityclone.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
.titleST {
font-size: 32px;
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
STDataAbility
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('====onShow finish====<')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "STDataAbility"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MultiDataAbilityJsSt.test.js')
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureAbility'
import abilitymanager from '@ohos.app.abilitymanager'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const MIN_CLONEUID = 20000000;
describe('ActsDataAbilityHelperTest', function () {
var dataAbilityProcessName = ("com.ix.verify.act");
var dataAbilityUri = ("dataability:///com.ix.VerifyActDataAbility");
var DAHelper;
beforeAll(async (done) => {
console.debug('= ACTS_beforeAll ====<begin');
try {
DAHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri);
console.debug('ACTS_beforeAll DAHelper ====>: ' + DAHelper + " ,JSON. " + JSON.stringify(DAHelper));
} catch (err) {
console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:' + err);
}
console.debug('= ACTS_beforeAll ====<end');
done();
})
afterAll((done) => {
console.debug('= ACTS_afterAll ====<begin');
console.debug('= ACTS_afterAll ====<end');
done();
})
/*
* @tc.number: AMS_MultiApp_0500
* @tc.name: Page ability start cloned data ability
* @tc.desc: Check if cloned data ability process exists
*/
it('AMS_MultiApp_0500', 0, async function (done) {
console.log('AMS_MultiApp_0500====<begin');
console.debug("=AMS_MultiApp_0500 dataAbilityUri====>" + dataAbilityUri)
var cloneFlag = 0;
var selfFlag = 0;
var processInfos = await abilitymanager.getActiveProcessInfos();
console.info('ActsAmsMultiAppTermination processInfos length' + processInfos.length);
for (var i = 0; i < processInfos.length; i++) {
console.info('ActsAmsMultiAppTermination process name ' + processInfos[i].processName);
if (processInfos[i].processName == dataAbilityProcessName) {
console.info('process uid = ' + processInfos[i].uid);
if (processInfos[i].uid >= MIN_CLONEUID) {
cloneFlag = 1;
} else {
selfFlag = 1;
}
}
}
console.log('AMS_MultiApp_0500====cloneFlag' + cloneFlag);
console.log('AMS_MultiApp_0500====selfFlag' + selfFlag);
expect(cloneFlag).assertEqual(1);
expect(selfFlag).assertEqual(0);
done();
})
})
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("amsMultiDataAbilitySelf") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "amsMultiDataAbilitySelf"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.amsst.amsmultidataabilityself",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"amsMultiDataAbility.hap",
"./resource/appexecfwk/amsStDataAbility.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.amsst.amsmultidataabilityself",
"vendor": "amsst",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.amsmultidataabilityself",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.amsst.amsmultidataabilityself.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
.titleST {
font-size: 32px;
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
STDataAbility
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('====onShow finish====<')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "STDataAbility"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MultiDataAbilityJsSt.test.js')
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureAbility'
import abilitymanager from '@ohos.app.abilitymanager'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const MIN_CLONEUID = 20000000;
describe('ActsDataAbilityHelperTest', function () {
var dataAbilityProcessName = ("com.ix.verify.act");
var dataAbilityUri = ("dataability:///com.ix.VerifyActDataAbility");
var DAHelper;
beforeAll(async (done) => {
console.debug('= ACTS_beforeAll ====<begin');
try {
DAHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri);
console.debug('ACTS_beforeAll DAHelper ====>: ' + DAHelper + " ,JSON. " + JSON.stringify(DAHelper));
} catch (err) {
console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:' + err);
}
console.debug('= ACTS_beforeAll ====<end');
done();
})
afterAll((done) => {
console.debug('= ACTS_afterAll ====<begin');
console.debug('= ACTS_afterAll ====<end');
done();
})
/*
* @tc.number: AMS_MultiApp_0400
* @tc.name: Page ability start cloned data ability
* @tc.desc: Check if cloned data ability process exists
*/
it('AMS_MultiApp_0400', 0, async function (done) {
console.log('AMS_MultiApp_0400====<begin');
console.debug("=AMS_MultiApp_0400 dataAbilityUri====>" + dataAbilityUri)
var cloneFlag = 0;
var selfFlag = 0;
var processInfos = await abilitymanager.getActiveProcessInfos();
console.info('ActsAmsMultiAppTermination processInfos length' + processInfos.length);
for (var i = 0; i < processInfos.length; i++) {
console.info('ActsAmsMultiAppTermination process name ' + processInfos[i].processName);
if (processInfos[i].processName == dataAbilityProcessName) {
console.info('process uid = ' + processInfos[i].uid);
if (processInfos[i].uid >= MIN_CLONEUID) {
cloneFlag = 1;
} else {
selfFlag = 1;
}
}
}
console.log('AMS_MultiApp_0400====cloneFlag' + cloneFlag);
console.log('AMS_MultiApp_0400====selfFlag' + selfFlag);
expect(cloneFlag).assertEqual(0);
expect(selfFlag).assertEqual(1);
done();
})
})
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册