提交 78bd4843 编写于 作者: O openharmony_ci 提交者: Gitee

!1269 Update ans &bms test code

Merge pull request !1269 from blackleon/update_master_1202
......@@ -17,6 +17,9 @@ group("ams_standard") {
testonly = true
if (is_standard_system) {
deps = [
"amsabilitymanager/amsMissionSnapshotTest:amsMissionSnapshotTest",
"amsabilitymanager/amsMissionSnapshotTestSingleton:amsMissionSnapshotTestSingleton",
"amsabilitymanager/amsMissionSnapshotTestSingletonS:amsMissionSnapshotTestSingletonS",
"amsdatauriutils:amsDataUriUtils",
"amszipfileunzipfilest:amsZipfileUnzipfileST",
"fwkdataaccessor:FWKDataAccessor",
......
# 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("amsMissionSnapshotTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "amsMissionSnapshotTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests"
}
{
"app": {
"bundleName": "com.amsst.amsMissionSnapshotTest",
"vendor": "amsst",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.amsMissionSnapshotTest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"name": "com.amsst.amsMissionSnapshotTest.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">
STAbilityManagerMissionSnapshot
</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
/*
* 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('./amsMissionSnapshotTest.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 abilityManager from '@ohos.app.abilityManager'
import featureAbility from '@ohos.ability.featureability'
import commonEvent from '@ohos.commonevent'
import image from '@ohos.multimedia.image'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('ActsMissionSnapshotTest', function () {
beforeAll(async (done) => {
console.debug('= ACTS_beforeAll ====<begin');
try {
} catch (err) {
console.error('=ACTS_beforeAll catch(err)====>:' + err);
}
console.debug('= ACTS_beforeAll ====<end');
done();
})
afterAll(async (done) => {
console.debug('= ACTS_afterAll ====<begin');
try {
} catch (err) {
console.error('=ACTS_afterAll catch(err)====>:' + err);
}
console.debug('= ACTS_afterAll ====<end');
done();
})
/*
* @tc.number: ACTS_MissionSnapshot_0100
* @tc.name: getAbilityMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(AsyncCallback)
*/
it('ACTS_MissionSnapshot_0100', 0, async function (done) {
console.debug('ACTS_MissionSnapshot_0100====<begin');
try {
await abilityManager.getAbilityMissionSnapshot(-1, (err, data) => {
expect(err.code).assertEqual(0);
console.debug("=ACTS_MissionSnapshot_0100 err,data=======>"
+ ("json data【") + JSON.stringify(data) + ("") + " , " + data);
expect(data.topAbility.bundleName).assertEqual("");
expect(data.topAbility.abilityName).assertEqual("");
console.debug('ACTS_MissionSnapshot_0100====<end')
done();
});
} catch (err) {
expect(err).assertEqual("0");
console.debug('ACTS_MissionSnapshot_0100====<end err');
done();
}
})
/*
* @tc.number: ACTS_MissionSnapshot_0200
* @tc.name: getAbilityMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(AsyncCallback)
*/
it('ACTS_MissionSnapshot_0200', 0, async function (done) {
console.debug('ACTS_MissionSnapshot_0200====<begin');
var m_missionId = -1;
var m_topAbility_bundleName = "";
var m_topAbility_abilityName = "";
try {
var upperLimit = 10;
await abilityManager.getActiveAbilityMissionInfos(upperLimit, async (err, data) => {
console.debug("=ACTS_MissionSnapshot_0200 err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
console.debug('ACTS_MissionSnapshot_0200 AbilityMissionInfo data.length ====>: ' + data.length);
if (!data.length) {
m_missionId = -99;
m_topAbility_bundleName = "";
m_topAbility_abilityName = "";
expect("if (!data.length) ").assertEqual("0");
console.debug('ACTS_MissionSnapshot_0200====<end 0')
done();
} else {
m_missionId = data[0].missionId;
m_topAbility_bundleName = data[0].topAbility.bundleName;
m_topAbility_abilityName = data[0].topAbility.abilityName;
}
console.debug("=ACTS_MissionSnapshot_0200 m_missionId====>" + m_missionId);
await abilityManager.getAbilityMissionSnapshot(m_missionId, (err, data) => {
expect(err.code).assertEqual(0);
console.debug("=ACTS_MissionSnapshot_0200 err,data=======>"
+ ("json data【") + JSON.stringify(data) + ("") + " , " + data);
expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName);
expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName);
console.debug("=ACTS_MissionSnapshot_0200 ====> JSON.stringify(data.snapshot)="
+ JSON.stringify(data.snapshot) + " , " + data.snapshot);
try {
data.snapshot.getPixelBytesNumber().then(function (data){
console.debug("=ACTS_MissionSnapshot_0200 ====>"
+"(data.snapshot.getPixelBytesNumber()=)" + data)
expect(data != 0).assertEqual(true);
console.debug('ACTS_MissionSnapshot_0200====<end')
done();
})
} catch (err) {
console.debug('ACTS_MissionSnapshot_0200====<end catch (err) get = ');
expect("0").assertEqual(err);
done();
}
});
});
} catch (err) {
expect(err).assertEqual("0");
console.debug('ACTS_MissionSnapshot_0200====<end err')
done();
}
})
/*
* @tc.number: ACTS_MissionSnapshot_0300
* @tc.name: getAbilityMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(AsyncCallback)
*/
it('ACTS_MissionSnapshot_0300', 0, async function (done) {
console.debug('ACTS_MissionSnapshot_0300====<begin');
var subscriber;
var setTimeout = 5000;
var currentAlertTimeout;
var CommonEventSubscribeInfo = {
events: ["ACTS_MissionSnapshot_OnActive",
"ACTS_MissionSnapshot_onShow"
],
};
try {
commonEvent.createSubscriber(CommonEventSubscribeInfo).then(async (data) => {
console.debug("=ACTS_MissionSnapshot_0300 createSubscriber .then(data)=======>"
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,data=" + data);
subscriber = data;
await commonEvent.subscribe(subscriber, async (err, data) => {
clearTimeout(currentAlertTimeout);
console.debug("=ACTS_MissionSnapshot_0300 subscribe (err,data)=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
unsubscribe("subscribe", subscriber);
var m_missionId = -1;
var m_topAbility_bundleName = "";
var m_topAbility_abilityName = "";
var upperLimit = 10;
await abilityManager.getActiveAbilityMissionInfos(upperLimit, async (err, data) => {
console.debug("=ACTS_MissionSnapshot_0300 err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
console.debug('ACTS_MissionSnapshot_0300 AbilityMissionInfo data.length ====>'
+ data.length);
if (!data.length) {
m_missionId = -99;
m_topAbility_bundleName = "";
m_topAbility_abilityName = "";
expect("if (!data.length) ").assertEqual(0);
unsubscribe("if (!data.length) ", subscriber);
console.debug('ACTS_MissionSnapshot_0300====<end 0')
done();
} else {
m_missionId = data[0].missionId;
m_topAbility_bundleName = data[0].topAbility.bundleName;
m_topAbility_abilityName = data[0].topAbility.abilityName;
}
console.debug("=ACTS_MissionSnapshot_0300 m_missionId====>" + m_missionId);
await abilityManager.getAbilityMissionSnapshot(m_missionId, (err, data) => {
expect(err.code).assertEqual(0);
console.debug("=ACTS_MissionSnapshot_0300 then data====>"
+ ("json data 【") + JSON.stringify(data) + ("") + " , " + data);
try {
expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName);
expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName);
data.snapshot.getPixelBytesNumber().then(function (data){
console.debug("=ACTS_MissionSnapshot_0300 ====> "
+("data.snapshot.getPixelBytesNumber()=" + data))
expect(data != 0).assertEqual(true);
unsubscribe(".then() ", subscriber);
console.debug('ACTS_MissionSnapshot_0300====<end')
done();
})
} catch (err) {
expect(err).assertEqual("0");
unsubscribe("catch (err) get ", subscriber);
console.debug('ACTS_MissionSnapshot_0300====<end catch (err) get')
done();
}
})
});
});
});
await featureAbility.startAbility(
{
want:
{
bundleName: "com.amsst.amsMissionSnapshotTestSingleton",
abilityName: "com.amsst.amsMissionSnapshotTestSingleton.MainAbility",
},
},
);
} catch (err) {
expect(err).assertEqual("0");
console.debug('ACTS_MissionSnapshot_0300====<end catch(err)')
done();
}
console.debug('ACTS_MissionSnapshot_0300====< ')
currentAlertTimeout = setTimeout(() => {
console.debug('ACTS_MissionSnapshot_0300====<end setTimeout');
unsubscribe("setTimeout ", subscriber);
expect("Event False").assertEqual("Event timeout");
done();
}, setTimeout);
})
/*
* @tc.number: ACTS_MissionSnapshot_0400
* @tc.name: getAbilityMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(Promise)
*/
it('ACTS_MissionSnapshot_0400', 0, async function (done) {
console.debug('ACTS_MissionSnapshot_0400====<begin');
try {
abilityManager.getAbilityMissionSnapshot(-1)
.then(function (data) {
console.debug("=ACTS_MissionSnapshot_0400 then data====>"
+ ("json data 【") + JSON.stringify(data) + ("") + " , " + data);
expect(data.topAbility.bundleName).assertEqual("");
expect(data.topAbility.abilityName).assertEqual("");
console.debug('ACTS_MissionSnapshot_0400====<end');
done();
}).catch(function (err) {
console.debug("=ACTS_MissionSnapshot_0400 catch err ====>"
+ ("json err 【") + JSON.stringify(err) + (""));
expect(err).assertEqual("false");
console.debug('ACTS_MissionSnapshot_0400====<end .catch(err)');
done();
});
} catch (err) {
expect(err).assertEqual("0");
console.debug('ACTS_MissionSnapshot_0400====<end catch(err)');
done();
}
})
/*
* @tc.number: ACTS_MissionSnapshot_0500
* @tc.name: getAbilityMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(Promise)
*/
it('ACTS_MissionSnapshot_0500', 0, async function (done) {
console.debug('ACTS_MissionSnapshot_0500====<begin');
var m_missionId = -1;
var m_topAbility_bundleName = "";
var m_topAbility_abilityName = "";
try {
var upperLimit = 10;
await abilityManager.getActiveAbilityMissionInfos(upperLimit, async (err, data) => {
console.debug("=ACTS_MissionSnapshot_0500 err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
console.debug('ACTS_MissionSnapshot_0500 AbilityMissionInfo data.length ====>: ' + data.length);
if (!data.length) {
m_missionId = -99;
m_topAbility_bundleName = "";
m_topAbility_abilityName = "";
expect("if (!data.length) ").assertEqual(0);
console.debug('ACTS_MissionSnapshot_0500====<end 0')
done();
} else {
m_missionId = data[0].missionId;
m_topAbility_bundleName = data[0].topAbility.bundleName;
m_topAbility_abilityName = data[0].topAbility.abilityName;
}
console.debug("=ACTS_MissionSnapshot_0500 m_missionId====>" + m_missionId);
abilityManager.getAbilityMissionSnapshot(m_missionId)
.then(function (data) {
console.debug("=ACTS_MissionSnapshot_0500 then data====>"
+ ("json data 【") + JSON.stringify(data) + ("") + " , " + data);
expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName);
expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName);
console.debug("=ACTS_MissionSnapshot_0500 err,data=======> JSON.stringify(data.snapshot)="
+ JSON.stringify(data.snapshot) + " , " + data.snapshot);
try {
data.snapshot.getPixelBytesNumber().then(function (data){
console.debug("=ACTS_MissionSnapshot_0500 ====> "
+("data.snapshot.getPixelBytesNumber()=" + data))
expect(data != 0).assertEqual(true);
console.debug('ACTS_MissionSnapshot_0500====<end')
done();
})
} catch (err) {
expect(err).assertEqual("0");
console.debug('ACTS_MissionSnapshot_0500====<end catch (err) get')
done();
}
// console.debug('ACTS_MissionSnapshot_0500====<end')
// done();
}).catch(function (err) {
console.debug("=ACTS_MissionSnapshot_0500 catch err ====>"
+ ("json err 【") + JSON.stringify(err) + (""));
expect(err).assertEqual("false");
console.debug('ACTS_MissionSnapshot_0500====<end .catch(err)')
done();
});
});
} catch (err) {
expect(err).assertEqual("0");
console.debug('ACTS_MissionSnapshot_0500====<end catch(err)');
done();
}
})
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);
});
}
/*
* @tc.number: ACTS_MissionSnapshot_0600
* @tc.name: getAbilityMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(Promise)
*/
it('ACTS_MissionSnapshot_0600', 0, async function (done) {
console.debug('ACTS_MissionSnapshot_0600====<begin');
var subscriber;
var setTimeout = 5000;
var currentAlertTimeout;
var CommonEventSubscribeInfo = {
events: ["ACTS_MissionSnapshot_OnActive",
"ACTS_MissionSnapshot_onShow"
],
};
try {
commonEvent.createSubscriber(CommonEventSubscribeInfo).then(async (data) => {
console.debug("=ACTS_MissionSnapshot_0600 createSubscriber .then(data)=======>"
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,data=" + data);
subscriber = data;
await commonEvent.subscribe(subscriber, async (err, data) => {
clearTimeout(currentAlertTimeout);
console.debug("=ACTS_MissionSnapshot_0600 subscribe (err,data)=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
unsubscribe("subscribe", subscriber);
var m_missionId = -1;
var m_topAbility_bundleName = "";
var m_topAbility_abilityName = "";
var upperLimit = 10;
await abilityManager.getActiveAbilityMissionInfos(upperLimit, (err, data) => {
console.debug("=ACTS_MissionSnapshot_0600 err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
console.debug('ACTS_MissionSnapshot_0600 AbilityMissionInfo data.length ====>'
+ data.length);
if (!data.length) {
m_missionId = -99;
m_topAbility_bundleName = "";
m_topAbility_abilityName = "";
expect("if (!data.length) ").assertEqual(0);
unsubscribe("if (!data.length) ", subscriber);
console.debug('ACTS_MissionSnapshot_0600====<end 0')
done();
} else {
m_missionId = data[0].missionId;
m_topAbility_bundleName = data[0].topAbility.bundleName;
m_topAbility_abilityName = data[0].topAbility.abilityName;
}
console.debug("=ACTS_MissionSnapshot_0600 m_missionId====>" + m_missionId);
abilityManager.getAbilityMissionSnapshot(m_missionId).then(function (data) {
console.debug("=ACTS_MissionSnapshot_0600 then data====>"
+ ("json data 【") + JSON.stringify(data) + ("") + " , " + data);
try {
expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName);
expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName);
console.debug("=ACTS_MissionSnapshot_0600=====> JSON.stringify(data.snapshot)="
+ JSON.stringify(data.snapshot) + " , " + data.snapshot);
data.snapshot.getPixelBytesNumber().then(function (data){
console.debug("=ACTS_MissionSnapshot_0600 ====> "
+("data.snapshot.getPixelBytesNumber()=" + data))
expect(data != 0).assertEqual(true);
unsubscribe(".then() ", subscriber);
console.debug('ACTS_MissionSnapshot_0600====<end')
done();
})
} catch (err) {
expect(err).assertEqual("0");
unsubscribe("catch (err) get ", subscriber);
console.debug('ACTS_MissionSnapshot_0600====<end catch (err) get')
done();
}
}).catch(function (err) {
console.debug("=ACTS_MissionSnapshot_0600 catch err ====>"
+ ("json err 【") + JSON.stringify(err) + (""));
expect(err).assertEqual("false");
console.debug('ACTS_MissionSnapshot_0600====<end .catch(err)')
unsubscribe(" .catch(err)", subscriber);
done();
});
});
});
});
await featureAbility.startAbility(
{
want:
{
bundleName: "com.amsst.amsMissionSnapshotTestSingletonS",
abilityName: "com.amsst.amsMissionSnapshotTestSingletonS.MainAbility",
},
},
);
} catch (err) {
expect("0").assertEqual(err);
console.debug('ACTS_MissionSnapshot_0600====<end catch(err)')
done();
}
console.debug('ACTS_MissionSnapshot_0600====< 333')
currentAlertTimeout = setTimeout(() => {
console.debug('ACTS_MissionSnapshot_0600====<end setTimeout');
unsubscribe("setTimeout ", subscriber);
expect("Event False").assertEqual("Event timeout");
done();
}, setTimeout);
})
})
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "MissionSnapshot"
},
{
"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("amsMissionSnapshotTestSingleton") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "amsMissionSnapshotTestSingleton"
}
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"
}
{
"app": {
"bundleName": "com.amsst.amsMissionSnapshotTestSingleton",
"vendor": "amsst",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.amsMissionSnapshotTestSingleton",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"name": "com.amsst.amsMissionSnapshotTestSingleton.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "singleton",
"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('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication 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;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
STAbilityManagerMissionSnapshotSingleton
</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 commonEvent from '@ohos.commonevent'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
OnActive(){
console.debug('ACTS_MissionSnapshot_OnActive');
commonEvent.publish("ACTS_MissionSnapshot_OnActive", (err,data) =>{
console.debug("=ACTS_MissionSnapshot_OnActive err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
});
},
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);
});
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "StServiceAbilityServer"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
# 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("amsMissionSnapshotTestSingletonS") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "amsMissionSnapshotTestSingletonS"
}
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"
}
{
"app": {
"bundleName": "com.amsst.amsMissionSnapshotTestSingletonS",
"vendor": "amsst",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.amsMissionSnapshotTestSingletonS",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"name": "com.amsst.amsMissionSnapshotTestSingletonS.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "singleton",
"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('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication 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;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
STAbilityManagerMissionSnapshotSingletonS
</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 commonEvent from '@ohos.commonevent'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
OnActive(){
console.debug('ACTS_MissionSnapshot_OnActive');
commonEvent.publish("ACTS_MissionSnapshot_OnActive", (err,data) =>{
console.debug("=ACTS_MissionSnapshot_OnActive err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
});
},
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);
});
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "StServiceAbilityServer"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
......@@ -24,6 +24,7 @@ group("publish_test") {
#"publishcontentype:publishcontentype",
#"subscribe:subscribe",
"activebtn:activebtn",
"ansactscancelgroup:ActsAnsCancelGroup",
"ansactsremovegroup:ActsAnsRemoveGroup",
"donotdisturbmode:ActsAnsDoNotDisturbTest",
......
# 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")
group("activebtn") {
testonly = true
if (is_standard_system) {
deps = [
"activebutton:ActsAnsActionButtonTest",
"testa:testA",
"testb:testB",
"testc:testC",
]
}
}
# 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("ActsAnsActionButtonTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsActionButtonTest"
}
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": "60000",
"package": "com.example.actsansactionbuttontest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsActionButtonTest.hap",
"testA.hap",
"testB.hap",
"testC.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansactionbuttontest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansactionbuttontest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansactionbuttontest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"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;
}
/*
* 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": "ActiveBtn"
},
{
"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 notify from '@ohos.notification'
import WantAgent from '@ohos.wantAgent'
import { OperationType, WantAgentFlags } from '@ohos.wantagent'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ActsAnsActionButtonTest', function () {
console.info("===ActsDoNotSubscriberTest start===>");
function publishCallbacka(err){
console.debug("===>publishCallbacka===>"+err.code);
expect(err.code).assertEqual(0)
}
function publishCallbackb(err){
console.debug("===>publishCallbackb===>"+err.code);
expect(err.code).assertEqual(0)
}
function publishCallbackc(err){
console.debug("===>publishCallbackc===>"+err.code);
expect(err.code).assertEqual(0)
}
function consumeCallbackA(data) {
console.debug("===>consumeCallbackA data : ===>" +JSON.stringify(data));
var triggerInfo = {
code:0
}
expect(data.request.actionButtons[0].title).assertEqual("buttonA")
var wantAgenta = data.request.actionButtons[0].wantAgent
console.debug("===>titleA: ===>" + JSON.stringify(data.request.actionButtons[0].title))
console.debug("===>wantAgentA: ===>" + JSON.stringify(wantAgenta))
WantAgent.trigger(wantAgenta, triggerInfo,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerA success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerA failed!----'+err.code);
}
}
);
}
/*
* @tc.number: ActsActiveButton_test_0100
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsActiveButton_test_0100', 0, async function (done) {
console.debug("===ActsActiveButton_test_0100===begin===>");
var subInfo ={
onConsume:consumeCallbackA
}
notify.subscribe(subInfo);
var agentInfoA = {
wants: [
{
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var wantAgentData = await WantAgent.getWantAgent(agentInfoA);
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 1,
slotType : notify.SlotType.SERVICE_INFORMATION,
actionButtons: [{title:"buttonA", wantAgent:wantAgentData}]
}
await notify.publish(notificationRequest, publishCallbacka);
console.info("===ActsActiveButton_test_0100===end===>");
setTimeout((async function(){
notify.unsubscribe(subInfo);
console.info("======ActsActiveButton_test_0100 setTimeout unsubscribe===>");
done();
}),300);
})
//consume
function consumeCallbackB(data) {
console.debug("===>consumeCallbackB data : ===>" +JSON.stringify(data));
var triggerInfo = {
code:1
}
expect(data.request.actionButtons[0].title).assertEqual("buttonB")
var wantAgentB = data.request.actionButtons[0].wantAgent
console.debug("===>titleB: ===>" + JSON.stringify(data.request.actionButtons[0].title))
console.debug("===>wantAgentB: ===>" + JSON.stringify(wantAgentB))
WantAgent.trigger(wantAgentB, triggerInfo,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerB success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerB failed!----'+err.code);
}
}
);
}
/*
* @tc.number: ActsActiveButton_test_0200
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsActiveButton_test_0200', 0, async function (done) {
console.debug("===ActsActiveButton_test_0200===begin===>");
var subInfo ={
onConsume:consumeCallbackB
}
notify.subscribe(subInfo);
var agentInfoB = {
wants: [
{
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var wantAgentDataB = await WantAgent.getWantAgent(agentInfoB);
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 2,
slotType : notify.SlotType.SERVICE_INFORMATION,
actionButtons: [{title:"buttonB", wantAgent:wantAgentDataB}]
}
await notify.publish(notificationRequest).then(()=>{
console.info("===ActsActiveButton_test_0200===promise===>");
});
setTimeout((async function(){
notify.unsubscribe(subInfo);
console.info("======ActsActiveButton_test_0200 setTimeout unsubscribe===>");
done();
}),300);
})
function consumeCallbackC(data) {
console.debug("===>consumeCallbackC data : ===>" +JSON.stringify(data));
var triggerInfoC = {
code:2
}
var triggerInfoD = {
code:3
}
expect(data.request.actionButtons[0].title).assertEqual("buttonC")
expect(data.request.actionButtons[1].title).assertEqual("buttonD")
var wantAgentC = data.request.actionButtons[0].wantAgent
var wantAgentD = data.request.actionButtons[1].wantAgent
console.debug("===>wantAgentC: ===>" + JSON.stringify(wantAgentC))
console.debug("===>wantAgentD: ===>" + JSON.stringify(wantAgentD))
WantAgent.trigger(wantAgentC, triggerInfoC,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerC success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerC failed!----'+err.code);
}
});
WantAgent.trigger(wantAgentD, triggerInfoD,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerD success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerD failed!----'+err.code);
}
});
}
/*
* @tc.number: ActsActiveButton_test_0300
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsActiveButton_test_0300', 0, async function (done) {
console.debug("===ActsActiveButton_test_0300===begin===>");
var subInfo ={
onConsume:consumeCallbackC
}
await notify.subscribe(subInfo);
var agentInfoC = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var agentInfoD = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var wantAgentDataC = await WantAgent.getWantAgent(agentInfoC);
var wantAgentDataD = await WantAgent.getWantAgent(agentInfoD);
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 3,
slotType : notify.SlotType.SERVICE_INFORMATION,
actionButtons: [{title:"buttonC", wantAgent:wantAgentDataC},{title:"buttonD", wantAgent:wantAgentDataD}]
}
notify.publish(notificationRequest, publishCallbackb);
setTimeout((async function(){
notify.unsubscribe(subInfo);
console.info("======ActsActiveButton_test_0300 setTimeout unsubscribe===>");
done();
}),300);
})
function consumeCallbackD(data) {
console.debug("===>consumeCallbackD data : ===>" +JSON.stringify(data));
var triggerInfoE = {
code:4
}
var triggerInfoF = {
code:5
}
expect(data.request.actionButtons[0].title).assertEqual("buttonE")
expect(data.request.actionButtons[1].title).assertEqual("buttonF")
var wantAgentE = data.request.actionButtons[0].wantAgent
var wantAgentF = data.request.actionButtons[1].wantAgent
console.debug("===>wantAgentC: ===>" + JSON.stringify(wantAgentE))
console.debug("===>wantAgentD: ===>" + JSON.stringify(wantAgentF))
WantAgent.trigger(wantAgentE, triggerInfoE,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerInfoE success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerInfoE failed!----'+err.code);
}
});
WantAgent.trigger(wantAgentF, triggerInfoF,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerInfoF success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerInfoF failed!----'+err.code);
}
});
}
/*
* @tc.number: ActsActiveButton_test_0400
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsActiveButton_test_0400', 0, async function (done) {
console.debug("===ActsActiveButton_test_0400===begin===>");
var subInfo ={
onConsume:consumeCallbackD
}
await notify.subscribe(subInfo);
var agentInfoE = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var agentInfoF = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var wantAgentDataE = await WantAgent.getWantAgent(agentInfoE);
var wantAgentDataF = await WantAgent.getWantAgent(agentInfoF);
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 3,
slotType : notify.SlotType.SERVICE_INFORMATION,
actionButtons: [{title:"buttonE", wantAgent:wantAgentDataE},{title:"buttonF", wantAgent:wantAgentDataF}]
}
notify.publish(notificationRequest).then(()=>{
console.info("======ActsActiveButton_test_0400 promise===>");
});
setTimeout((async function(){
notify.unsubscribe(subInfo);
console.info("======ActsActiveButton_test_0400 setTimeout unsubscribe===>");
done();
}),300);
})
function consumeCallbackE(data) {
console.debug("===>consumeCallbackE data : ===>" +JSON.stringify(data));
var triggerInfoG = {
code:1
}
var triggerInfoH = {
code:2
}
var triggerInfoI = {
code:3
}
expect(data.request.actionButtons[0].title).assertEqual("buttonG")
expect(data.request.actionButtons[1].title).assertEqual("buttonH")
expect(data.request.actionButtons[2].title).assertEqual("buttonI")
var wantAgentG = data.request.actionButtons[0].wantAgent
var wantAgentH = data.request.actionButtons[1].wantAgent
var wantAgentI = data.request.actionButtons[2].wantAgent
console.debug("===>wantAgentG: ===>" + JSON.stringify(wantAgentG))
console.debug("===>wantAgentH: ===>" + JSON.stringify(wantAgentH))
console.debug("===>wantAgentI: ===>" + JSON.stringify(wantAgentI))
WantAgent.trigger(wantAgentG, triggerInfoG,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerG success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerG failed!----'+err.code);
}
});
WantAgent.trigger(wantAgentH, triggerInfoH,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerH success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerH failed!----'+err.code);
}
});
WantAgent.trigger(wantAgentI, triggerInfoI,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerI success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerI failed!----'+err.code);
}
});
}
/*
* @tc.number: ActsActiveButton_test_0500
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsActiveButton_test_0500', 0, async function (done) {
console.debug("===ActsActiveButton_test_0500===begin===>");
var subInfo ={
onConsume:consumeCallbackE
}
await notify.subscribe(subInfo);
var agentInfoG = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var agentInfoH = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var agentInfoI = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var wantAgentDataG = await WantAgent.getWantAgent(agentInfoG);
var wantAgentDataH = await WantAgent.getWantAgent(agentInfoH);
var wantAgentDataI = await WantAgent.getWantAgent(agentInfoI);
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 1,
slotType : notify.SlotType.SERVICE_INFORMATION,
actionButtons: [{title:"buttonG", wantAgent:wantAgentDataG},{title:"buttonH", wantAgent:wantAgentDataH},{title:"buttonI", wantAgent:wantAgentDataI}]
}
notify.publish(notificationRequest, publishCallbackc);
setTimeout((async function(){
notify.unsubscribe(subInfo);
console.info("======ActsActiveButton_test_0500 setTimeout unsubscribe===>");
done();
}),300);
})
function consumeCallbackF(data) {
console.debug("===>consumeCallbackF data : ===>" +JSON.stringify(data));
var triggerInfoJ = {
code:4
}
var triggerInfoK = {
code:5
}
var triggerInfoL = {
code:6
}
expect(data.request.actionButtons[0].title).assertEqual("buttonJ")
expect(data.request.actionButtons[1].title).assertEqual("buttonK")
expect(data.request.actionButtons[2].title).assertEqual("buttonL")
var wantAgentJ = data.request.actionButtons[0].wantAgent
var wantAgentK = data.request.actionButtons[1].wantAgent
var wantAgentL = data.request.actionButtons[2].wantAgent
console.debug("===>wantAgentJ: ===>" + JSON.stringify(wantAgentJ))
console.debug("===>wantAgentK: ===>" + JSON.stringify(wantAgentK))
console.debug("===>wantAgentL: ===>" + JSON.stringify(wantAgentL))
WantAgent.trigger(wantAgentJ, triggerInfoJ,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerJ success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerJ failed!----'+err.code);
}
});
WantAgent.trigger(wantAgentK, triggerInfoK,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerK success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerK failed!----'+err.code);
}
});
WantAgent.trigger(wantAgentL, triggerInfoL,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerI success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerI failed!----'+err.code);
}
});
}
/*
* @tc.number: ActsActiveButton_test_0600
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsActiveButton_test_0600', 0, async function (done) {
console.debug("===ActsActiveButton_test_0600===begin===>");
var subInfo ={
onConsume:consumeCallbackF
}
await notify.subscribe(subInfo);
var agentInfoJ = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var agentInfoK = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var agentInfoL = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.wantAgentTest",
abilityName: "com.example.wantAgentTest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var wantAgentDataJ = await WantAgent.getWantAgent(agentInfoJ);
var wantAgentDataK = await WantAgent.getWantAgent(agentInfoK);
var wantAgentDataL = await WantAgent.getWantAgent(agentInfoL);
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 1,
slotType : notify.SlotType.SERVICE_INFORMATION,
actionButtons: [{title:"buttonJ", wantAgent:wantAgentDataJ},{title:"buttonK", wantAgent:wantAgentDataK},{title:"buttonL", wantAgent:wantAgentDataL}]
}
notify.publish(notificationRequest).then(()=>{
console.info("======ActsActiveButton_test_0600 promise===>");
});
setTimeout((async function(){
notify.unsubscribe(subInfo);
console.info("======ActsActiveButton_test_0600 setTimeout unsubscribe===>");
done();
}),300);
})
function consumeCallbackG(data) {
console.debug("===>consumeCallbackG data : ===>" +JSON.stringify(data));
var triggerInfoM = {
code:7
}
var triggerInfoN = {
code:8
}
var triggerInfoO = {
code:9
}
// expect(data.request.actionButtons.length).assertEqual(3)
expect(data.request.actionButtons[0].title).assertEqual("buttonM")
expect(data.request.actionButtons[1].title).assertEqual("buttonN")
expect(data.request.actionButtons[2].title).assertEqual("buttonO")
var wantAgentM = data.request.actionButtons[0].wantAgent
var wantAgentN = data.request.actionButtons[1].wantAgent
var wantAgentO = data.request.actionButtons[2].wantAgent
console.debug("===>wantAgentM: ===>" + JSON.stringify(wantAgentM))
console.debug("===>wantAgentN: ===>" + JSON.stringify(wantAgentN))
console.debug("===>wantAgentO: ===>" + JSON.stringify(wantAgentO))
WantAgent.trigger(wantAgentM, triggerInfoM,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerM success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerM failed!----'+err.code);
}
});
WantAgent.trigger(wantAgentN, triggerInfoN,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerN success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerN failed!----'+err.code);
}
});
setTimeout((function(){
WantAgent.trigger(wantAgentO, triggerInfoO,
(err, data) => {
if (err.code == 0) {
console.info('==== triggerO success' + err.code+JSON.stringify(data) );
} else {
console.info('----triggerO failed!----'+err.code);
}
});
}),300);
}
/*
* @tc.number: ActsActiveButton_test_0700
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsActiveButton_test_0700', 0, async function (done) {
console.debug("===ActsActiveButton_test_0700===begin===>");
var subInfo ={
onConsume:consumeCallbackG
}
await notify.subscribe(subInfo);
var agentInfoM = {
wants: [
{
bundleName: "com.example.wantAgentTestA",
abilityName: "com.example.wantAgentTestA.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var agentInfoN = {
wants: [
{
bundleName: "com.example.wantAgentTestB",
abilityName: "com.example.wantAgentTestB.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var agentInfoO = {
wants: [
{
bundleName: "com.example.wantAgentTestC",
abilityName: "com.example.wantAgentTestC.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var agentInfoP = {
wants: [
{
bundleName: "com.example.wantAgentTestA",
abilityName: "com.example.wantAgentTestA.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var wantAgentDataM = await WantAgent.getWantAgent(agentInfoM);
var wantAgentDataN = await WantAgent.getWantAgent(agentInfoN);
var wantAgentDataO = await WantAgent.getWantAgent(agentInfoO);
var wantAgentDataP = await WantAgent.getWantAgent(agentInfoP);
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 1,
slotType : notify.SlotType.SERVICE_INFORMATION,
actionButtons: [{title:"buttonM", wantAgent:wantAgentDataM},{title:"buttonN", wantAgent:wantAgentDataN},{title:"buttonO", wantAgent:wantAgentDataO},{title:"buttonP", wantAgent:wantAgentDataP}]
}
notify.publish(notificationRequest).then(()=>{
console.info("======ActsActiveButton_test_0700 promise===>");
});
setTimeout((async function(){
notify.unsubscribe(subInfo);
console.info("======ActsActiveButton_test_0700 setTimeout unsubscribe===>");
done();
}),300);
})
})
/*
* 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 notify from '@ohos.notification';
import { OperationType, WantAgentFlags} from '@ohos.wantagent';
import wantagent from '@ohos.wantAgent'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var timeout = 300;
describe('ActsAnsPublishInput', function () {
console.info("===========ActsAnsPublishInput start====================>");
function onConsumeOne(data) {
console.info("=========Ans_PublishInput_0100 onConsume start==============>");
console.info("=========Ans_PublishInput_0100 onConsume data:==============>" + JSON.stringify(data));
var inputKey = data.request.actionButtons[0].userInput.inputKey
console.info("=========Ans_PublishInput_0100 onConsume inputKey================>"+inputKey);
expect(inputKey).assertEqual("inputKey_0100");
console.info("=========Ans_PublishInput_0100 onConsume end================>");
}
/*
* @tc.number: Ans_PublishInput_0100
* @tc.name: publish(request: NotificationRequest): Promise<void>;
* @tc.desc: Verify that the inputKey information can be received in the received notification.
*/
it('Ans_PublishInput_0100', 0, async function (done) {
console.info("==================Ans_PublishInput_0100 start==================>");
var subscriber = {
onConsume:onConsumeOne,
}
var agentInfo = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.actsanspublishinput",
abilityName: "com.example.actsanspublishinput.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var wantAgentData = await wantagent.getWantAgent(agentInfo);
console.info("===========Ans_PublishInput_0100 getWantAgent promise======>");
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 1,
slotType : notify.SlotType.SERVICE_INFORMATION,
wantAgent: wantAgentData,
actionButtons: [
{
title:"button1",
wantAgent:wantAgentData,
userInput : {
inputKey: "inputKey_0100",
}
}]
}
await notify.subscribe(subscriber);
console.info("===========Ans_PublishInput_0100 subscribe promise======>");
await notify.publish(notificationRequest);
console.info("===========Ans_PublishInput_0100 publish promise========>");
setTimeout((async function(){
console.info("======Ans_PublishInput_0100 setTimeout==============>");
notify.unsubscribe(subscriber);
console.info("======Ans_PublishInput_0100 setTimeout unsubscribe==>");
done();
}),timeout);
})
function onConsumeTwo(data) {
console.info("=========Ans_PublishInput_0200 onConsume start==============>");
console.info("=========Ans_PublishInput_0200 onConsume data:==============>" + JSON.stringify(data));
var inputKey = data.request.actionButtons[0].userInput.inputKey
console.info("=========Ans_PublishInput_0200 onConsume inputKey================>"+inputKey);
expect(inputKey).assertEqual(" ");
console.info("=========Ans_PublishInput_0200 onConsume end================>");
}
/*
* @tc.number: Ans_PublishInput_0200
* @tc.name: publish(request: NotificationRequest): Promise<void>;
* @tc.desc: Verify that the inputKey information can be received in the received notification.(inputKey = " ")
*/
it('Ans_PublishInput_0200', 0, async function (done) {
console.info("==================Ans_PublishInput_0200 start==================>");
var subscriber = {
onConsume:onConsumeTwo,
}
var agentInfo = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.actsanspublishinput",
abilityName: "com.example.actsanspublishinput.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
};
var wantAgentData = await wantagent.getWantAgent(agentInfo);
console.info("===========Ans_PublishInput_0200 getWantAgent promise======>");
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 2,
slotType : notify.SlotType.SERVICE_INFORMATION,
wantAgent: wantAgentData,
actionButtons: [
{
title:"button2",
wantAgent:wantAgentData,
userInput : {
inputKey: " ",
}
}]
}
await notify.subscribe(subscriber);
console.info("===========Ans_PublishInput_0200 subscribe promise======>");
await notify.publish(notificationRequest);
console.info("===========Ans_PublishInput_0200 publish promise========>");
setTimeout((async function(){
console.info("======Ans_PublishInput_0200 setTimeout==============>");
notify.unsubscribe(subscriber);
console.info("======Ans_PublishInput_0200 setTimeout unsubscribe==>");
done();
}),timeout);
})
})
\ 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('./publishIcon.js')
require('./publishImage.js')
require('./ActsAnsPublishInput.js')
require('./ActiveButton.js')
/*
* 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 notification from '@ohos.notification'
import image from '@ohos.multimedia.image'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var ERR_ANS_ICON_OVER_SIZE = 67108882
var largeIconA
var smallIconA
var largeBufferA
var smallBufferA
var largeOptsA
var smallOptsA
var largeIconB
var smallIconB
var largeBufferB
var smallBufferB
var largeOptsB
var smallOptsB
var largeIconC
var smallIconC
var largeBufferC
var smallBufferC
var largeOptsC
var smallOptsC
var largeIconD
var smallIconD
var largeBufferD
var smallBufferD
var largeOptsD
var smallOptsD
describe('ActsAnsPublishIconTest', function () {
function publishCallbackA(err){
console.log('ActsAnsPublishIconTest publishCallbackA asyncCallback'+err.code)
expect(err.code).assertEqual(0)
}
function publishCallbackB(err){
console.log('ActsAnsPublishIconTest publishCallbackB asyncCallback'+err.code)
expect(err.code).assertEqual(ERR_ANS_ICON_OVER_SIZE)
}
function consumeCallbackA(data) {
console.debug("===consumeCallbackA data : ===>" + JSON.stringify(data));
expect(data.request.id).assertEqual(1)
}
function consumeCallbackB(data) {
console.debug("===consumeCallbackB data : ===>" + JSON.stringify(data));
expect(data.request.id).assertEqual(2)
}
function subscribeCallbackA(err) {
console.info("===subscribeCallbackA err : ===>" + JSON.stringify(err));
expect(err.code).assertEqual(0)
}
function subscribeCallbackB(err) {
console.info("===subscribeCallbackB err : ===>" + JSON.stringify(err));
expect(err.code).assertEqual(0)
}
/*
* @tc.number: ACTS_PublishIconTest_0100
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it('ACTS_PublishIconTest_0100', 0,async function (done) {
var subInfo ={
onConsume:consumeCallbackA,
}
await notification.subscribe(subInfo,subscribeCallbackA);
largeBufferA = new ArrayBuffer(4*100*100);
smallBufferA = new ArrayBuffer(4*2*25);
largeOptsA = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 100, width: 100}}
smallOptsA = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}}
const promise_Large = image.createPixelMap(largeBufferA, largeOptsA);
promise_Large.then((data) => {
largeIconA = data;
console.debug("===createPixelMapA largeIcon===>"+JSON.stringify(largeIconA));
const promise_Small = image.createPixelMap(smallBufferA, smallOptsA);
promise_Small.then((data) => {
smallIconA = data;
console.debug("===createPixelMapA smallIcon===>"+JSON.stringify(smallIconA));
notification.publish({
content:{
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_titleA",
text: "test_textA",
additionalText: "test_additionalTextA"
},
},
id: 1,
slotType : notification.SlotType.OTHER_TYPES,
isOngoing : true,
isUnremovable : false,
deliveryTime : 1624950453,
tapDismissed : true,
autoDeletedTime: 1625036817,
color: 2,
colorEnabled: true,
isAlertOnce: true,
isStopwatch: true,
isCountDown: true,
progressValue: 12,
progressMaxValue: 100,
isIndeterminate: true,
statusBarText: "statusBarText",
isFloatingIcon : true,
label: "0100_1",
badgeIconStyle: 1,
showDeliveryTime: true,
smallIcon:smallIconA,
largeIcon:largeIconA,
},publishCallbackA);
setTimeout((async function(){
notification.unsubscribe(subInfo);
console.info("======ActsPublishImage_test_0100 setTimeout unsubscribe===>");
done();
}),300);
})
});
});
/*
* @tc.number: ACTS_PublishTest_0200
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it('ACTS_PublishIconTest_0200', 0,async function (done) {
var subInfo ={
onConsume:consumeCallbackB,
}
await notification.subscribe(subInfo,subscribeCallbackB);
largeBufferB = new ArrayBuffer(4*200*50);
smallBufferB = new ArrayBuffer(4*2*25);
largeOptsB = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 50, width: 200}}
smallOptsB = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}}
const promise_Large = image.createPixelMap(largeBufferB, largeOptsB);
promise_Large.then((data) => {
largeIconB = data;
console.debug("===createPixelMapB largeIcon===>"+JSON.stringify(largeIconB));
const promise_Small = image.createPixelMap(smallBufferB, smallOptsB);
promise_Small.then((data) => {
smallIconB = data;
console.debug("===createPixelMapB smallIcon===>"+JSON.stringify(smallIconB));
notification.publish({
content:{
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_titleB",
text: "test_textB",
additionalText: "test_additionalTextB"
},
},
id: 2,
slotType : notification.SlotType.OTHER_TYPES,
isOngoing : true,
isUnremovable : false,
deliveryTime : 1624950453,
tapDismissed : true,
autoDeletedTime: 1625036817,
color: 2,
colorEnabled: true,
isAlertOnce: true,
isStopwatch: true,
isCountDown: true,
progressValue: 12,
progressMaxValue: 100,
isIndeterminate: true,
statusBarText: "statusBarText",
isFloatingIcon : true,
label: "0100_1",
badgeIconStyle: 1,
showDeliveryTime: true,
smallIcon:smallIconB,
largeIcon:largeIconB,
}).then(()=>{
console.debug("===ACTS_PublishIconTest_0200 promise===>");
});
setTimeout((async function(){
notification.unsubscribe(subInfo);
console.info("======ActsPublishImage_test_0200 setTimeout unsubscribe===>");
done();
}),300);
})
});
});
/*
* @tc.number: ACTS_PublishIconTest_0300
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it('ACTS_PublishIconTest_0300', 0,async function (done) {
largeBufferC = new ArrayBuffer(4*1024*50);
smallBufferC = new ArrayBuffer(4*2*25);
largeOptsC = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 50, width: 1024}}
smallOptsC = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}}
const promise_Large = image.createPixelMap(largeBufferC, largeOptsC);
promise_Large.then((data) => {
largeIconC = data;
console.debug("===createPixelMapC largeIcon===>"+JSON.stringify(largeIconC));
const promise_Small = image.createPixelMap(smallBufferC, smallOptsC);
promise_Small.then((data) => {
smallIconC = data;
console.debug("===createPixelMapC smallIcon===>"+JSON.stringify(smallIconC));
notification.publish({
content:{
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_titleC",
text: "test_textC",
additionalText: "test_additionalTextC"
},
},
id: 3,
slotType : notification.SlotType.OTHER_TYPES,
isOngoing : true,
isUnremovable : false,
deliveryTime : 1624950453,
tapDismissed : true,
autoDeletedTime: 1625036817,
color: 2,
colorEnabled: true,
isAlertOnce: true,
isStopwatch: true,
isCountDown: true,
progressValue: 12,
progressMaxValue: 100,
isIndeterminate: true,
statusBarText: "statusBarText",
isFloatingIcon : true,
label: "0100_1",
badgeIconStyle: 1,
showDeliveryTime: true,
smallIcon:smallIconC,
largeIcon:largeIconC,
},publishCallbackB);
done();
})
});
});
/*
* @tc.number: ACTS_PublishTest_0400
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it('ACTS_PublishIconTest_0400', 0,async function (done) {
largeBufferD = new ArrayBuffer(4*1024*50);
smallBufferD = new ArrayBuffer(4*2*25);
largeOptsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 50, width: 1024}}
smallOptsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}}
const promise_Large = image.createPixelMap(largeBufferD, largeOptsD);
promise_Large.then((data) => {
largeIconD = data;
console.debug("===createPixelMapD largeIcon===>"+JSON.stringify(largeIconD));
const promise_Small = image.createPixelMap(smallBufferD, smallOptsD);
promise_Small.then((data) => {
smallIconD = data;
console.debug("===createPixelMapD smallIcon===>"+JSON.stringify(smallIconD));
notification.publish({
content:{
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test1_title",
text: "test1_text",
additionalText: "test1_additionalText"
},
},
id: 4,
slotType : notification.SlotType.OTHER_TYPES,
isOngoing : true,
isUnremovable : false,
deliveryTime : 1624950453,
tapDismissed : true,
autoDeletedTime: 1625036817,
color: 2,
colorEnabled: true,
isAlertOnce: true,
isStopwatch: true,
isCountDown: true,
progressValue: 12,
progressMaxValue: 100,
isIndeterminate: true,
statusBarText: "statusBarText",
isFloatingIcon : true,
label: "0100_1",
badgeIconStyle: 1,
showDeliveryTime: true,
smallIcon:smallIconD,
largeIcon:largeIconD,
}).then().catch((err)=>{
console.debug("===ACTS_PublishIconTest_0400 promise===>"+err.code);
expect(err.code).assertEqual(ERR_ANS_ICON_OVER_SIZE)
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 notify from '@ohos.notification'
import image from '@ohos.multimedia.image'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var BufferA
var BufferB
var BufferC
var BufferD
var optsA
var optsB
var optsC
var optsD
var pubimageA
var pubimageB
var pubimageC
var pubimageD
var ERR_ANS_PICTURE_OVER_SIZE = 67108883
describe('ActsAnsPublishImageTest', function () {
console.info("===ActsAnsPublishImageTest start===>");
//consume
function consumeCallbackA(data) {
console.debug("===>consumeDoNotCallback1 data : ===>" + JSON.stringify(data));
expect(data.request.id).assertEqual(1)
}
function consumeCallbackB(data) {
console.debug("===>consumeDoNotCallback2 data : ===>" +JSON.stringify(data));
expect(data.request.id).assertEqual(2)
}
//subscribe
function subscribeCallbackA(err) {
console.debug("===>subscribeCallbackA===>"+err.code);
expect(err.code).assertEqual(0)
}
function subscribeCallbackB(err) {
console.debug("===>subscribeCallbackB===>"+err.code);
expect(err.code).assertEqual(0)
}
function publishCallbackA(err){
console.log('ActsAnsPublishImageTest publishCallbackA asyncCallback'+err.code)
expect(err.code).assertEqual(0)
}
function publishCallbackB(err){
console.log('ActsAnsPublishImageTest publishCallbackB asyncCallback'+err.code)
expect(err.code).assertEqual(ERR_ANS_PICTURE_OVER_SIZE)
}
/*
* @tc.number: ActsPublishImage_test_0100
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsPublishImage_test_0100', 0, async function (done) {
console.debug("===ActsDoNotSubscriber_test_0100===begin===>");
var subInfo ={
onConsume:consumeCallbackA,
}
await notify.subscribe(subInfo, subscribeCallbackA);
BufferA = new ArrayBuffer(32);
optsA = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 2, width: 3}}
const promise_Large = image.createPixelMap(BufferA, optsA);
promise_Large.then((data) => {
pubimageA = data;
console.debug("===createPixelMapA image===>"+pubimageA);
notify.publish({
id: 1,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: {
title: "image_titleA",
text: "image_textA",
additionalText: "image_additionalTextA",
briefText:"image_briefA",
expandedTitle:"expandedTitleA",
picture:pubimageA
},
},
slotType:notify.SlotType.SOCIAL_COMMUNICATION,
classification:"classificationA",
sortingKey:"sortingKeyA",
},publishCallbackA);
setTimeout((async function(){
notify.unsubscribe(subInfo);
console.info("======ActsPublishImage_test_0100 setTimeout unsubscribe===>");
done();
}),300);
})
})
/*
* @tc.number: ActsPublishImage_test_0200
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsPublishImage_test_0200', 0, async function (done) {
console.debug("===ActsPublishImage_test_0200===begin===>");
var subInfo ={
onConsume:consumeCallbackB,
}
await notify.subscribe(subInfo, subscribeCallbackB);
BufferB = new ArrayBuffer(32);
optsB = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 2, width: 3}}
const promise_Large = image.createPixelMap(BufferB, optsB);
promise_Large.then((data) => {
pubimageB = data;
console.debug("===createPixelMapB image===>"+pubimageB);
notify.publish({
id: 2,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: {
title: "image_titleB",
text: "image_textB",
additionalText: "image_additionalTextB",
briefText:"image_briefB",
expandedTitle:"expandedTitleB",
picture:pubimageB
},
},
slotType:notify.SlotType.SOCIAL_COMMUNICATION,
classification:"classificationB",
sortingKey:"sortingKeyB",
}).then(()=> {
console.debug("===ActsPublishImage_test_0200 promise===>")
})
setTimeout((async function(){
notify.unsubscribe(subInfo);
console.info("===ActsPublishImage_test_0200 setTimeout unsubscribe===>");
done();
}),300);
})
})
/*
* @tc.number: ActsPublishImage_test_0300
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsPublishImage_test_0300', 0, async function (done) {
console.debug("===ActsPublishImage_test_0300===begin===>");
BufferC = new ArrayBuffer( 4*1024* 2048);
optsC = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 1024, width: 2048}}
const promise_Large = image.createPixelMap(BufferC, optsC);
promise_Large.then((data) => {
pubimageC = data;
console.debug("====createPixelMapC image===>"+pubimageC);
notify.publish({
id: 3,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: {
title: "image_titleC",
text: "image_textC",
additionalText: "image_additionalTextC",
briefText:"image_briefC",
expandedTitle:"expandedTitleC",
picture:pubimageC
},
},
slotType:notify.SlotType.SOCIAL_COMMUNICATION,
classification:"classificationC",
sortingKey:"sortingKeyC",
},publishCallbackB);
done();
})
})
/*
* @tc.number: ActsPublishImage_test_0400
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsPublishImage_test_0400', 0, async function (done) {
console.debug("===ActsPublishImage_test_0400===begin===>");
BufferD = new ArrayBuffer( 4*1024* 2048);
optsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 1024, width: 2048}}
const promise_Large = image.createPixelMap(BufferD, optsD);
promise_Large.then((data) => {
pubimageD = data;
console.debug("===createPixelMapD image===>"+pubimageD);
notify.publish({
id: 4,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: {
title: "image_titleD",
text: "image_textD",
additionalText: "image_additionalTextD",
briefText:"image_briefD",
expandedTitle:"expandedTitleD",
picture:pubimageD
},
},
slotType:notify.SlotType.SOCIAL_COMMUNICATION,
classification:"classificationD",
sortingKey:"sortingKeyD",
}).then().catch((err)=>{
console.debug("===ActsPublishImage_test_0400 err===>"+err.code);
expect(err.code).assertEqual(ERR_ANS_PICTURE_OVER_SIZE)
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("testA") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "testA"
}
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",
}
{
"app": {
"bundleName": "com.example.wantAgentTestA",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.wantAgentTestA",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.wantAgentTestA.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"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;
}
/*
* 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)
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "test1"
},
{
"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("testB") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "testB"
}
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",
}
{
"app": {
"bundleName": "com.example.wantAgentTestB",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.wantAgentTestB",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.wantAgentTestB.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"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;
}
/*
* 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)
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "test2"
},
{
"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("testC") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "testC"
}
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",
}
{
"app": {
"bundleName": "com.example.wantAgentTestC",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.wantAgentTestC",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.wantAgentTestC.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"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;
}
/*
* 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)
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "test3"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
......@@ -9,7 +9,8 @@
"kits": [
{
"test-file-name": [
"ActsAnsBadgeDisplayTest.hap"
"ActsAnsBadgeDisplayTest.hap",
"localcandisplay.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var WantAgenta;
......@@ -55,7 +55,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoa,
(err, data) => {
......@@ -135,7 +135,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfod).then(
(data) => {
......@@ -198,7 +198,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfob,(err,data)=>{
WantAgentb = data
......@@ -227,7 +227,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoc,
(err, data) => {
......@@ -302,7 +302,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoe,(err,data)=>{
console.log("=======agentInfoe======="+err.code+JSON.stringify(data))
......@@ -332,7 +332,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfof,
(err, data) => {
......@@ -394,7 +394,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfoe,(err,data)=>{
WantAgentd = data
......@@ -423,7 +423,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
wantAgent.getWantAgent(agentInfof,
(err, data) => {
......
......@@ -17,7 +17,7 @@ import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ActsAnsPublishSoundTest', function () {
console.info("===========ActsAnsPublishSoundTest start====================>");
var timeout = 300
var timeout = 1000
var bundleoption = {
bundle: "com.example.actsanspublishsoundtest"
}
......@@ -1021,4 +1021,4 @@ describe('ActsAnsPublishSoundTest', function () {
done();
}),timeout);
});
})
\ No newline at end of file
})
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -32,8 +32,8 @@ describe('ActsAnsWantAgentOneTest', function () {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -52,7 +52,7 @@ describe('ActsAnsWantAgentOneTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
await wantAgent.getWantAgent(agentInfo,
......@@ -73,8 +73,8 @@ describe('ActsAnsWantAgentOneTest', function () {
expect(data.finalCode).assertEqual(0);
expect(data.finalData).assertEqual("");
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.neu.WantAgentTest1");
expect(data.want.abilityName).assertEqual("com.example.test.MainAbility");
expect(data.want.bundleName).assertEqual("com.example.WantAgentTest1");
expect(data.want.abilityName).assertEqual("com.example.WantAgentTest1.MainAbility");
expect(data.want.uri).assertEqual("key={true,true,false}");
expect(JSON.stringify(data.want.entities)).assertEqual(JSON.stringify(["entity1"]));
expect(data.want.action).assertEqual("action1");
......@@ -112,7 +112,7 @@ describe('ActsAnsWantAgentOneTest', function () {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
......@@ -132,7 +132,7 @@ describe('ActsAnsWantAgentOneTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.ONE_TIME_FLAG]
wantAgentFlags:[WantAgentFlags.ONE_TIME_FLAG]
}
console.info('----getWantAgent before----');
await wantAgent.getWantAgent(agentInfo,
......@@ -165,7 +165,7 @@ describe('ActsAnsWantAgentOneTest', function () {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
......@@ -185,7 +185,7 @@ describe('ActsAnsWantAgentOneTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.NO_BUILD_FLAG]
wantAgentFlags:[WantAgentFlags.NO_BUILD_FLAG]
}
console.info('----getWantAgent before----');
await wantAgent.getWantAgent(agentInfo,
......@@ -218,7 +218,7 @@ describe('ActsAnsWantAgentOneTest', function () {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
......@@ -238,7 +238,7 @@ describe('ActsAnsWantAgentOneTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.CANCEL_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.CANCEL_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
await wantAgent.getWantAgent(agentInfo,
......@@ -271,7 +271,7 @@ describe('ActsAnsWantAgentOneTest', function () {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
......@@ -291,7 +291,7 @@ describe('ActsAnsWantAgentOneTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.CONSTANT_FLAG]
wantAgentFlags:[WantAgentFlags.CONSTANT_FLAG]
}
console.info('----getWantAgent before----');
await wantAgent.getWantAgent(agentInfo,
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -22,7 +22,7 @@ describe('ActsAnsWantAgentOneProTest', function () {
console.info('----ActsWantAgentTest----');
/*
* @tc.number: ACTS_SetWant_0100
* @tc.number: ACTS_SetWant_0200
* @tc.name: getWantAgent(OperationType.START_ABILITY)
* @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY)
*/
......@@ -30,9 +30,8 @@ describe('ActsAnsWantAgentOneProTest', function () {
var agentInfo = {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -51,7 +50,7 @@ describe('ActsAnsWantAgentOneProTest', function () {
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
wantAgent.getWantAgent(agentInfo).then(
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -29,9 +29,8 @@ describe('ActsAnsWantAgentTwoTest', function () {
var agentInfo = {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -48,9 +47,8 @@ describe('ActsAnsWantAgentTwoTest', function () {
}
},
{
deviceId: "",
bundleName: "com.neu.WantAgenTest2",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgenTest2",
abilityName: "com.example.WantAgenTest2.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -69,7 +67,7 @@ describe('ActsAnsWantAgentTwoTest', function () {
],
operationType: OperationType.START_ABILITIES,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
wantAgent.getWantAgent(agentInfo,
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -29,9 +29,8 @@ describe('ActsAnsWantAgentTwoProTest', function () {
var agentInfo = {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -48,9 +47,8 @@ describe('ActsAnsWantAgentTwoProTest', function () {
}
},
{
deviceId: "",
bundleName: "com.neu.WantAgenTest2",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgenTest2",
abilityName: "com.example.WantAgenTest2.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -69,7 +67,7 @@ describe('ActsAnsWantAgentTwoProTest', function () {
],
operationType: OperationType.START_ABILITIES,
requestCode: 0,
// wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
wantAgent.getWantAgent(agentInfo).then(
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -29,9 +29,8 @@ describe('ActsAnsWantAgentTreeTest', function () {
var agentInfo = {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -50,7 +49,7 @@ describe('ActsAnsWantAgentTreeTest', function () {
],
operationType: OperationType.SEND_COMMON_EVENT,
requestCode: 0,
// wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
wantAgent.getWantAgent(agentInfo,
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -29,9 +29,8 @@ describe('ActsAnsWantAgentTreeProTest', function () {
var agentInfo = {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -50,7 +49,7 @@ describe('ActsAnsWantAgentTreeProTest', function () {
],
operationType: OperationType.SEND_COMMON_EVENT,
requestCode: 0,
// wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
wantAgent.getWantAgent(agentInfo).then(
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -30,8 +30,8 @@ describe('ActsAnsWantAgentFourTest', function () {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -50,7 +50,7 @@ describe('ActsAnsWantAgentFourTest', function () {
],
operationType: OperationType.UNKNOWN_TYPE,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
wantAgent.getWantAgent(agentInfo,
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -29,9 +29,8 @@ describe('ActsAnsWantAgentFourProTest', function () {
var agentInfo = {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -50,7 +49,7 @@ describe('ActsAnsWantAgentFourProTest', function () {
],
operationType: OperationType.UNKNOWN_TYPE,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
wantAgent.getWantAgent(agentInfo).then(
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -29,9 +29,8 @@ describe('ActsAnsWantAgentFiveTest', function () {
var agentInfo = {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -50,7 +49,7 @@ describe('ActsAnsWantAgentFiveTest', function () {
],
// operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
wantAgent.getWantAgent(agentInfo,
......
......@@ -14,7 +14,7 @@
*/
import wantAgent from '@ohos.wantAgent';
import { OperationType, Flags } from '@ohos.wantagent';
import { OperationType, WantAgentFlags } from '@ohos.wantagent';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
var time = 1000
var WantAgent;
......@@ -29,9 +29,8 @@ describe('ActsAnsWantAgentFiveProTest', function () {
var agentInfo = {
wants: [
{
deviceId: "",
bundleName: "com.neu.WantAgentTest1",
abilityName: "com.example.test.MainAbility",
bundleName: "com.example.WantAgentTest1",
abilityName: "com.example.WantAgentTest1.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
......@@ -50,7 +49,7 @@ describe('ActsAnsWantAgentFiveProTest', function () {
],
// operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG]
}
console.info('----getWantAgent before----');
wantAgent.getWantAgent(agentInfo).then(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册