未验证 提交 a5242ed8 编写于 作者: O openharmony_ci 提交者: Gitee

!2495 new use case

Merge pull request !2495 from 火箭龟/rmds0315
......@@ -18,6 +18,7 @@ group("resourceschedule_standard") {
if (is_standard_system) {
deps = [
"backgroundtaskmanager:resourceschedule_backgroundtaskmanager_js_test",
"deviceusagestatisticsjsunit:resourceschedule_deviceusagestatisticsjsunit_js_test",
"reminderagent:resourceschedule_reminderagent_js_test",
"workscheduler:resourceschedule_workscheduler_js_test",
]
......
# 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("resourceschedule_deviceusagestatisticsjsunit_js_test") {
hap_profile = "./src/main/config.json"
deps = [
":resourceschedule_js_assets",
":resourceschedule_js_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsResourcescheduleDeviceUsageStatisticsJsunitTest"
}
ohos_js_assets("resourceschedule_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("resourceschedule_js_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for resourceschedule js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsResourcescheduleDeviceUsageStatisticsJsunitTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "鸿蒙"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {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() {
},
}
/*
* Copyright (C) 2022 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 bundleState from '@ohos.bundleState'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe("DeviceUsageStatisticsJsTest", function () {
beforeAll(function() {
/*
* @tc.setup: setup invoked before all testcases
*/
console.info('beforeAll called')
})
afterAll(function() {
/*
* @tc.teardown: teardown invoked after all testcases
*/
console.info('afterAll called')
})
beforeEach(function() {
/*
* @tc.setup: setup invoked before each testcases
*/
console.info('beforeEach called')
})
afterEach(function() {
/*
* @tc.teardown: teardown invoked after each testcases
*/
console.info('afterEach caled')
})
/*
* @tc.name: DeviceUsageStatisticsJsTest001
* @tc.desc: test isIdleState promise.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89H AR000GH89I AR000GH899
*/
it("DeviceUsageStatisticsJsTest001", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest001---------------------------');
let bundleName = 'com.example.deviceUsageStatistics';
bundleState.isIdleState(bundleName).then((res) => {
console.info('BUNDLE_ACTIVE isIdleState promise success.');
expect(true).assertEqual(true);
}).catch((err) => {
expect(false).assertEqual(true);
console.info('BUNDLE_ACTIVE isIdleState promise failure.');
});
setTimeout(()=>{
done();
}, 500);
})
/*
* @tc.name: DeviceUsageStatisticsJsTest002
* @tc.desc: test isIdleState callback.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89E AR000GH89F AR000GH89G
*/
it("DeviceUsageStatisticsJsTest002", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest002---------------------------');
let bundleName = 'com.example.deviceUsageStatistics';
bundleState.isIdleState(bundleName, (err, res) => {
if(err.code === 0) {
console.info('BUNDLE_ACTIVE isIdleState callback success.');
expect(true).assertEqual(true);
} else {
expect(false).assertEqual(true);
console.info('BUNDLE_ACTIVE isIdleState callback failure.');
}
});
setTimeout(()=>{
done();
}, 500);
})
/*
* @tc.name: DeviceUsageStatisticsJsTest003
* @tc.desc: test queryAppUsagePriorityGroup promise.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89H AR000GH89I AR000GH899
*/
it("DeviceUsageStatisticsJsTest003", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest003---------------------------');
bundleState.queryAppUsagePriorityGroup().then( res => {
console.info('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise success.');
expect(true).assertEqual(true)
}).catch( err => {
expect(false).assertEqual(true)
console.info('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failure.');
});
setTimeout(()=>{
done();
}, 500);
})
/*
* @tc.name: DeviceUsageStatisticsJsTest004
* @tc.desc: test queryAppUsagePriorityGroup callback.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89E AR000GH89F AR000GH89G
*/
it("DeviceUsageStatisticsJsTest004", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest004---------------------------');
bundleState.queryAppUsagePriorityGroup((err, res) => {
if(err.code === 0) {
console.info('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback success.');
expect(true).assertEqual(true)
} else {
expect(false).assertEqual(true)
console.info('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback failure.');
}
});
setTimeout(()=>{
done();
}, 500);
})
/*
* @tc.name: DeviceUsageStatisticsJsTest005
* @tc.desc: test queryBundleActiveStates promise.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89H AR000GH89I AR000GH899
*/
it("DeviceUsageStatisticsJsTest005", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest005---------------------------');
let beginTime = 0;
let endTime = 20000000000000;
bundleState.queryBundleActiveStates(beginTime, endTime).then((res) => {
console.info('BUNDLE_ACTIVE queryBundleActiveStates promise success.');
expect(true).assertEqual(true);
}).catch((err) => {
expect(false).assertEqual(true);
console.info('BUNDLE_ACTIVE queryBundleActiveStates promise failure.');
});
setTimeout(()=>{
done();
}, 500);
})
/*
* @tc.name: DeviceUsageStatisticsJsTest006
* @tc.desc: test queryBundleActiveStates callback.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89E AR000GH89F AR000GH89G
*/
it("DeviceUsageStatisticsJsTest006", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest006---------------------------');
let beginTime = 0;
let endTime = 20000000000000;
bundleState.queryBundleActiveStates(beginTime, endTime, (err, res) => {
if(err.code === 0) {
console.info('BUNDLE_ACTIVE queryBundleActiveStates callback success.');
expect(true).assertEqual(true);
} else {
expect(false).assertEqual(true);
console.info('BUNDLE_ACTIVE queryBundleActiveStates callback failure.');
}
});
setTimeout(()=>{
done();
}, 500);
})
/*
* @tc.name: DeviceUsageStatisticsJsTest007
* @tc.desc: test queryBundleStateInfos promise.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89H AR000GH89I AR000GH899
*/
it("DeviceUsageStatisticsJsTest007", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest007---------------------------');
let beginTime = 0;
let endTime = 20000000000000;
bundleState.queryBundleStateInfos(beginTime, endTime).then((res) => {
console.info('BUNDLE_ACTIVE queryBundleStateInfos promise success.');
expect(true).assertEqual(true);
}).catch((err) => {
expect(false).assertEqual(true);
console.info('BUNDLE_ACTIVE queryBundleStateInfos promise failure.');
});
setTimeout(()=>{
done();
}, 500);
})
/*
* @tc.name: DeviceUsageStatisticsJsTest008
* @tc.desc: test queryBundleStateInfos callback.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89E AR000GH89F AR000GH89G
*/
it("DeviceUsageStatisticsJsTest008", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest008---------------------------');
let beginTime = 0;
let endTime = 20000000000000;
bundleState.queryBundleStateInfos(beginTime, endTime, (err, res) => {
if(err.code === 0) {
console.info('BUNDLE_ACTIVE queryBundleStateInfos callback success.');
expect(true).assertEqual(true);
} else {
expect(false).assertEqual(true);
console.info('BUNDLE_ACTIVE queryBundleStateInfos callback failure.');
}
});
setTimeout(()=>{
done();
}, 500);
})
/*
* @tc.name: DeviceUsageStatisticsJsTest009
* @tc.desc: test queryCurrentBundleActiveStates promise.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89H AR000GH89I AR000GH899
*/
it("DeviceUsageStatisticsJsTest009", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest009---------------------------');
let beginTime = 0;
let endTime = 20000000000000;
bundleState.queryCurrentBundleActiveStates(beginTime, endTime).then((res) => {
console.info('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise success.');
expect(true).assertEqual(true);
}).catch((err) => {
expect(false).assertEqual(true);
console.info('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise failure.');
});
setTimeout(()=>{
done();
}, 500);
})
/*
* @tc.name: DeviceUsageStatisticsJsTest010
* @tc.desc: test queryCurrentBundleActiveStates callback.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89E AR000GH89F AR000GH89G
*/
it("DeviceUsageStatisticsJsTest010", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest010---------------------------');
let beginTime = 0;
let endTime = 20000000000000;
bundleState.queryCurrentBundleActiveStates(beginTime, endTime, (err, res) => {
if(err.code === 0) {
console.info('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback success.');
expect(true).assertEqual(true);
} else {
expect(false).assertEqual(true);
console.info('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback failure.');
}
});
setTimeout(()=>{
done();
}, 500);
})
/*
* @tc.name: DeviceUsageStatisticsJsTest011
* @tc.desc: test queryBundleStateInfoByInterval promise.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89H AR000GH89I AR000GH899
*/
it("DeviceUsageStatisticsJsTest011", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest011---------------------------');
let intervalType = 0;
let beginTime = 0;
let endTime = 20000000000000;
bundleState.queryBundleStateInfoByInterval(intervalType, beginTime, endTime).then((res) => {
console.info('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise success.');
expect(true).assertEqual(true);
}).catch((err) => {
expect(false).assertEqual(true);
console.info('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise failure.');
});
setTimeout(()=>{
done();
}, 500);
})
/*
* @tc.name: DeviceUsageStatisticsJsTest012
* @tc.desc: test queryBundleStateInfoByInterval callback.
* @tc.type: FUNC
* @tc.require: SR000GGTN7 AR000GH89E AR000GH89F AR000GH89G
*/
it("DeviceUsageStatisticsJsTest012", 0, async function (done) {
console.info('----------------------DeviceUsageStatisticsJsTest012---------------------------');
let intervalType = 0;
let beginTime = 0;
let endTime = 20000000000000;
bundleState.queryBundleStateInfoByInterval(intervalType, beginTime, endTime, (err, res) => {
if(err.code === 0) {
console.info('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback success.');
expect(true).assertEqual(true);
} else {
expect(false).assertEqual(true);
console.info('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback failure.');
}
});
setTimeout(()=>{
done();
}, 500);
})
})
\ 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('./DeviceUsageStatisticsJsunit.test.js')
{
"string": [
{
"name": "app_name",
"value": "ResourcescheduleJSApiTest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
......@@ -36,9 +36,6 @@
]
}
],
"backgroundModes": [
"dataTransfer"
],
"name": "ohos.acts.resourceschedule.reminderagent.js.function.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
......@@ -58,16 +55,6 @@
"autoDesignWidth": false
}
}
],
"defPermissions": [
{
"name": "ohos.permission.PUBLISH_AGENT_REMINDER"
}
],
"reqPermissions": [
{
"name": "ohos.permission.PUBLISH_AGENT_REMINDER"
}
]
]
}
}
......@@ -739,48 +739,6 @@ describe('ReminderAgentTest', function () {
})
});
done();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_071
* @tc.name testActionButtonTypeClose001
* @tc.desc test acton button type is close.
*/
it('testActionButtonTypeClose001', 0, async function (done) {
let timer = {
reminderType: reminderAgent.ReminderType.ACTION_BUTTON_TYPE_CLOSE,
triggerTimeInSeconds: TRIGGER_TIME_IN_SECONDS
}
let expectId = -1;
function reminderCallback(err, reminderId) {
expect(reminderId).assertEqual(expectId);
}
reminderAgent.publishReminder(timer, (err, reminderId) => {
expectId = reminderId + 1;
reminderAgent.publishReminder(timer, reminderCallback);
})
done();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_072
* @tc.name testActionButtonTypeSnooze001
* @tc.desc test acton button type is snooze.
*/
it('testActionButtonTypeSnooze001', 0, async function (done) {
let timer = {
reminderType: reminderAgent.ReminderType.ACTION_BUTTON_TYPE_SNOOZE,
triggerTimeInSeconds: TRIGGER_TIME_IN_SECONDS
}
let expectId = -1;
function reminderCallback(err, reminderId) {
expect(reminderId).assertEqual(expectId);
}
reminderAgent.publishReminder(timer, (err, reminderId) => {
expectId = reminderId + 1;
reminderAgent.publishReminder(timer, reminderCallback);
})
done();
})
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册