提交 11f50dd8 编写于 作者: G gBuda-Liu

Xts for Enterprise Device Management

Signed-off-by: NgBuda-Liu <liuliang24@huawei.com>
上级 aa365bff
# 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("customization") {
testonly = true
if (is_standard_system) {
deps = [
"enterprise_device_management:edm_test_grop"
]
}
}
# 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")
group("edm_test_grop") {
testonly = true
if (is_standard_system) {
deps = [
":edm_test",
"edmsceneone:edmJstest1",
]
}
}
ohos_js_hap_suite("edm_test") {
hap_profile = "./src/main/config.json"
deps = [
":edm_assets",
":edm_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsEdmJsTest"
}
ohos_js_assets("edm_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("edm_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for enterprise device management Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "ohos.edm.test",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsEdmJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "PushKit",
"push": [
"edmJstest1.hap->/data/edmJstest1.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /data/*.hap"
]
}
]
}
# 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_hap("edmJstest1") {
hap_profile = "./src/main/config.json"
hap_name = "edmJstest1"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/js/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
}
{
"app": {
"bundleName": "com.example.myapplication1",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.myapplication1",
"name": ".MyApplication1",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": ".MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"language": "C++",
"metaData": {
"customizeData": [
{
"name": "originWidgetName",
"value": "com.weather.testWidget"
}
]
}
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ 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('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) 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.
*/
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
{
"string": [
{
"name": "app_name",
"value": "bmssceneone"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "ohos.edm.test",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.edm.test",
"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.edm.test.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "MyApplication",
"type": "page",
"launchType": "standard"
}
],
"reqPermissions": [
{
"name":"ohos.permission.GET_BUNDLE_INFO",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
},
{
"name":"ohos.permission.INSTALL_BUNDLE",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
},
{
"name":"ohos.permission.EDM_MANAGE_DATETIME",
"reason":"need use EDM_MANAGE_DATETIME"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* 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"
}
}
\ 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) 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, 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import bundle from '@ohos.bundle'
import enterpriseDeviceManager from '@ohos.edm.enterpriseDeviceManager'
const PATH = "/data/"
const EDMJSTEST1 = "edmJstest1.hap"
const WANT1 = {
bundleName: "com.example.myapplication1",
abilityName: "com.example.myapplication1.MainAbility"
};
const SELFWANT = {
bundleName: "ohos.edm.test",
abilityName: "ohos.edm.test.MainAbility"
};
const HAPNAME1 = "com.example.myapplication1"
const SELFHAPNAME = "ohos.edm.test"
const COMPANYNAME2 = "company2"
const DESCRIPTION2 = "edm demo2"
const ENTINFO1 = {
name: "company",
description: "edm demo"
};
const ENTINFO2 = {
name: "company2",
description: "edm demo2"
};
describe('EnterpriseDeviceManagerTest', function () {
console.log('*************start EnterpriseDeviceManagerTest*************');
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0100
* @tc.name test activateAdmin method in promise mode
* @tc.desc activate admin in promise mode
*/
it('activateAdmin_test_001', 0, async function (done) {
let installData = await bundle.getBundleInstaller()
installData.install([PATH + EDMJSTEST1], {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
await bundle.getBundleInfo(HAPNAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION).then(datainfo => {
console.info("getBundleInfo success:" + JSON.stringify(datainfo))
})
activateAdmin();
});
async function activateAdmin() {
var retValue = await enterpriseDeviceManager.activateAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL);
console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL : ' + retValue);
expect(retValue).assertTrue();
var isActive = await enterpriseDeviceManager.isAdminAppActive(WANT1);
console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
expect(isActive).assertTrue();
retValue = await enterpriseDeviceManager.deactivateAdmin(WANT1);
console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
expect(retValue).assertTrue();
isActive = await enterpriseDeviceManager.isAdminAppActive(WANT1);
console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
expect(isActive).assertFalse();
installData.uninstall(HAPNAME1, {
userId: 100,
installFlag: 0,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
})
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0200
* @tc.name test activateAdmin method in callback mode
* @tc.desc activate admin in callback mode
*/
it('activateAdmin_test_002', 0, async function (done) {
let installData = await bundle.getBundleInstaller()
installData.install([PATH + EDMJSTEST1], {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
activateAdmin();
});
async function activateAdmin() {
console.log('activateAdmin()');
var retValue = await enterpriseDeviceManager.activateAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) {
console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL :' + datainfo);
expect(datainfo).assertTrue();
var isActive = await enterpriseDeviceManager.isAdminAppActive(WANT1);
console.log('enterpriseDeviceManager.isAdminAppActive :' + isActive);
expect(isActive).assertTrue();
retValue = await enterpriseDeviceManager.deactivateAdmin(WANT1);
console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
expect(retValue).assertTrue();
isActive = await enterpriseDeviceManager.isAdminAppActive(WANT1);
console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
expect(isActive).assertFalse();
installData.uninstall(HAPNAME1, {
userId: 100,
installFlag: 0,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
}
})
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0300
* @tc.name test activateAdmin method in promise mode with ADMIN_TYPE_SUPER param
* @tc.desc activate super admin in promise mode
*/
it('activateAdmin_test_003', 0, async function (done) {
await bundle.getBundleInfo(SELFHAPNAME, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION).then(datainfo => {
console.info("getBundleInfo success:" + JSON.stringify(datainfo))
})
console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_SUPER');
var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER);
console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_SUPER : ' + retValue);
expect(retValue).assertTrue();
var isActive = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.isSuperAdmin :' + isActive);
expect(isActive).assertTrue();
retValue = await enterpriseDeviceManager.deactivateSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.deactivateSuperAdmin : ' + retValue);
expect(retValue).assertTrue();
isActive = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.isSuperAdmin : ' + isActive);
expect(isActive).assertFalse();
done();
})
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0400
* @tc.name test activateAdmin method in callback mode with ADMIN_TYPE_SUPER param
* @tc.desc activate super admin in callback mode
*/
it('activateAdmin_test_004', 0, async function (done) {
var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) {
console.log('enterpriseDeviceManager.activateAdmin : ' + retValue);
expect(datainfo).assertTrue();
var isActive = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.isSuperAdmin :' + isActive);
expect(isActive).assertTrue();
retValue = await enterpriseDeviceManager.deactivateSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.deactivateSuperAdmin : ' + retValue);
expect(retValue).assertTrue();
isActive = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.isSuperAdmin : ' + isActive);
expect(isActive).assertFalse();
done();
}
})
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0500
* @tc.name test activateAdmin method in promise mode
* @tc.desc activate admin in promise mode
*/
it('activateAdmin_test_005', 0, async function (done) {
var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL);
console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL : ' + retValue);
expect(retValue).assertTrue();
var isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
expect(isActive).assertTrue();
retValue = await enterpriseDeviceManager.deactivateAdmin(SELFWANT);
console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
expect(retValue).assertTrue();
isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
expect(isActive).assertFalse();
done();
})
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0600
* @tc.name test activateAdmin method in callback mode
* @tc.desc activate admin in callback mode
*/
it('activateAdmin_test_006', 0, async function (done) {
console.log(' activateAdmin()');
var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) {
console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL :' + datainfo);
expect(datainfo).assertTrue();
var isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
console.log('enterpriseDeviceManager.isAdminAppActive :' + isActive);
expect(isActive).assertTrue();
retValue = await enterpriseDeviceManager.deactivateAdmin(SELFWANT);
console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
expect(retValue).assertTrue();
isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
expect(isActive).assertFalse();
done();
}
})
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0700
* @tc.name test setEnterpriseInfo method in promise mode
* @tc.desc set enterprise info in promise mode
*/
it('setEnterpriseInfo_test_001', 0, async function (done) {
var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL);
console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL : ' + retValue);
expect(retValue).assertTrue();
var isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
expect(isActive).assertTrue();
console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
retValue = await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2);
console.log('enterpriseDeviceManager.setEnterpriseInfo : ' + retValue);
expect(retValue).assertTrue();
var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT);
expect(entInfo.name).assertEqual(COMPANYNAME2);
expect(entInfo.description).assertEqual(DESCRIPTION2);
retValue = await enterpriseDeviceManager.deactivateAdmin(SELFWANT);
console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
expect(retValue).assertTrue();
isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
expect(isActive).assertFalse();
done();
})
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0800
* @tc.name test setEnterpriseInfo method in callback mode
* @tc.desc set enterprise info in callback mode
*/
it('setEnterpriseInfo_test_002', 0, async function (done) {
var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL);
console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL : ' + retValue);
expect(retValue).assertTrue();
var isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
expect(isActive).assertTrue();
console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
retValue = await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) {
console.log('enterpriseDeviceManager.setEnterpriseInfo : ' + datainfo);
expect(datainfo).assertTrue();
var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT);
expect(entInfo.name).assertEqual(COMPANYNAME2);
expect(entInfo.description).assertEqual(DESCRIPTION2);
retValue = await enterpriseDeviceManager.deactivateAdmin(SELFWANT);
console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
expect(retValue).assertTrue();
isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
expect(isActive).assertFalse();
done();
}
})
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0900
* @tc.name test getDeviceSettingsManager method in callback mode
* @tc.desc get the device settings manager in callback mode
*/
it('getDeviceSettingsManager_test_001', 0, async function (done) {
enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
expect(mgr !== null).assertTrue();
})
console.log('getDeviceSettingsManager_test_001 done');
done();
})
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_1000
* @tc.name test getDeviceSettingsManager method in promise mode
* @tc.desc get the device settings manager in promise mode
*/
it('getDeviceSettingsManager_test_002', 0, async function (done) {
enterpriseDeviceManager.getDeviceSettingsManager().then(mgr => {
expect(mgr !== null).assertTrue();
})
console.log('getDeviceSettingsManager_test_002 done');
done();
})
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_1100
* @tc.name test setDateTime method in promise mode
* @tc.desc set system date time in promise mode
*/
it('setDateTime_test_001', 0, async function (done) {
await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER);
let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager();
expect(dsmgr !== null).assertTrue();
console.log('before setDateTime');
var setSuccess = await dsmgr.setDateTime(SELFWANT, 1526003846000);
expect(setSuccess).assertTrue();
await enterpriseDeviceManager.deactivateSuperAdmin(SELFHAPNAME);
done();
})
/**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_1200
* @tc.name test setDateTime method in callback mode
* @tc.desc set system date time in callback mode
*/
it('setDateTime_test_002', 0, async function (done) {
await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER);
let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager();
expect(dsmgr !== null).assertTrue();
console.log('before setDateTime');
await dsmgr.setDateTime(SELFWANT, 1526003846000, (error, data) => {
console.log("setDateTime ===data: " + data);
console.log("setDateTime ===error: " + error);
});
await enterpriseDeviceManager.deactivateSuperAdmin(SELFHAPNAME);
done();
})
console.log('*************end EnterpriseDeviceManagerTest*************');
})
\ 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('./EnterpriseDeviceManager.test.js')
{
"plural":[
{
"name":"plural_name",
"value":[
{
"quantity":"zero",
"value":"%d test zero"
},
{
"quantity":"one",
"value":"%d test one"
},
{
"quantity":"two",
"value":"%d test two"
},
{
"quantity":"few",
"value":"%d test few"
},
{
"quantity":"many",
"value":"%d test many"
},
{
"quantity":"other",
"value":"%d test other"
}
]
}
]
}
\ No newline at end of file
{
"strarray": [
{
"name": "sizeList",
"value":[
{
"value":"small"
},
{
"value":"middle"
},
{
"value":"large"
},
{
"value":"extra large"
}
]
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "L2Test"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
......@@ -42,6 +42,7 @@ _all_test_packages = [
"${ACTS_ROOT}/location:location",
"${ACTS_ROOT}/settingsdata:settingsdata",
"${ACTS_ROOT}/barrierfree:barrierfree",
"${ACTS_ROOT}/customization:customization",
]
_all_test_packages_ivi = [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册