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

!4365 add continuation manager xts test

Merge pull request !4365 from zhangmingxiang/0718-1
# 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("//build/ohos_var.gni")
group("distributedschedule") {
testonly = true
if (is_standard_system) {
deps = [ "dmsfwk:dmsfwk" ]
}
}
# 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("//build/ohos_var.gni")
group("dmsfwk") {
testonly = true
if (is_standard_system) {
deps = [ "continuationmanagertest:continuationmanager_js_test" ]
}
}
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("continuationmanager_js_test") {
hap_profile = "./entry/src/main/config.json"
deps = [
":continuationmanager_js_assets",
":continuationmanager_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsContinuationManagerJsTest"
}
ohos_js_assets("continuationmanager_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("continuationmanager_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1200000",
"package": "ohos.acts.distributedschedule.continuationmanager",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsContinuationManagerJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "ohos.acts.distributedschedule.continuationmanager",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.distributedschedule.continuationmanager",
"name": ".MyApplication",
"mainAbility": "ohos.acts.distributedschedule.continuationmanager.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "ohos.acts.distributedschedule.continuationmanager.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": true
}
}
]
}
}
\ No newline at end of file
/*
* 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.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
/*
* 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* 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.
*/
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
</div>
/*
* 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 {Core} 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()
core.init()
require('../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
/*
* 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import continuationManager from '@ohos.continuation.continuationManager';
const TEST_DEVICE_ID = "test_deviceId";
const TEST_CONNECT_STATUS = continuationManager.DeviceConnectState.CONNECTED;
let token = -1;
describe('ContinuationManagerTest', function() {
beforeAll(async function (done) {
console.info('beforeAll');
done();
})
afterAll(async function (done) {
console.info('afterAll');
done();
})
beforeEach(async function (done) {
console.info('beforeEach');
await continuationManager.register(function (err, data) {
token = data;
console.info('beforeEach register success');
done();
});
console.info('beforeEach end');
})
afterEach(async function (done) {
console.info('afterEach');
await continuationManager.unregister(token, function (err, data) {
console.info('afterEach unregister success');
done();
});
console.info('afterEach end');
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0100
* @tc.name [JS-API8]ContinuationManager.register().
* @tc.desc Test Js Api ContinuationManager.register() testcase 001
*/
it('testRegister001', 0, async function(done) {
try {
continuationManager.register(function (err, data) {
expect(err.code == 0).assertTrue();
expect(data - token == 1).assertTrue();
done();
});
} catch (e) {
console.info("testRegister001 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UNREGISTER_0100
* @tc.name [JS-API8]ContinuationManager.unregister().
* @tc.desc Test Js Api ContinuationManager.unregister() testcase 001
*/
it('testUnregister001', 0, async function(done) {
try {
continuationManager.unregister(token, function (err, data) {
expect(err.code == 0).assertTrue();
expect(data == undefined).assertTrue();
})
done();
} catch (e) {
console.info("testUnregister001 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0100
* @tc.name [JS-API8]ContinuationManager.on().
* @tc.desc Test Js Api ContinuationManager.on() testcase 001
*/
it('testOn001', 0, async function(done) {
try {
continuationManager.on("deviceConnect", function (data) {
expect(data == undefined).assertTrue();
});
done();
} catch (e) {
console.info("testOn001 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0200
* @tc.name [JS-API8]ContinuationManager.on().
* @tc.desc Test Js Api ContinuationManager.on() testcase 002
*/
it('testOn002', 0, async function(done) {
try {
continuationManager.on("deviceDisconnect", function (data) {
expect(data == undefined).assertTrue();
});
done();
} catch (e) {
console.info("testOn002 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0300
* @tc.name [JS-API9]ContinuationManager.on().
* @tc.desc Test Js Api ContinuationManager.on() testcase 003
*/
it('testOn003', 0, async function(done) {
try {
continuationManager.on("deviceConnect", token, function (data) {
expect(data == undefined).assertTrue();
})
done();
} catch (e) {
console.info("testOn003 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0400
* @tc.name [JS-API9]ContinuationManager.on().
* @tc.desc Test Js Api ContinuationManager.on() testcase 004
*/
it('testOn004', 0, async function(done) {
try {
continuationManager.on("deviceDisconnect", token, function (data) {
expect(data == undefined).assertTrue();
});
done();
} catch (e) {
console.info("testOn004 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0100
* @tc.name [JS-API8]ContinuationManager.off().
* @tc.desc Test Js Api ContinuationManager.off() testcase 001
*/
it('testOff001', 0, async function(done) {
try {
continuationManager.off("deviceConnect", function (data) {
expect(data == undefined).assertTrue();
});
done();
} catch (e) {
console.info("testOff001 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0200
* @tc.name [JS-API8]ContinuationManager.off().
* @tc.desc Test Js Api ContinuationManager.off() testcase 002
*/
it('testOff002', 0, async function(done) {
try {
continuationManager.off("deviceDisconnect", function (data) {
expect(data == undefined).assertTrue();
});
done();
} catch (e) {
console.info("testOff002 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0300
* @tc.name [JS-API9]ContinuationManager.off().
* @tc.desc Test Js Api ContinuationManager.off() testcase 003
*/
it('testOff003', 0, async function(done) {
try {
continuationManager.off("deviceConnect", token);
done();
} catch (e) {
console.info("testOff003 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0400
* @tc.name [JS-API9]ContinuationManager.off().
* @tc.desc Test Js Api ContinuationManager.off() testcase 004
*/
it('testOff004', 0, async function(done) {
try {
continuationManager.off("deviceDisconnect", token);
done();
} catch (e) {
console.info("testOff004 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0100
* @tc.name [JS-API8]ContinuationManager.startDeviceManager().
* @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 001
*/
it('testStartDeviceManager001', 0, async function(done) {
try {
continuationManager.startDeviceManager(token, function (err, data) {
expect(err.code != 0).assertTrue();
expect(data == undefined).assertTrue();
});
done();
} catch (e) {
console.info("testStartDeviceManager001 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UPDATECONNECTSTATUS_0100
* @tc.name [JS-API8]ContinuationManager.updateConnectStatus().
* @tc.desc Test Js Api ContinuationManager.updateConnectStatus() testcase 001
*/
it('testUpdateConnectStatus001', 0, async function(done) {
try {
continuationManager.updateConnectStatus(token, TEST_DEVICE_ID, TEST_CONNECT_STATUS, function (err, data) {
expect(err.code != 0).assertTrue();
expect(data == undefined).assertTrue();
});
done();
} catch (e) {
console.info("testUpdateConnectStatus001 " + e);
expect(null).assertFail();
done();
}
})
})
\ No newline at end of file
/*
* 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.
*/
require('./ContinuationManagerJsunit.test.js')
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ContinuationManagerJsTest"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
...@@ -42,6 +42,7 @@ _all_test_packages = [ ...@@ -42,6 +42,7 @@ _all_test_packages = [
"${ACTS_ROOT}/settingsdata:settingsdata", "${ACTS_ROOT}/settingsdata:settingsdata",
"${ACTS_ROOT}/barrierfree:barrierfree", "${ACTS_ROOT}/barrierfree:barrierfree",
"${ACTS_ROOT}/customization:customization", "${ACTS_ROOT}/customization:customization",
"${ACTS_ROOT}/distributedschedule:distributedschedule",
] ]
_all_test_packages_ivi = [ _all_test_packages_ivi = [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册