提交 5f85c77e 编写于 作者: L luozhewen

startup 子系统编译整改

Signed-off-by: Nluozhewen <luozhewen@huawei.com>
上级 0bd0acda
...@@ -13,6 +13,24 @@ ...@@ -13,6 +13,24 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("startup_js_test") { ohos_js_hap_suite("startup_js_test") {
test_hap_name = "StartupJSApiTest" hap_profile = "./src/main/config.json"
hap_source_path = "hap/entry-debug-standard-signed.hap" deps = [
":startup_js_assets",
":startup_js_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "StartupJSApiTest"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
} }
ohos_js_assets("startup_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("startup_js_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
\ No newline at end of file
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info('AceApplication onCreate'); console.info('AceApplication onCreate');
}, },
onDestroy() { onDestroy() {
console.info('AceApplication onDestroy'); console.info('AceApplication onDestroy');
} }
}; };
.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>
...@@ -12,11 +12,12 @@ ...@@ -12,11 +12,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import file from '@system.file'
import app from '@system.app'
//import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' import {Core} from 'deccjsunit/lite'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' const core = Core.getInstance()
core.init()
require('../../test/List.test.js')
core.execute()
export default { export default {
data: { data: {
...@@ -24,31 +25,5 @@ export default { ...@@ -24,31 +25,5 @@ export default {
}, },
onInit() { onInit() {
this.title = this.$t('strings.world'); 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)
// const instrumentLog = new InstrumentLog({
// 'id': 'report'
// })
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
// core.addService('report', instrumentLog)
core.init()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
} }
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
require('./DeviceInfoJsUnit.test.js') require('./DeviceInfoJsUnit.test.js')
require('./ParametersJsUnit.test.js') require('./ParametersJsUnit.test.js')
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
// @ts-nocheck // @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import systemparameter from '@ohos.systemParameter' import systemparameter from '@ohos.systemParameter'
describe('SystemParameterTest', function () { describe('SystemParameterTest', function () {
console.info('SystemParameterTest start################################start'); console.info('SystemParameterTest start################################start');
/** /**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0100 * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0100
* @tc.name testSet01 * @tc.name testSet01
* @tc.desc Set the value for the given key with parameter callback. * @tc.desc Set the value for the given key with parameter callback.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_001', 0, async function (done) { it('system_parameter_test_001', 0, async function (done) {
console.info('system_parameter_test_001 start'); console.info('system_parameter_test_001 start');
var ret = false; var ret = false;
try { try {
systemparameter.set("hw_sc.build.os.version", "10.20.30.4", function (err, data) { systemparameter.set("hw_sc.build.os.version", "10.20.30.4", function (err, data) {
if (err == undefined) { if (err == undefined) {
ret = true; ret = true;
console.info("set callback hw_sc.build.os.version value success :" + data); console.info("set callback hw_sc.build.os.version value success :" + data);
} else { } else {
console.info("set callback hw_sc.build.os.version value err:" + err.code); console.info("set callback hw_sc.build.os.version value err:" + err.code);
} }
}); });
done(); done();
}catch(e){ }catch(e){
console.info("set callback hw_sc.build.os.version unexpect err:" + e); console.info("set callback hw_sc.build.os.version unexpect err:" + e);
} }
setTimeout("expect(ret).assertTrue()", "10"); setTimeout("expect(ret).assertTrue()", "10");
console.info('system_parameter_test_001 : PASS'); console.info('system_parameter_test_001 : PASS');
}) })
/** /**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0200 * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0200
* @tc.name testSet02 * @tc.name testSet02
* @tc.desc Set the value for the given key. * @tc.desc Set the value for the given key.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_002', 0, async function (done) { it('system_parameter_test_002', 0, async function (done) {
console.info('system_parameter_test_002 start'); console.info('system_parameter_test_002 start');
var ret = false; var ret = false;
try { try {
systemparameter.set("ro.secure", "10.20.30.4", function (err, data) { systemparameter.set("ro.secure", "10.20.30.4", function (err, data) {
if (err == undefined) { if (err == undefined) {
console.info("set callback ro.secure value success:" + data) console.info("set callback ro.secure value success:" + data)
} else { } else {
ret = true; ret = true;
console.info("set callback ro.secure value err:" + err.code) console.info("set callback ro.secure value err:" + err.code)
} }
}); });
done(); done();
}catch(e){ }catch(e){
console.info("set callback ro.secure unexpect err:" + e) console.info("set callback ro.secure unexpect err:" + e)
} }
setTimeout("expect(ret).assertTrue()", "10"); setTimeout("expect(ret).assertTrue()", "10");
console.info('system_parameter_test_002 : PASS'); console.info('system_parameter_test_002 : PASS');
}) })
/** /**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0300 * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0300
* @tc.name testSet03 * @tc.name testSet03
* @tc.desc Set the value for the given key. * @tc.desc Set the value for the given key.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_003', 0, async function (done) { it('system_parameter_test_003', 0, async function (done) {
console.info('system_parameter_test_003 start'); console.info('system_parameter_test_003 start');
var parameterInfo = systemparameter.set("hw_sc.build.os.version", "1.5.3.6"); var parameterInfo = systemparameter.set("hw_sc.build.os.version", "1.5.3.6");
var ret = false; var ret = false;
try { try {
parameterInfo.then(function (value) { parameterInfo.then(function (value) {
console.info("promise set hw_sc.build.os.version success: " + value); console.info("promise set hw_sc.build.os.version success: " + value);
}).catch(function (err) { }).catch(function (err) {
console.info("promise set hw_sc.build.os.version error: " + err.code); console.info("promise set hw_sc.build.os.version error: " + err.code);
}); });
done(); done();
}catch(e){ }catch(e){
console.info("set callback hw_sc.build.os.version unexpect err:" + e) console.info("set callback hw_sc.build.os.version unexpect err:" + e)
} }
if (parameterInfo !== null) { if (parameterInfo !== null) {
ret = true; ret = true;
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
console.info('system_parameter_test_003 : PASS'); console.info('system_parameter_test_003 : PASS');
}) })
/** /**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0400 * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0400
* @tc.name testSet04 * @tc.name testSet04
* @tc.desc Set the value for the given key. * @tc.desc Set the value for the given key.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_004', 0, async function (done) { it('system_parameter_test_004', 0, async function (done) {
console.info('system_parameter_test_004 start'); console.info('system_parameter_test_004 start');
var parameterInfo = systemparameter.set("ro.secure", "10"); var parameterInfo = systemparameter.set("ro.secure", "10");
var ret = false; var ret = false;
try { try {
parameterInfo.then(function (value) { parameterInfo.then(function (value) {
console.info("12333 promise set ro.secure success: " + value); console.info("12333 promise set ro.secure success: " + value);
}).catch(function (err) { }).catch(function (err) {
console.info("12333 promise set ro.secure error: " + err.code); console.info("12333 promise set ro.secure error: " + err.code);
}); });
done(); done();
}catch(e){ }catch(e){
console.info("set callback ro.secure unexpect err:" + e) console.info("set callback ro.secure unexpect err:" + e)
} }
if (parameterInfo !== null) { if (parameterInfo !== null) {
ret = true; ret = true;
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
console.info('system_parameter_test_004 :PASS'); console.info('system_parameter_test_004 :PASS');
}) })
/** /**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0500 * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0500
* @tc.name testSetSync01 * @tc.name testSetSync01
* @tc.desc Set the value for the given key. * @tc.desc Set the value for the given key.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_005', 0, function () { it('system_parameter_test_005', 0, function () {
console.info('system_parameter_test_005 start'); console.info('system_parameter_test_005 start');
var ret = false; var ret = false;
try { try {
var parameterInfo = systemparameter.setSync("hw_sc.build.os.version", "2.5.3.7"); var parameterInfo = systemparameter.setSync("hw_sc.build.os.version", "2.5.3.7");
console.info("promise setSync ro.secure success: " + parameterInfo); console.info("promise setSync ro.secure success: " + parameterInfo);
ret = true; ret = true;
}catch(e){ }catch(e){
console.info("promise setSync ro.secure error: " + e); console.info("promise setSync ro.secure error: " + e);
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
console.info('system_parameter_test_005 : PASS'); console.info('system_parameter_test_005 : PASS');
}) })
/** /**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0600 * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0600
* @tc.name testSetSync02 * @tc.name testSetSync02
* @tc.desc Set the value for the given key. * @tc.desc Set the value for the given key.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_006', 0, function () { it('system_parameter_test_006', 0, function () {
console.info('system_parameter_test_006 start'); console.info('system_parameter_test_006 start');
var ret = false; var ret = false;
try { try {
var parameterInfo = systemparameter.setSync("hw_sc.build.os.version", 56789); var parameterInfo = systemparameter.setSync("hw_sc.build.os.version", 56789);
console.info("promise setSync ro.secure success: " + parameterInfo); console.info("promise setSync ro.secure success: " + parameterInfo);
}catch(e){ }catch(e){
ret = true; ret = true;
console.info("promise setSync ro.secure error: " + e); console.info("promise setSync ro.secure error: " + e);
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
console.info('system_parameter_test_006 : PASS'); console.info('system_parameter_test_006 : PASS');
}) })
/** /**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0800 * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0800
* @tc.name testGet02 * @tc.name testGet02
* @tc.desc Set the value for the given key. * @tc.desc Set the value for the given key.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_008', 0, async function (done) { it('system_parameter_test_008', 0, async function (done) {
console.info('system_parameter_test_008 start'); console.info('system_parameter_test_008 start');
var ret = false; var ret = false;
try { try {
var parameterInfo = systemparameter.get("hw_sc.build.os.version"); var parameterInfo = systemparameter.get("hw_sc.build.os.version");
parameterInfo.then(function (value) { parameterInfo.then(function (value) {
ret = true; ret = true;
console.info("promise get hw_sc.build.os.version success: " + value); console.info("promise get hw_sc.build.os.version success: " + value);
}).catch(function (err) { }).catch(function (err) {
console.info("promise get hw_sc.build.os.version error: " + err.code); console.info("promise get hw_sc.build.os.version error: " + err.code);
}); });
done(); done();
}catch(e){ }catch(e){
console.info("promise setSync ro.secure error: " + e); console.info("promise setSync ro.secure error: " + e);
} }
setTimeout("expect(ret).assertTrue()", "10"); setTimeout("expect(ret).assertTrue()", "10");
console.info('system_parameter_test_008 : PASS'); console.info('system_parameter_test_008 : PASS');
}) })
/** /**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0150 * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0150
* @tc.name testGetSync01 * @tc.name testGetSync01
* @tc.desc Gets the value of the attribute with the specified key. * @tc.desc Gets the value of the attribute with the specified key.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_014', 0, async function (done) { it('system_parameter_test_014', 0, async function (done) {
console.info('system_parameter_test_014 start'); console.info('system_parameter_test_014 start');
var ret = false; var ret = false;
try { try {
var parameterInfo = systemparameter.getSync("hw_sc.build.os.version", 496); var parameterInfo = systemparameter.getSync("hw_sc.build.os.version", 496);
parameterInfo.then(function (value) { parameterInfo.then(function (value) {
console.info("496 promise get hw_sc.build.os.version success: " + value); console.info("496 promise get hw_sc.build.os.version success: " + value);
}).catch(function (err) { }).catch(function (err) {
console.info("496 promise get hw_sc.build.os.version error: " + err.code); console.info("496 promise get hw_sc.build.os.version error: " + err.code);
}); });
done(); done();
} catch (e) { } catch (e) {
ret = true; ret = true;
console.info("promise get input error: " + e); console.info("promise get input error: " + e);
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
console.info('system_parameter_test_014 : PASS'); console.info('system_parameter_test_014 : PASS');
}) })
}) })
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "StartupJSApiTest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册