From e5f2c798eea20ae61bae6e8f8d77f96f712834b1 Mon Sep 17 00:00:00 2001 From: heyuean Date: Mon, 25 Jul 2022 15:51:18 +0800 Subject: [PATCH] Signed-off-by: heyuean --- test_packages.gni | 1 - updater/BUILD.gn | 21 - updater/update_test/BUILD.gn | 31 - updater/update_test/Test.json | 18 - .../update_test/signature/openharmony_sx.p7b | Bin 3437 -> 0 bytes updater/update_test/src/main/config.json | 60 - .../update_test/src/main/js/default/app.js | 23 - .../src/main/js/default/i18n/en-US.json | 6 - .../src/main/js/default/i18n/zh-CN.json | 6 - .../src/main/js/default/pages/index/index.css | 9 - .../src/main/js/default/pages/index/index.hml | 5 - .../src/main/js/default/pages/index/index.js | 29 - .../src/main/js/default/test/List.test.js | 16 - .../src/main/js/default/test/update.test.js | 2534 ----------------- .../main/resources/base/element/string.json | 12 - .../src/main/resources/base/media/icon.png | Bin 6790 -> 0 bytes 16 files changed, 2771 deletions(-) delete mode 100644 updater/BUILD.gn delete mode 100644 updater/update_test/BUILD.gn delete mode 100644 updater/update_test/Test.json delete mode 100644 updater/update_test/signature/openharmony_sx.p7b delete mode 100644 updater/update_test/src/main/config.json delete mode 100644 updater/update_test/src/main/js/default/app.js delete mode 100644 updater/update_test/src/main/js/default/i18n/en-US.json delete mode 100644 updater/update_test/src/main/js/default/i18n/zh-CN.json delete mode 100644 updater/update_test/src/main/js/default/pages/index/index.css delete mode 100644 updater/update_test/src/main/js/default/pages/index/index.hml delete mode 100644 updater/update_test/src/main/js/default/pages/index/index.js delete mode 100644 updater/update_test/src/main/js/default/test/List.test.js delete mode 100644 updater/update_test/src/main/js/default/test/update.test.js delete mode 100644 updater/update_test/src/main/resources/base/element/string.json delete mode 100644 updater/update_test/src/main/resources/base/media/icon.png diff --git a/test_packages.gni b/test_packages.gni index e42c98ee9..fbfdbed7f 100644 --- a/test_packages.gni +++ b/test_packages.gni @@ -28,7 +28,6 @@ _all_test_packages = [ "${ACTS_ROOT}/startup:startup", "${ACTS_ROOT}/sensors:sensor", "${ACTS_ROOT}/distributeddatamgr:distributeddatamgr", - "${ACTS_ROOT}/updater:update", "${ACTS_ROOT}/graphic:graphic", "${ACTS_ROOT}/arkui:arkui", "${ACTS_ROOT}/storage:storage", diff --git a/updater/BUILD.gn b/updater/BUILD.gn deleted file mode 100644 index 91af449a7..000000000 --- a/updater/BUILD.gn +++ /dev/null @@ -1,21 +0,0 @@ -# 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("//build/ohos_var.gni") - -group("update") { - testonly = true - if (is_standard_system) { - deps = [ "update_test:update_js_test" ] - } -} diff --git a/updater/update_test/BUILD.gn b/updater/update_test/BUILD.gn deleted file mode 100644 index 224ee3323..000000000 --- a/updater/update_test/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# 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("update_js_test") { - hap_profile = "./src/main/config.json" - deps = [ - ":update_js_assets", - ":update_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsUpdateJsTest" -} -ohos_js_assets("update_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("update_js_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/updater/update_test/Test.json b/updater/update_test/Test.json deleted file mode 100644 index 375b46120..000000000 --- a/updater/update_test/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for time js api Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "180000", - "package": "ohos.acts.upgrade", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsUpdateJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/updater/update_test/signature/openharmony_sx.p7b b/updater/update_test/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3437 zcmcgvX>b$g8MY4FF(5FQyMT=#m||qU)nQ9cId-MBB-<-lvSdq&snM}IENNF>t+bK| zgowuF2vC|SxSZxNN5eHhV%(WPpbeB9Fc3;JDMtzMBv1-XAc2N~c2_tCXW&OCGw6qQ z-s9VS-tT?h=bI0tMS+~WDXqHJyCPmLzdbE-fV8Nd&*MRZfG8(#POFZG3xs@Lb{0ry z=R8j3wWo!5g=yjKx#BoZMFS)uA)H}cTp@-^K`9VV?RC3J59@}eik*>n|pRKOLZ zxdn7G!Yv@9O#y<&eUy{)vMXb;fQR)ffVAADQsEMXm;IBMDLfLD0w^U;6%HVo-0Q_5 zCHEa?DBuauNpZzoF+tK27w#n~?u%toS-DhR4k@Q*{7x^8Q=D6&kd^_~J#VVG2LXkL zaAy=}U*?Jto)9hx5MGjdp9hcQAu@tfk_;l!PeyxPY<8b&+&D!CyaBh9=8BSVKLpk4 z4Ml3yY|&Th)vyK4cpC{!uU8v2YBlVV`d~(nz&<@{G1oe*DHub1z7~J5*;s2bX<)_* zV_GbsPQg`(&rpxRb_*Od7}++3+liSw-$!1 zs5*g}EHWhI3i|!-FcfzYL0`SL-rq>LENC;PMl)G(0(1U2%Va|smp0UFx0xd@soZA* zD5LYc4OlbE7@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o^xV?CB{_Qhu z;}_q1bvO^g{8<3!gYbo4Di{8qzV+(9 zdlmksohQmRTs@qB;(Wo?dER_ux6XQb@q$tQPW?CMu6GVQd;R=iR;-S{Kr%Zks7>b1 zNs{|-+jhObYE}NR&`TGGr^h^4bjh%c>R#@=8nM&Md>_a+zVulsl;){flFekV1t9ob z+SqfV_Pv3$2f)bQ8%Ul2>fdYR^1zs0BQF~olsOj5AodC&Q_7SMFzsz2 z9newxE&jodk~tNHwl%LBMMDbrk=(^b diff --git a/updater/update_test/src/main/config.json b/updater/update_test/src/main/config.json deleted file mode 100644 index 3e4518275..000000000 --- a/updater/update_test/src/main/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.upgrade", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.upgrade", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.upgrade.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 - } - } - ] - } -} diff --git a/updater/update_test/src/main/js/default/app.js b/updater/update_test/src/main/js/default/app.js deleted file mode 100644 index e423f4bce..000000000 --- a/updater/update_test/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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'); - } -}; diff --git a/updater/update_test/src/main/js/default/i18n/en-US.json b/updater/update_test/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d97..000000000 --- a/updater/update_test/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/updater/update_test/src/main/js/default/i18n/zh-CN.json b/updater/update_test/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748..000000000 --- a/updater/update_test/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/updater/update_test/src/main/js/default/pages/index/index.css b/updater/update_test/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda79275..000000000 --- a/updater/update_test/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/updater/update_test/src/main/js/default/pages/index/index.hml b/updater/update_test/src/main/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5..000000000 --- a/updater/update_test/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/updater/update_test/src/main/js/default/pages/index/index.js b/updater/update_test/src/main/js/default/pages/index/index.js deleted file mode 100644 index 3283c2ef2..000000000 --- a/updater/update_test/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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} from 'deccjsunit/lite' -const core = Core.getInstance() -core.init() -require('../../test/List.test.js') -core.execute() - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} diff --git a/updater/update_test/src/main/js/default/test/List.test.js b/updater/update_test/src/main/js/default/test/List.test.js deleted file mode 100644 index e1496557e..000000000 --- a/updater/update_test/src/main/js/default/test/List.test.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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('./update.test.js') \ No newline at end of file diff --git a/updater/update_test/src/main/js/default/test/update.test.js b/updater/update_test/src/main/js/default/test/update.test.js deleted file mode 100644 index b1033d344..000000000 --- a/updater/update_test/src/main/js/default/test/update.test.js +++ /dev/null @@ -1,2534 +0,0 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file expect 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 client from '@ohos.update'; - -let updater; -let param_value1 = 0; -let param_value2 = 0; -let expect_value = 0; - -let upgradeInfo ={ - upgradeApp: "com.hmos.ouc", - businessType: { - vendor: "public", - subType: 1 - } -} - -let updateState = { - UPDATE_STATE_INIT : 0, - UPDATE_STATE_CHECK_VERSION_ON : 10, - UPDATE_STATE_CHECK_VERSION_FAIL : 11, - UPDATE_STATE_CHECK_VERSION_SUCCESS : 12, - UPDATE_STATE_DOWNLOAD_ON : 20, - UPDATE_STATE_DOWNLOAD_PAUSE : 21, - UPDATE_STATE_DOWNLOAD_CANCEL : 22, - UPDATE_STATE_DOWNLOAD_FAIL : 23, - UPDATE_STATE_DOWNLOAD_SUCCESS : 24, - UPDATE_STATE_VERIFY_ON : 30, - UPDATE_STATE_VERIFY_FAIL : 31, - UPDATE_STATE_VERIFY_SUCCESS : 32, - UPDATE_STATE_PACKAGE_TRANS_ON : 70, - UPDATE_STATE_PACKAGE_TRANS_FAIL : 71, - UPDATE_STATE_PACKAGE_TRANS_SUCCESS : 72, - UPDATE_STATE_INSTALL_ON : 80, - UPDATE_STATE_INSTALL_FAIL : 81, - UPDATE_STATE_INSTALL_SUCCESS : 82, - UPDATE_STATE_UPDATE_ON : 90, - UPDATE_STATE_UPDATE_FAIL : 91, - UPDATE_STATE_UPDATE_SUCCESS : 92 -}; - -describe('updateclient', function() { - beforeAll(function() { - param_value1 = 444; - param_value2 = 555; - expect_value = 100; - }); - beforeEach(function() { - if (updater === undefined) { - updater = client.getOnlineUpdater(upgradeInfo); - console.info("UPDATE_TEST beforeEach updater" + updater); - } - }); - afterEach(function() { - updater = undefined; - }); - afterAll(function() { - param_value1 = 0; - param_value2 = 0; - expect_value = 0; - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0001 - * @tc.name testGetUpdate - * @tc.desc Test get update obj. - */ - it('testGetUpdate', 0, function() { - console.info('testGetUpdate START'); - try { - if (client === undefined) { - console.error("client not defined"); - return; - } - let tmpUpdater = client.getUpdater('/data/updater/updater.zip', 'OTA'); - expect(tmpUpdater != undefined).assertTrue(); - } catch(e) { - console.error('[testGetUpdate] fail.' + e); - } - - console.info('[client.getUpdate] success.'); - console.info('testGetUpdate END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0003 - * @tc.name testGetUpdate3 - * @tc.desc Test incorrect parameters. - */ - it('testGetUpdate3', 0, function() { - console.info('testGetUpdate3 START'); - try { - if (client === undefined) { - console.error("client not defined"); - return; - } - let tmpUpdater = client.getUpdater('/data/updater/updater.zip', 'patch'); - console.info("testGetUpdate3 updater" + tmpUpdater); - expect(tmpUpdater != undefined).assertTrue(); - if (tmpUpdater === undefined) { - console.error("Fail to get updater"); - return; - } - - } catch(e) { - console.error('[testGetUpdate] fail.' + e); - } - - console.info('[client.getUpdate] success.'); - console.info('testGetUpdate3 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0006 - * @tc.name testGetNewVersionInfo1 - * @tc.desc Get the current system version. - */ - it('testGetNewVersionInfo1', 0, function() { - console.info('testGetNewVersionInfo1 START'); - try { - let ret = updater.getNewVersionInfo(function(err, data){ - console.log("getNewVersionInfo success" + data); - expect(data.versionDigestInfo.versionDigest).assertInstanceOf('String'); - }); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('[testGetUpdate] fail.' + e); - } - console.info('[getNewVersionInfo] success.'); - console.info('testGetNewVersionInfo1 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0007 - * @tc.name testGetNewVersionInfo2 - * @tc.desc Test incorrect parameters. - */ - it('testGetNewVersionInfo2', 0, function() { - console.info('testGetNewVersionInfo2 START'); - try { - let ret = updater.getNewVersionInfo(); - expect(ret != 0).assertTrue(); - console.info('[getNewVersionInfo] success.'); - console.info('testGetNewVersionInfo2 END'); - } catch(e) { - console.error('[testGetUpdate] fail.' + e); - } - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0008 - * @tc.name testGetNewVersionInfo3 - * @tc.desc Test incorrect parameters. - */ - it('testGetNewVersionInfo3', 0, function() { - console.info('testGetNewVersionInfo3 START'); - try { - let ret = updater.getNewVersionInfo("dddddd"); - expect(ret != 0).assertTrue(); - console.info('[getNewVersionInfo] success.'); - console.info('testGetNewVersionInfo2 END'); - } catch(e) { - console.error('[testGetUpdate] fail.' + e); - } - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0009 - * @tc.name testGetNewVersionInfo4 - * @tc.desc Test incorrect parameters. - */ - it('testGetNewVersionInfo4', 0, function() { - console.info('testGetNewVersionInfo4 START'); - try { - let ret = updater.getNewVersionInfo(param_value1); - expect(ret != 0).assertTrue(); - console.info('[getNewVersionInfo] success.'); - console.info('testGetNewVersionInfo5 END'); - } catch(e) { - console.error('[testGetUpdate] fail.' + e); - } - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0010 - * @tc.name testGetNewVersionInfo5 - * @tc.desc Test incorrect parameters. - */ - it('testGetNewVersionInfo5', 0, function() { - console.info('testGetNewVersionInfo5 START'); - try { - let ret = updater.getNewVersionInfo(param_value1, param_value2); - expect(ret != 0).assertTrue(); - console.info('[getNewVersionInfo] success.'); - console.info('testGetNewVersionInfo5 END'); - } catch(e) { - console.error('[testGetUpdate] fail.' + e); - } - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0011 - * @tc.name testGetNewVersionInfoPromise - * @tc.desc Called by Promise to get the new version. - */ - it('testGetNewVersionInfoPromise', 0, function() { - console.info('testGetNewVersionInfoPromise START'); - try { - let ret = updater.getNewVersionInfo().then(data => { - console.log("getNewVersionInfo success " + data); - expect(data.versionDigestInfo.versionDigest).assertInstanceOf('String'); - }).catch(error => - console.error("getNewVersionInfo catch " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error("getNewVersionInfo catch " + e); - } - console.info('[getNewVersionInfo] success.'); - console.info('testGetNewVersionInfoPromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0012 - * @tc.name testGetNewVersionInfoPromise2 - * @tc.desc Test incorrect parameters. - */ - it('testGetNewVersionInfoPromise2', 0, function() { - console.info('testGetNewVersionInfoPromise2 START'); - try { - let ret = updater.getNewVersionInfo(param_value1).then(data => { - console.log("getNewVersionInfo success " + data); - }).catch(error => - console.error("getNewVersionInfo catch " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error("getNewVersionInfo catch " + e); - } - console.info('[getNewVersionInfo] success.'); - console.info('testGetNewVersionInfoPromise2 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0013 - * @tc.name testGetNewVersionInfoPromise3 - * @tc.desc Test incorrect parameters. - */ - it('testGetNewVersionInfoPromise3', 0, function() { - console.info('testGetNewVersionInfoPromise3 START'); - try { - let ret = updater.getNewVersionInfo(param_value1, param_value2).then(data => { - }).catch(error => - console.error("getNewVersionInfo catch " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error("getNewVersionInfo catch " + e); - } - console.info('[getNewVersionInfo] success.'); - console.info('testGetNewVersionInfoPromise3 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0014 - * @tc.name testGetNewVersionInfoPromise4 - * @tc.desc Test incorrect parameters. - */ - it('testGetNewVersionInfoPromise4', 0, function() { - console.info('testGetNewVersionInfoPromise4 START'); - try { - let ret = updater.getNewVersionInfo("44444444").then(data => { - }).catch(error => - console.error("getNewVersionInfo catch " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error("getNewVersionInfo catch " + e); - } - console.info('[getNewVersionInfo] success.'); - console.info('testGetNewVersionInfoPromise4 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0015 - * @tc.name testGetNewVersionInfoPromise5 - * @tc.desc Test incorrect parameters. - */ - it('testGetNewVersionInfoPromise5', 0, function() { - console.info('testGetNewVersionInfoPromise5 START'); - try { - let ret = updater.getNewVersionInfo("44444444", "5555555").then(data => { - }).catch(error => - console.error("getNewVersionInfo error " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error("getNewVersionInfo catch " + e); - } - console.info('[getNewVersionInfo] success.'); - console.info('testGetNewVersionInfoPromise5 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0016 - * @tc.name testCheckNewVersion1 - * @tc.desc Check the new version. - */ - it('testCheckNewVersion1', 0, function() { - console.info('testCheckNewVersion1 START'); - try { - let ret = updater.checkNewVersion(function(err, data){ - console.log("checkNewVersion success" + data); - expect(data.status).assertEqual(-1); // Has new version. - }, - error => { - console.log("checkNewVersion error" + error) - }); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error("checkNewVersion catch " + e); - } - console.info('[checkNewVersion] success.'); - console.info('testCheckNewVersion1 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0017 - * @tc.name testCheckNewVersion2 - * @tc.desc Test incorrect parameters. - */ - it('testCheckNewVersion2', 0, function() { - console.info('testCheckNewVersion2 START'); - try { - let ret = updater.checkNewVersion(); - expect(ret != 0).assertTrue(); - console.info('[checkNewVersion] success.' + ret); - console.info('testCheckNewVersion2 END'); - } catch(e) { - console.error("checkNewVersion catch " + e); - } - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0018 - * @tc.name testCheckNewVersion3 - * @tc.desc Test incorrect parameters. - */ - it('testCheckNewVersion3', 0, function() { - console.info('testCheckNewVersion3 START'); - try { - let ret = updater.checkNewVersion("33333"); - expect(ret != 0).assertTrue(); - console.info('[checkNewVersion] success.' + ret); - console.info('testCheckNewVersion3 END'); - } catch(e) { - console.error("checkNewVersion catch " + e); - } - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0019 - * @tc.name testCheckNewVersion4 - * @tc.desc Test incorrect parameters. - */ - it('testCheckNewVersion4', 0, function() { - console.info('testCheckNewVersion4 START'); - try { - let ret = updater.checkNewVersion(param_value1); - expect(ret != 0).assertTrue(); - console.info('[checkNewVersion] success.' + ret); - console.info('testCheckNewVersion4 END'); - } catch(e) { - console.error("checkNewVersion catch " + e); - } - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0020 - * @tc.name testCheckNewVersion5 - * @tc.desc Test incorrect parameters. - */ - it('testCheckNewVersion5', 0, function() { - console.info('testCheckNewVersion4 START'); - try { - let ret = updater.checkNewVersion(param_value1, param_value2); - expect(ret != 0).assertTrue(); - console.info('[checkNewVersion] success.' + ret); - console.info('testCheckNewVersion5 END'); - } catch(e) { - console.error("checkNewVersion catch " + e); - } - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0021 - * @tc.name testCheckNewVersionPromise - * @tc.desc Called by promise, the result is the new Promise version. - */ - it('testCheckNewVersionPromise', 0, function() { - console.info('testCheckNewVersionPromise START'); - try { - let ret = updater.checkNewVersion().then(data => { - console.log("checkNewVersion success" + data); - expect(data.status).assertEqual(-1); - }).catch(error => - console.error("checkNewVersion error " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error("checkNewVersion catch " + e) - } - console.info('[checkNewVersion] success.'); - console.info('testCheckNewVersionPromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0022 - * @tc.name testCheckNewVersionPromise2 - * @tc.desc Test incorrect parameters. - */ - it('testCheckNewVersionPromise2', 0, function() { - console.info('testCheckNewVersionPromise2 START'); - try{ - let ret = updater.checkNewVersion(2).then(data => { - }).catch(error => - console.error("checkNewVersion error " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error("checkNewVersion catch " + e); - } - console.info('[checkNewVersion] success.'); - console.info('testCheckNewVersionPromise2 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0023 - * @tc.name testCheckNewVersionPromise3 - * @tc.desc Test incorrect parameters. - */ - it('testCheckNewVersionPromise3', 0, function() { - console.info('testCheckNewVersionPromise3 START'); - try{ - let ret = updater.checkNewVersion(2, 4).then(data => { - }).catch(error => - console.error("checkNewVersion error " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error("checkNewVersion catch " + e); - } - console.info('[checkNewVersion] success.'); - console.info('testCheckNewVersionPromise3 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0024 - * @tc.name testCheckNewVersionPromise4 - * @tc.desc Test incorrect parameters. - */ - it('testCheckNewVersionPromise4', 0, function() { - console.info('testCheckNewVersionPromise4 START'); - try{ - let ret = updater.checkNewVersion("3333").then(data => { - }).catch(error => - console.error("checkNewVersion error " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error("checkNewVersion catch " + e); - } - console.info('[checkNewVersion] success.'); - console.info('testCheckNewVersionPromise4 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0025 - * @tc.name testCheckNewVersionPromise5 - * @tc.desc Test incorrect parameters. - */ - it('testCheckNewVersionPromise5', 0, function() { - console.info('testCheckNewVersionPromise5 START'); - try{ - let ret = updater.checkNewVersion("3333", "44444").then(data => { - }).catch(error => - console.error("checkNewVersion error " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error("checkNewVersion catch " + e); - } - console.info('[checkNewVersion] success.'); - console.info('testCheckNewVersionPromise5 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0026 - * @tc.name testSetUpgradePolicyAndGetUpgradePolicyCallback - * @tc.desc Test set the upgrade strategy, check whether the result is correct. - */ - it('testSetUpgradePolicyAndGetUpgradePolicyCallback', 0, function() { - console.info('UPDATE_TEST testSetUpgradePolicyAndGetUpgradePolicyCallback START' + updater); - // Set strategy. - let policy = { - downloadStrategy: false, - autoUpgradeStrategy: false, - autoUpgradePeriods:[2, 3] - } - try { - let ret = updater.setUpgradePolicy(policy, function(err, data){ - console.log("UPDATE_TEST setUpgradePolicy success" + data); - expect(data).assertEqual(0); - }); - expect(ret).assertInstanceOf('Number'); - ret = updater.getUpgradePolicy(function(err, data){ - console.log("UPDATE_TEST getUpgradePolicy success" + data); - expect(data.downloadStrategy).assertEqual(false); - expect(data.autoUpgradeStrategy).assertEqual(false); - expect(data.autoUpgradePeriods[0]).assertEqual(2); - expect(data.autoUpgradePeriods[1]).assertEqual(3); - }); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('UPDATE_TEST [testSetUpgradePolicyAndGetUpgradePolicyCallback] fail.' + e); - } - console.info('UPDATE_TEST [testSetUpgradePolicyAndGetUpgradePolicyCallback] success.'); - console.info('UPDATE_TEST testSetUpgradePolicyAndGetUpgradePolicyCallback END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0027 - * @tc.name testSetUpgradePolicyAndGetUpgradePolicyPromise - * @tc.desc Test set the upgrade strategy, check whether the result is correct. - */ - it('testSetUpgradePolicyAndGetUpgradePolicyPromise', 0, function() { - console.info('UPDATE_TEST testSetUpgradePolicyAndGetUpgradePolicyPromise START' + updater); - // Set strategy. - let policy = { - downloadStrategy: false, - autoUpgradeStrategy: false, - autoUpgradePeriods:[2, 3] - } - try { - let ret = updater.setUpgradePolicy(policy).then((err, data)=>{ - console.log("UPDATE_TEST setUpgradePolicy success" + data); - expect(data).assertEqual(0); - }); - expect(ret).assertInstanceOf('Promise'); - ret = updater.getUpgradePolicy().then((err, data)=>{ - console.log("UPDATE_TEST getUpgradePolicy success" + data); - expect(data.downloadStrategy).assertEqual(false); - expect(data.autoUpgradeStrategy).assertEqual(false); - expect(data.autoUpgradePeriods[0]).assertEqual(2); - expect(data.autoUpgradePeriods[1]).assertEqual(3); - }); - expect(ret).assertInstanceOf('Promise'); - } catch(e) { - console.error('UPDATE_TEST [testSetUpgradePolicyAndGetUpgradePolicyPromise] fail.' + e); - } - console.info('UPDATE_TEST [testSetUpgradePolicyAndGetUpgradePolicyPromise] success.'); - console.info('UPDATE_TEST testSetUpgradePolicyAndGetUpgradePolicyPromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0028 - * @tc.name testSetUpdatePolicy002 - * @tc.desc Modify the upgrade strategy and check whether the result is correct. - */ - it('testSetUpdatePolicy002', 0, function() { - console.info('testSetUpdatePolicy002 START' + updater); - let policy = { - downloadStrategy: true, - autoUpgradeStrategy: false, - autoUpgradePeriods:[2, 3] - } - try { - let ret = updater.setUpdatePolicy(policy, function(err, data){ - console.log("setUpdatePolicy success" + data); - expect(data).assertEqual(0); - }); - expect(ret).assertInstanceOf('Number'); - ret = updater.getUpgradePolicy(function(err, data){ - console.log("UPDATE_TEST getUpgradePolicy success" + data); - expect(data.downloadStrategy).assertEqual(true); - expect(data.autoUpgradeStrategy).assertEqual(false); - expect(data.autoUpgradePeriods[0]).assertEqual(2); - expect(data.autoUpgradePeriods[1]).assertEqual(3); - }); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('[testSetUpdatePolicy002] fail.' + e); - } - - console.info('[setUpdatePolicy] success.'); - console.info('testSetUpdatePolicy002 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0030 - * @tc.name testSetUpdatePolicy003 - * @tc.desc Modify strategy mode. - */ - it('testSetUpdatePolicy003', 0, function() { - console.info('testSetUpdatePolicy003 START' + updater); - // Set strategy. - let policy = { - downloadStrategy: true, - autoUpgradeStrategy: true, - autoUpgradePeriods:[2, 3] - } - try { - let ret = updater.setUpdatePolicy(policy, function(err, data){ - console.log("setUpdatePolicy success" + data); - expect(data).assertEqual(0); - }) - expect(ret).assertInstanceOf('Number'); - ret = updater.getUpgradePolicy(function(err, data){ - console.log("UPDATE_TEST getUpgradePolicy success" + data); - expect(data.downloadStrategy).assertEqual(true); - expect(data.autoUpgradeStrategy).assertEqual(true); - expect(data.autoUpgradePeriods[0]).assertEqual(2); - expect(data.autoUpgradePeriods[1]).assertEqual(3); - }); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('[testSetUpdatePolicy003] fail.' + e); - } - console.info('[setUpdatePolicy] success.'); - console.info('testSetUpdatePolicy003 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0032 - * @tc.name testSetUpdatePolicy004 - * @tc.desc Set policy upgrade interval. - */ - it('testSetUpdatePolicy004', 0, function() { - console.info('testSetUpdatePolicy004 START' + updater); - // Set strategy. - let policy = { - downloadStrategy: true, - autoUpgradeStrategy: true, - autoUpgradePeriods:[3, 4] - } - try { - let ret = updater.setUpdatePolicy(policy, function(err, data){ - console.log("setUpdatePolicy success" + data); - expect(data).assertEqual(0); - }) - expect(ret).assertInstanceOf('Number'); - ret = updater.getUpgradePolicy(function(err, data){ - console.log("UPDATE_TEST getUpgradePolicy success" + data); - expect(data.downloadStrategy).assertEqual(true); - expect(data.autoUpgradeStrategy).assertEqual(true); - expect(data.autoUpgradePeriods[0]).assertEqual(3); - expect(data.autoUpgradePeriods[1]).assertEqual(4); - }); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('[testGetUpdatePolicy003] fail.' + e); - } - console.info('[setUpdatePolicy] success.'); - console.info('testSetUpdatePolicy004 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0034 - * @tc.name testSetUpdatePolicy005 - * @tc.desc Test incorrect parameters. - */ - it('testSetUpdatePolicy005', 0, function() { - console.info('testSetUpdatePolicy005 START' + updater); - try { - let ret = updater.setUpdatePolicy("", function(err, data){ - console.log("setUpdatePolicy success" + data); - expect(data).assertEqual(0); - }); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error('[testSetUpdatePolicy005] fail.' + e); - } - console.info('[setUpdatePolicy] success.'); - console.info('testSetUpdatePolicy005 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0035 - * @tc.name testGetUpdatePolicy005 - * @tc.desc Test incorrect parameters. - */ - it('testGetUpdatePolicy005', 0, function() { - console.info('testGetUpdatePolicy005 START' + updater); - try { - let ret = updater.getUpdatePolicy("", function(err, data){ - }) - expect(ret != 0).assertTrue(); - } catch(e) { - console.error('[testSetUpdatePolicy005] fail.' + e); - } - console.info('[getUpdatePolicy] success.'); - console.info('testGetUpdatePolicy005 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0036 - * @tc.name testSetUpdatePolicyPromise - * @tc.desc Promise method call. - */ - it('testSetUpdatePolicyPromise', 0, function() { - console.info('testSetUpdatePolicyPromise START' + updater); - // Set strategy. - let policy = { - downloadStrategy: false, - autoUpgradeStrategy: true, - autoUpgradePeriods:[3, 4] - } - try { - let ret = updater.setUpdatePolicy(policy).then(data => { - console.log("setUpdatePolicy success" + data); - expect(data).assertEqual(0); - }).catch(error => - console.error("setUpdatePolicy error " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error('[testSetUpdatePolicyPromise] fail.' + e); - } - console.info('[setUpdatePolicy] success.'); - console.info('testSetUpdatePolicyPromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0037 - * @tc.name testGetUpdatePolicyPromise - * @tc.desc Promise method call. - */ - it('testGetUpdatePolicyPromise', 0, function() { - console.info('testGetUpdatePolicyPromise START'); - try { - let ret = updater.getUpdatePolicy().then(data => { - console.log("UPDATE_TEST getUpgradePolicy success" + data); - expect(data.downloadStrategy).assertEqual(false); - expect(data.autoUpgradeStrategy).assertEqual(true); - expect(data.autoUpgradePeriods[0]).assertEqual(3); - expect(data.autoUpgradePeriods[1]).assertEqual(4); - }).catch(error => - console.error("getUpdatePolicy catch " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error('[testGetUpdatePolicyPromise] fail.' + e); - } - console.info('[getUpdatePolicy] success.'); - console.info('testGetUpdatePolicyPromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0038 - * @tc.name testSetUpdatePolicyPromise002 - * @tc.desc Promise method call. - */ - it('testSetUpdatePolicyPromise002', 0, function() { - console.info('testSetUpdatePolicyPromise002 START' + updater); - let policy = { - downloadStrategy: false, - autoUpgradeStrategy: true, - autoUpgradePeriods:[1, 2] - } - try { - let ret = updater.setUpdatePolicy(policy).then(data => { - console.log("setUpdatePolicy success" + data); - expect(data).assertEqual(0); - }).catch(error => - console.error("setUpdatePolicy error " + error) - ); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error('[setUpdatePolicy] fail.' + e); - } - console.info('[setUpdatePolicy] success.'); - console.info('testSetUpdatePolicyPromise002 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0039 - * @tc.name testGetUpdatePolicy002 - * @tc.desc Promise method call. - */ - it('testGetUpdatePolicyPromise002', 0, function() { - console.info('testGetUpdatePolicyPromise002 START'); - try { - let ret = updater.getUpdatePolicy().then(data => { - console.log("UPDATE_TEST getUpgradePolicy success" + data); - expect(data.downloadStrategy).assertEqual(false); - expect(data.autoUpgradeStrategy).assertEqual(true); - expect(data.autoUpgradePeriods[0]).assertEqual(1); - expect(data.autoUpgradePeriods[1]).assertEqual(2); - }); - expect(ret != 0).assertTrue(); - } catch(e) { - console.error('[testGetUpdatePolicyPromise002] fail.' + e); - } - console.info('[getUpdatePolicy] success.'); - console.info('testGetUpdatePolicyPromise002 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0040 - * @tc.name testSetUpdatePolicyPromise003 - * @tc.desc Promise method call. - */ - it('testSetUpdatePolicyPromise003', 0, function() { - console.info('testSetUpdatePolicyPromise003 START'); - // Set strategy. - let policy = { - downloadStrategy: false, - autoUpgradeStrategy: false, - autoUpgradePeriods:[1, 2] - } - try { - let ret = updater.setUpdatePolicy(policy).then(data => { - console.log("setUpdatePolicy success" + data); - expect(data).assertEqual(0); - }).catch(error => { - console.info('[setUpdatePolicy] error ' + error) - }) - expect(ret != 0).assertTrue(); - } catch(e) { - console.error('[testSetUpdatePolicyPromise003] fail.' + e); - } - console.info('[setUpdatePolicy] success.'); - console.info('testSetUpdatePolicyPromise003 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0041 - * @tc.name testGetUpdatePolicyPromise003 - * @tc.desc Promise method call. - */ - it('testGetUpdatePolicyPromise003', 0, function() { - console.info('testGetUpdatePolicyPromise003 START '); - try { - let ret = updater.getUpdatePolicy().then(data => { - console.log("UPDATE_TEST getUpgradePolicy success" + data); - expect(data.downloadStrategy).assertEqual(false); - expect(data.autoUpgradeStrategy).assertEqual(false); - expect(data.autoUpgradePeriods[0]).assertEqual(1); - expect(data.autoUpgradePeriods[1]).assertEqual(2); - }).catch(error => { - console.info('[getUpdatePolicy] error ' + error) - }) - expect(ret != 0).assertTrue(); - } catch(e) { - console.info('[getUpdatePolicy] catch ' + e) - } - console.info('[getUpdatePolicy] success.'); - console.info('testGetUpdatePolicyPromise003 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0042 - * @tc.name testSetUpdatePolicyPromise004 - * @tc.desc Promise method call. - */ - it('testSetUpdatePolicyPromise004', 0, function() { - console.info('testSetUpdatePolicyPromise004 START' + updater); - // Set strategy. - let policy = { - downloadStrategy: false, - autoUpgradeStrategy: false, - autoUpgradePeriods:[2, 3] - } - try { - let ret = updater.setUpdatePolicy(policy).then(data => { - console.log("setUpdatePolicy success" + data); - expect(data).assertEqual(0); - }).catch(error => { - console.info('[setUpdatePolicy] error ' + error) - }) - expect(ret != 0).assertTrue(); - } catch(e) { - console.info('[testSetUpdatePolicyPromise004] catch ' + e) - } - console.info('[setUpdatePolicy] success.'); - console.info('testSetUpdatePolicyPromise004 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0043 - * @tc.name testGetUpdatePolicyPromise004 - * @tc.desc Promise method call. - */ - it('testGetUpdatePolicyPromise004', 0, function() { - console.info('testGetUpdatePolicyPromise004 START' + updater); - try { - let ret = updater.getUpdatePolicy().then(data => { - console.log("UPDATE_TEST getUpgradePolicy success" + data); - expect(data.downloadStrategy).assertEqual(false); - expect(data.autoUpgradeStrategy).assertEqual(false); - expect(data.autoUpgradePeriods[0]).assertEqual(2); - expect(data.autoUpgradePeriods[1]).assertEqual(3); - }).catch(error => { - console.info('[getUpdatePolicy] error ' + error) - }) - expect(ret != 0).assertTrue(); - } catch(e) { - console.info('[testSetUpdatePolicyPromise004] catch ' + e) - } - console.info('[getUpdatePolicy] success.'); - console.info('testGetUpdatePolicyPromise004 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0044 - * @tc.name testSetUpdatePolicyPromise005 - * @tc.desc Test incorrect parameters. - */ - it('testSetUpdatePolicyPromise005', 0, function() { - console.info('testSetUpdatePolicyPromise005 START' + updater); - try { - let ret = updater.setUpdatePolicy("").then(data => { - console.log("setUpdatePolicy success" + data); - expect(data).assertEqual(0); - }); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[setUpdatePolicy] catch ' + e); - } - console.info('[setUpdatePolicy] success.'); - console.info('testSetUpdatePolicyPromise005 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0045 - * @tc.name testGetUpdatePolicyPromise005 - * @tc.desc Test incorrect parameters. - */ - it('testGetUpdatePolicyPromise005', 0, function() { - console.info('testGetUpdatePolicy005 START' + updater); - try{ - let ret = updater.getUpdatePolicy(param_value1).then(data => { - }) - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[setUpdatePolicy] catch ' + e); - } - console.info('[getUpdatePolicy] success.'); - console.info('testGetUpdatePolicyPromise005 END'); - }); - - /* - /** - * @tc.number SUB_UPDATE_JS_API_0046 - * @tc.name testDownloadVersion - * @tc.desc Unsubscribe from monitoring. - */ - it('testDownloadVersion', 0, function() { - console.info('testDownloadVersion START'); - // Open download monitor. - try{ - let versionDigestInfo = { - versionDigest: "versionDigest test", - } - let downloadOptions ={ - allowNetwork: 1, - order: 2 - } - let eventClassifyInfo = { - eventClassify : 0x01000000, - extraInfo: "" - } - let ret = updater.off(eventClassifyInfo,eventInfo=>{ - console.info("UPDATE_TEST eventInfo is "+JSON.stringify(eventInfo)); - }); - expect(ret).assertInstanceOf('Number'); - ret =updater.download(versionDigestInfo,downloadOptions,err=>{ - console.info("UPDATE_TEST error msg is "+JSON.stringify(err)); - }) - console.info("UPDATE_TEST ret is "+ret); - expect(ret).assertInstanceOf('Number'); - ret = updater.off(eventClassifyInfo,eventInfo=>{ - console.info("UPDATE_TEST eventInfo is "+JSON.stringify(eventInfo)); - }); - expect(ret).assertInstanceOf('Number'); - } catch (e) { - console.info('[testDownloadVersion] catch ' + e); - } - - console.info('[downloadVersion] success.'); - console.info('testDownloadVersion END'); - }); - - /* - /** - * @tc.number SUB_UPDATE_JS_API_0047 - * @tc.name testDownloadVersionPromise - * @tc.desc Unsubscribe from monitoring. - */ - it('testDownloadVersionPromise', 0, function() { - console.info('testDownloadVersionPromise START'); - // Open download monitor. - try{ - let versionDigestInfo = { - versionDigest: "versionDigest test", - } - let downloadOptions ={ - allowNetwork: 1, - order: 2 - } - let eventClassifyInfo = { - eventClassify : 0x01000000, - extraInfo: "" - } - let ret = updater.off(eventClassifyInfo,eventInfo=>{ - console.info("UPDATE_TEST eventInfo is "+JSON.stringify(eventInfo)); - }); - expect(ret).assertInstanceOf('Number'); - ret =updater.download(versionDigestInfo,downloadOptions).then(err=>{ - console.info("UPDATE_TEST error msg is "+JSON.stringify(err)); - }) - console.info("UPDATE_TEST ret is "+ret); - expect(ret).assertInstanceOf('Promise'); - ret = updater.off(eventClassifyInfo,eventInfo=>{ - console.info("UPDATE_TEST eventInfo is "+JSON.stringify(eventInfo)); - }); - expect(ret).assertInstanceOf('Number'); - } catch (e) { - console.info('[testDownloadVersion] catch ' + e); - } - - console.info('[downloadVersion] success.'); - console.info('testDownloadVersion END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0047 - * @tc.name testDownloadVersion02 - * @tc.desc Unsubscribe out of monitoring. - * - it('testDownloadVersion02', 0, function() { - console.info('testDownloadVersion02 START'); - // Open download monitor - try{ - updater.on('downloadProgress', progress => { - console.log("downloadProgress on" + progress); - console.log(`downloadProgress status: ` + progress.status); - console.log(`downloadProgress percent: ` + progress.percent); - console.log(`downloadProgress endReason: ` + progress.endReason); - if (progress.status === updateState.UPDATE_STATE_DOWNLOAD_SUCCESS || - progress.status === updateState.UPDATE_STATE_VERIFY_SUCCESS) { - expect(progress.percent).assertEqual(expect_value); - } - }) - let ret = updater.download(); - // Cancel subscription immediately, no callback will be received. - updater.off("downloadProgress"); - expect(ret).assertInstanceOf('Number'); - } catch (e) { - console.info('[testDownloadVersion02] catch ' + e); - } - console.info('[downloadVersion] success.'); - console.info('testDownloadVersion END'); - }); - */ - - /** - * @tc.number SUB_UPDATE_JS_API_0048 - * @tc.name testDownloadVersion03 - * @tc.desc Test download parameter, callback is not supported. - */ - it('testDownloadVersion03', 0, function() { - console.info('testDownloadVersion03 START'); - try{ - let ret = updater.download(progress => { - console.log("downloadProgress on" + progress); - console.log(`downloadProgress status: ` + progress.status); - console.log(`downloadProgress percent: ` + progress.percent); - console.log(`downloadProgress endReason: ` + progress.endReason); - if (progress.status === updateState.UPDATE_STATE_DOWNLOAD_SUCCESS || - progress.status === updateState.UPDATE_STATE_VERIFY_SUCCESS) { - expect(progress.percent).assertEqual(expect_value); - } - }) - expect(ret).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testDownloadVersion03] catch ' + e); - } - console.info('[downloadVersion] success.'); - console.info('testDownloadVersion END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0049 - * @tc.name testDownloadVersion04 - * @tc.desc Test subscription without parameters, return error. - */ - it('testDownloadVersion04', 0, function() { - console.info('testDownloadVersion04 START'); - try{ - // Open download monitor. - let ret = updater.on('downloadProgress'); - expect(ret).assertInstanceOf('Undefined'); - let ret_download = updater.download(); - expect(ret_download).assertInstanceOf('Undefined'); - // Cancel subscription immediately, no callback will be received. - let ret_off = updater.off("downloadProgress"); - expect(ret_off).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testDownloadVersion04] catch ' + e); - } - console.info('[downloadVersion] success.'); - console.info('testDownloadVersion04 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0050 - * @tc.name testDownloadVersion05 - * @tc.desc Take function to subscribe. - */ - it('testDownloadVersion05', 0, function() { - function testFunction(progress) { - console.log("downloadProgress on" + progress); - console.log(`downloadProgress status: ` + progress.status); - console.log(`downloadProgress percent: ` + progress.percent); - console.log(`downloadProgress endReason: ` + progress.endReason); - } - console.info('testDownloadVersion05 START'); - try{ - // Open download monitor. - let ret = updater.on('downloadProgress', testFunction); - expect(ret).assertInstanceOf('Undefined'); - - let ret_download = updater.download(); - expect(ret_download).assertInstanceOf('Undefined'); - // Cancel subscription immediately, no callback will be received. - let ret_off = updater.off("downloadProgress", testFunction); - expect(ret_off).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testDownloadVersion05] catch ' + e); - } - console.info('[downloadVersion] success.'); - console.info('testDownloadVersion05 END'); - }); - - - /** - * @tc.number SUB_UPDATE_JS_API_0051 - * @tc.name testUpgradeVersion01 - * @tc.desc Unsubscribe from monitoring. - */ - it('testUpgradeVersion01', 0, function() { - console.info('testUpgradeVersion01 START'); - try{ - // Open download monitor. - updater.on('upgradeProgress', progress => { - console.log("upgradeProgress on" + progress); - console.log(`upgradeProgress status: ` + progress.status); - console.log(`upgradeProgress percent: ` + progress.percent); - console.log(`upgradeProgress endReason: ` + progress.endReason); - if (progress.status === updateState.UPDATE_STATE_DOWNLOAD_SUCCESS || - progress.status === updateState.UPDATE_STATE_VERIFY_SUCCESS) { - expect(progress.percent).assertEqual(expect_value); - updater.off("upgradeProgress"); - } - }) - let ret = updater.upgrade(); - expect(ret).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testUpgradeVersion01] catch ' + e); - } - console.info('[upgrade] success.'); - console.info('testUpgradeVersion01 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0052 - * @tc.name testUpgradeVersion02 - * @tc.desc Unsubscribe out of monitoring. - */ - it('testUpgradeVersion02', 0, function() { - console.info('testUpgradeVersion02 START'); - try{ - // Open download monitor. - let ret_on = updater.on('upgradeProgress', progress => { - console.log("upgradeProgress on" + progress); - console.log(`upgradeProgress status: ` + progress.status); - console.log(`upgradeProgress percent: ` + progress.percent); - console.log(`upgradeProgress endReason: ` + progress.endReason); - if (progress.status === updateState.UPDATE_STATE_DOWNLOAD_SUCCESS || - progress.status === updateState.UPDATE_STATE_VERIFY_SUCCESS) { - expect(progress.percent).assertEqual(expect_value); - } - }) - expect(ret_on).assertInstanceOf('Undefined'); - let ret = updater.upgrade(); - expect(ret).assertInstanceOf('Undefined'); - // Cancel subscription immediately, no callback will be received. - let ret_off = updater.off("upgradeProgress"); - expect(ret_off).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testUpgradeVersion02] catch ' + e); - } - console.info('[upgrade] success.'); - console.info('testUpgradeVersion02 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0053 - * @tc.name testUpgradeVersion03 - * @tc.desc Test download parameter, callback is not supported. - */ - it('testUpgradeVersion03', 0, function() { - console.info('testUpgradeVersion03 START'); - try{ - let ret = updater.upgrade(progress => { - console.log("upgradeProgress on" + progress); - console.log(`upgradeProgress status: ` + progress.status); - console.log(`upgradeProgress percent: ` + progress.percent); - console.log(`upgradeProgress endReason: ` + progress.endReason); - if (progress.status === updateState.UPDATE_STATE_DOWNLOAD_SUCCESS || - progress.status === updateState.UPDATE_STATE_VERIFY_SUCCESS) { - expect(progress.percent).assertEqual(expect_value); - } - }) - expect(ret).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testUpgradeVersion03] catch ' + e); - } - console.info('[upgrade] success.'); - console.info('testUpgradeVersion03 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0054 - * @tc.name testUpgradeVersion04 - * @tc.desc Test subscription without parameters, return error. - */ - it('testUpgradeVersion04', 0, function() { - console.info('testUpgradeVersion04 START'); - try{ - // Open download monitor. - let ret = updater.on('upgradeProgress'); - expect(ret).assertInstanceOf('Undefined'); - let ret_upgrade = updater.upgrade(); - expect(ret_upgrade).assertInstanceOf('Undefined'); - // Cancel subscription immediately, no callback will be received. - let ret_off = updater.off("upgradeProgress"); - expect(ret_off).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testUpgradeVersion04] catch ' + e); - } - console.info('[upgrade] success.'); - console.info('testUpgradeVersion04 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0055 - * @tc.name testUpgradeVersion05 - * @tc.desc Take function to subscribe. - */ - it('testUpgradeVersion05', 0, function() { - function testFunction(progress) { - console.log("upgradeProgress on" + progress); - console.log(`upgradeProgress status: ` + progress.status); - console.log(`upgradeProgress percent: ` + progress.percent); - console.log(`upgradeProgress endReason: ` + progress.endReason); - } - console.info('testUpgradeVersion05 START'); - try{ - let ret = updater.on('upgradeProgress', testFunction); - expect(ret).assertInstanceOf('Undefined'); - - let ret_upgrade = updater.upgrade(); - expect(ret_upgrade).assertInstanceOf('Undefined'); - - let ret_off = updater.off("upgradeProgress", testFunction); - expect(ret_off).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testUpgradeVersion05] catch ' + e); - } - console.info('[upgrade] success.'); - console.info('testUpgradeVersion05 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0056 - * @tc.name testOnDownload2 - * @tc.desc Test incorrect parameters. - */ - it('testOnDownload', 0, function() { - console.info('testOnDownload START'); - try{ - let ret = updater.on(function(){}); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOnDownload] catch ' + e); - } - console.info('[testOnDownload] success.'); - console.info('testOnDownload END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0057 - * @tc.name testOnDownload2 - * @tc.desc Test incorrect parameters. - */ - it('testOnDownload2', 0, function() { - console.info('testOnDownload2 START'); - try{ - let ret = updater.on(); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOnDownload2] catch ' + e); - } - console.info('[testOnDownload2] success.'); - console.info('testOnDownload2 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0058 - * @tc.name testOnDownload3 - * @tc.desc Test incorrect parameters. - */ - it('testOnDownload3', 0, function() { - console.info('testOnDownload3 START'); - try{ - let ret = updater.on("333333333"); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOnDownload3] catch ' + e); - } - console.info('[testOnDownload3] success.'); - console.info('testOnDownload3 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0059 - * @tc.name testOnDownload3 - * @tc.desc Test incorrect parameters. - */ - it('testOnDownload4', 0, function() { - console.info('testOnDownload3 START'); - try{ - let ret = updater.on(param_value2); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOnDownload4] catch ' + e); - } - console.info('[testOnDownload4] success.'); - console.info('testOnDownload4 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0060 - * @tc.name testOnDownload4 - * @tc.desc Test incorrect parameters. - */ - it('testOnDownload5', 0, function() { - console.info('testOnDownload5 START'); - try{ - let ret = updater.on(param_value2, "4444444444444"); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOnDownload5] catch ' + e); - } - console.info('[testOnDownload5] success.'); - console.info('testOnDownload5 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0061 - * @tc.name testOffDownload - * @tc.desc Test incorrect parameters. - */ - it('testOffDownload', 0, function() { - console.info('testOffDownload START'); - try{ - let ret = updater.off(); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOffDownload] catch ' + e); - } - console.info('[testOffDownload] success.'); - console.info('testOffDownload END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0062 - * @tc.name testOffDownload2 - * @tc.desc Test incorrect parameters. - */ - it('testOffDownload2', 0, function() { - console.info('testOffDownload2 START'); - try{ - let ret = updater.off("333333333"); - expect(ret).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testOffDownload2] catch ' + e); - } - console.info('[testOffDownload2] success.'); - console.info('testOffDownload2 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0063 - * @tc.name testOffDownload3 - * @tc.desc Test incorrect parameters. - */ - it('testOffDownload3', 0, function() { - console.info('testOffDownload3 START'); - try{ - let ret = updater.on(param_value2); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOffDownload3] catch ' + e); - } - console.info('[testOffDownload3] success.'); - console.info('testOffDownload3 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0064 - * @tc.name testOffDownload4 - * @tc.desc Test incorrect parameters. - */ - it('testOffDownload4', 0, function() { - console.info('testOffDownload4 START'); - try{ - let ret = updater.off(param_value2, "4444444444444"); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOffDownload4] catch ' + e); - } - console.info('[testOffDownload4] success.'); - console.info('testOffDownload4 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0065 - * @tc.name testOffDownload5 - * @tc.desc Test incorrect parameters. - */ - it('testOffDownload5', 0, function() { - console.info('testOffDownload5 START'); - try{ - let ret = updater.off(function(){}); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOffDownload5] catch ' + e); - } - console.info('[testOffDownload5] success.'); - console.info('testOffDownload5 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0066 - * @tc.name testOnUpgrade - * @tc.desc Test incorrect parameters. - */ - it('testOnUpgrade', 0, function() { - console.info('testOnUpgrade START'); - try{ - let ret = updater.on("upgradeProgress", function(){}); - expect(ret).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testOnUpgrade] catch ' + e); - } - console.info('[testOnUpgrade] success.'); - console.info('testOnUpgrade END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0067 - * @tc.name testOnUpgrade2 - * @tc.desc Test incorrect parameters. - */ - it('testOnUpgrade2', 0, function() { - console.info('testOnUpgrade2 START'); - try{ - let ret = updater.on("upgradeProgress"); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOnUpgrade2] catch ' + e); - } - console.info('[testOnUpgrade2] success.'); - console.info('testOnUpgrade2 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0068 - * @tc.name testOnUpgrade3 - * @tc.desc Test incorrect parameters. - */ - it('testOnUpgrade3', 0, function() { - console.info('testOnUpgrade3 START'); - try{ - let ret = updater.on("upgradeProgress", "333333333"); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOnUpgrade3] catch ' + e); - } - console.info('[testOnUpgrade3] success.'); - console.info('testOnUpgrade3 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0069 - * @tc.name testOnDownload3 - * @tc.desc Test incorrect parameters. - */ - it('testOnUpgrade4', 0, function() { - console.info('testOnUpgrade4 START'); - try{ - let ret = updater.on("upgradeProgress", param_value2); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOnUpgrade3] catch ' + e); - } - console.info('[testOnUpgrade4] success.'); - console.info('testOnUpgrade4 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0070 - * @tc.name testOnUpgrade5 - * @tc.desc Test incorrect parameters. - */ - it('testOnUpgrade5', 0, function() { - console.info('testOnUpgrade5 START'); - try{ - let ret = updater.on(param_value2, "4444444444444"); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOnUpgrade5] catch ' + e); - } - console.info('[testOnUpgrade5] success.'); - console.info('testOnUpgrade5 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0071 - * @tc.name testOffUpgrade - * @tc.desc Test incorrect parameters. - */ - it('testOffUpgrade', 0, function() { - console.info('testOffUpgrade START'); - try{ - let ret = updater.off("upgradeProgress"); - expect(ret).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testOffUpgrade] catch ' + e); - } - console.info('[testOffUpgrade] success.'); - console.info('testOffUpgrade END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0072 - * @tc.name testOffUpgrade2 - * @tc.desc Test incorrect parameters. - */ - it('testOffUpgrade2', 0, function() { - console.info('testOffUpgrade2 START'); - try{ - let ret = updater.off("upgradeProgress", "333333333"); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOffUpgrade] catch ' + e); - } - console.info('[testOffUpgrade2] success.'); - console.info('testOffUpgrade2 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0073 - * @tc.name testOffUpgrade3 - * @tc.desc Test incorrect parameters. - */ - it('testOffUpgrade3', 0, function() { - console.info('testOffDownload3 START'); - try{ - let ret = updater.on("upgradeProgress", param_value2); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOffUpgrade3] catch ' + e); - } - console.info('[testOffUpgrade3] success.'); - console.info('testOffUpgrade3 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0074 - * @tc.name testOffUpgrade4 - * @tc.desc Test incorrect parameters. - */ - it('testOffUpgrade4', 0, function() { - console.info('testOffUpgrade4 START'); - try{ - let ret = updater.off("upgradeProgress", param_value2, "4444444444444"); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOffUpgrade4] catch ' + e); - } - console.info('[testOffUpgrade4] success.'); - console.info('testOffUpgrade4 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0075 - * @tc.name testOffUpgrade5 - * @tc.desc Test incorrect parameters. - */ - it('testOffUpgrade5', 0, function() { - console.info('testOffUpgrade5 START'); - try{ - let ret = updater.off("upgradeProgress", "6"); - expect(ret != 0).assertTrue(); - } catch (e) { - console.info('[testOffUpgrade5] catch ' + e); - } - console.info('[testOffUpgrade5] success.'); - console.info('testOffUpgrade5 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0081 - * @tc.name testVerifyVersion - * @tc.desc Unsubscribe from monitoring. - */ - it('testVerifyVersion', 0, function() { - console.info('testVerifyVersion START'); - try{ - updater.on('verifyProgress', progress => { - console.log("verifyProgress on" + progress); - console.log(`verifyProgress status: ` + progress.status); - console.log(`verifyProgress percent: ` + progress.percent); - console.log(`verifyProgress endReason: ` + progress.endReason); - if (progress.status === updateState.UPDATE_STATE_DOWNLOAD_SUCCESS || - progress.status === updateState.UPDATE_STATE_VERIFY_SUCCESS) { - expect(progress.percent).assertEqual(expect_value); - updater.off("verifyProgress"); - } - }) - let ret = updater.verifyUpdatePackage('/data/updater/updater.zip','/data/updater/HwOUC/update_auth.sa'); - expect(ret).assertInstanceOf('Number'); - } catch (e) { - console.info('[testVerifyVersion] catch ' + e); - } - console.info('[verifyVersion] success.'); - console.info('testVerifyVersion END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0082 - * @tc.name testVerifyVersion02 - * @tc.desc Unsubscribe out of monitoring. - */ - it('testVerifyVersion02', 0, function() { - console.info('testVerifyVersion02 START'); - try{ - updater.on('verifyProgress', progress => { - console.log("verifyProgress on" + progress); - console.log(`verifyProgress status: ` + progress.status); - console.log(`verifyProgress percent: ` + progress.percent); - console.log(`verifyProgress endReason: ` + progress.endReason); - if (progress.status === updateState.UPDATE_STATE_DOWNLOAD_SUCCESS || - progress.status === updateState.UPDATE_STATE_VERIFY_SUCCESS) { - expect(progress.percent).assertEqual(expect_value); - } - }) - let ret = updater.verifyUpdatePackage('/data/updater/updater.zip','/data/updater/HwOUC/update_auth.sa'); - updater.off("verifyProgress"); - expect(ret).assertInstanceOf('Number'); - } catch (e) { - console.info('[testVerifyVersion02] catch ' + e); - } - console.info('[verifyVersion] success.'); - console.info('testVerifyVersion END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0083 - * @tc.name testVerifyVersion03 - * @tc.desc Test verify parameter, callback is not supported. - */ - it('testVerifyVersion03', 0, function() { - console.info('testVerifyVersion03 START'); - try{ - let ret = updater.verifyUpdatePackage('/data/updater/updater.zip','/data/updater/HwOUC/update_auth.sa',progress => { - console.log("verifyProgress on" + progress); - console.log(`verifyProgress status: ` + progress.status); - console.log(`verifyProgress percent: ` + progress.percent); - console.log(`verifyProgress endReason: ` + progress.endReason); - if (progress.status === updateState.UPDATE_STATE_DOWNLOAD_SUCCESS || - progress.status === updateState.UPDATE_STATE_VERIFY_SUCCESS) { - expect(progress.percent).assertEqual(expect_value); - } - }) - expect(ret).assertInstanceOf('Number'); - } catch (e) { - console.info('[testVerifyVersion03] catch ' + e); - } - console.info('[verifyVersion] success.'); - console.info('testVerifyVersion END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0084 - * @tc.name testVerifyVersion04 - * @tc.desc Test subscription without parameters, return error. - */ - it('testVerifyVersion04', 0, function() { - console.info('testVerifyVersion04 START'); - try{ - let ret = updater.on('verifyProgress'); - expect(ret).assertInstanceOf('Undefined'); - let ret_verify = updater.verifyUpdatePackage(); - expect(ret_verify).assertInstanceOf('Undefined'); - let ret_off = updater.off("verifyProgress"); - expect(ret_off).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testVerifyVersion04] catch ' + e); - } - console.info('[verifyVersion] success.'); - console.info('testVerifyVersion04 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0085 - * @tc.name testVerifyVersion05 - * @tc.desc Take function to subscribe. - */ - it('testVerifyVersion05', 0, function() { - function testFunction(progress) { - console.log("verifyProgress on" + progress); - console.log(`verifyProgress status: ` + progress.status); - console.log(`verifyProgress percent: ` + progress.percent); - console.log(`verifyProgress endReason: ` + progress.endReason); - } - console.info('testVerifyVersion05 START'); - try{ - let ret = updater.on('verifyProgress', testFunction); - expect(ret).assertInstanceOf('Undefined'); - let ret_verify = updater.verifyUpdatePackage('/data/updater/updater.zip','/data/updater/HwOUC/update_auth.sa'); - expect(ret_verify).assertInstanceOf('Number'); - let ret_off = updater.off("verifyProgress", testFunction); - expect(ret_off).assertInstanceOf('Undefined'); - } catch (e) { - console.info('[testVerifyVersion05] catch ' + e); - } - console.info('[verifyVersion] success.'); - console.info('testVerifyVersion05 END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0086 - * @tc.name testPackageTypes - * @tc.desc check packageTypes is defined correct. - */ - it('testPackageTypes', 0, function() { - console.info('testPackageTypes START'); - try { - expect(updater.PackageTypes.PACKAGE_TYPE_NORMAL).assertEqual(1); - expect(updater.PackageTypes.PACKAGE_TYPE_BASE).assertEqual(2); - expect(updater.PackageTypes.PACKAGE_TYPE_CUST).assertEqual(3); - expect(updater.PackageTypes.PACKAGE_TYPE_PRELOAD).assertEqual(4); - expect(updater.PackageTypes.PACKAGE_TYPE_COTA).assertEqual(5); - expect(updater.PackageTypes.PACKAGE_TYPE_VERSION).assertEqual(6); - expect(updater.PackageTypes.PACKAGE_TYPE_PATCH).assertEqual(7); - } catch(e) { - console.error('[testPackageTypes] fail.' + e); - } - console.info('[PackageTypes] success.'); - console.info('testPackageTypes END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0087 - * @tc.name testNewVersionStatus - * @tc.desc check NewVersionStatus is defined correct. - */ - it('testNewVersionStatus', 0, function() { - console.info('testNewVersionStatus START'); - try { - expect(updater.NewVersionStatus.VERSION_STATUS_ERR).assertEqual(-1); - expect(updater.NewVersionStatus.VERSION_STATUS_NEW).assertEqual(0); - expect(updater.NewVersionStatus.VERSION_STATUS_NONE).assertEqual(1); - expect(updater.NewVersionStatus.VERSION_STATUS_BUSY).assertEqual(2); - } catch(e) { - console.error('[testNewVersionStatus] fail.' + e); - } - console.info('[NewVersionStatus] success.'); - console.info('testNewVersionStatus END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0088 - * @tc.name testInstallMode - * @tc.desc check InstallMode is defined correct. - */ - it('testInstallMode', 0, function() { - console.info('testInstallMode START'); - try { - expect(updater.InstallMode.INSTALL_MODE_NORMAL).assertEqual(0); - expect(updater.InstallMode.INSTALL_MODE_NIGHT).assertEqual(1); - expect(updater.InstallMode.INSTALL_MODE_AUTO).assertEqual(2); - } catch(e) { - console.error('[testInstallMode] fail.' + e); - } - console.info('[InstallMode] success.'); - console.info('testInstallMode END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0089 - * @tc.name testCheckResultAndDescriptionInfo - * @tc.desc check checkResult and descriptionInfo is defined correct. - */ - it('testInstallMode', 0, function() { - console.info('testCheckResultAndDescriptionInfo START'); - try { - let descriptionInfo = updater.DescriptionInfo.content; - console.info('test DescriptionInfo.content is ' + descriptionInfo); - expect(updater.CheckResult.packageType.PACKAGE_TYPE_NORMAL).assertEqual(1); - } catch(e) { - console.error('[testCheckResultAndDescriptionInfo] fail.' + e); - } - console.info('[CheckResultAndDescriptionInfo] success.'); - console.info('testCheckResultAndDescriptionInfo END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0090 - * @tc.name testGetUpdaterForOther - * @tc.desc Test getUpdaterForOther obj. - */ - it('testGetUpdaterForOther', 0, function() { - console.info('testGetUpdaterForOther START'); - try { - if (client === undefined) { - console.error("client not defined"); - return; - } - let tmpGetUpdaterForOther = client.getUpdaterForOther('/data/updater/updater.zip', '1234567890', 'OTA'); - expect(tmpGetUpdaterForOther != undefined).assertTrue(); - } catch(e) { - console.error('[testGetUpdaterForOther] fail.' + e); - } - - console.info('[client.getUpdaterForOther] success.'); - console.info('testGetUpdaterForOther END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0091 - * @tc.name testGetUpdaterFromOther - * @tc.desc Test getUpdaterFromOther obj. - */ - it('testGetUpdaterFromOther', 0, function() { - console.info('testGetUpdaterFromOther START'); - try { - if (client === undefined) { - console.error("client not defined"); - return; - } - let tmpGetUpdaterFromOther = client.getUpdaterFromOther('/data/updater/updater.zip', '1234567890', 'OTA'); - expect(tmpGetUpdaterFromOther != undefined).assertTrue(); - } catch(e) { - console.error('[testGetUpdaterFromOther] fail.' + e); - } - - console.info('[client.getUpdaterFromOther] success.'); - console.info('testGetUpdaterFromOther END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0092 - * @tc.name testPauseDownloadCallback - * @tc.desc Test PauseDownload Callback Type - */ - it('testPauseDownloadCallback', 0, function() { - console.info('UPDATE_TEST testPauseDownloadCallback START'); - try { - if(updater === undefined) { - updater = client.getOnlineUpdater(upgradeInfo); - } - let versionDigestInfo = { - versionDigest: "versionDigest pasue" - } - let pauseDownloadOptions = { - isAllowAutoResume: true - } - let ret =updater.pauseDownload(versionDigestInfo,pauseDownloadOptions,err=>{ - console.info("UPDATE_TEST error msg is "+JSON.stringify(err)); - }) - console.info("UPDATE_TEST ret is "+ret); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('UPDATE_TEST [testPauseDownloadCallback] fail.' + e); - } - console.info('UPDATE_TEST [client.testPauseDownloadCallback] success.'); - console.info('UPDATE_TEST testPauseDownloadCallback END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0093 - * @tc.name testPauseDownloadPromise - * @tc.desc Test PauseDownload promise Type - */ - it('testPauseDownloadPromise', 0, function() { - console.info('UPDATE_TEST testPauseDownloadPromise START'); - try { - if(updater === undefined) { - updater = client.getOnlineUpdater(upgradeInfo); - } - let versionDigestInfo = { - versionDigest: "versionDigest pasue" - } - let pauseDownloadOptions = { - isAllowAutoResume: true - } - let ret =updater.pauseDownload(versionDigestInfo,pauseDownloadOptions).then(err=>{ - console.info("UPDATE_TEST error msg is "+JSON.stringify(err)); - }) - console.info("UPDATE_TEST ret is "+ret); - expect(ret).assertInstanceOf('Promise'); - } catch(e) { - console.error('UPDATE_TEST [testPauseDownloadPromise] fail.' + e); - } - console.info('UPDATE_TEST [client.testPauseDownloadPromise] success.'); - console.info('UPDATE_TEST testPauseDownloadPromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0094 - * @tc.name testUpgradeCallback - * @tc.desc Test testUpgrade Callback Type - */ - it('testUpgradeCallback', 0, function() { - console.info('UPDATE_TEST testUpgradeCallback START'); - try { - if(updater === undefined) { - updater = client.getOnlineUpdater(upgradeInfo); - } - let versionDigestInfo = { - versionDigest: "versionDigest pasue" - } - let upgradeOptions = { - order: 1 - } - let eventClassifyInfo = { - eventClassify : 0x01000000, - extraInfo: "" - } - let ret = updater.off(eventClassifyInfo,eventInfo=>{ - console.info("UPDATE_TEST eventInfo is "+JSON.stringify(eventInfo)); - }); - expect(ret).assertInstanceOf('Number'); - ret =updater.upgrade(versionDigestInfo,upgradeOptions,err=>{ - console.info("UPDATE_TEST error msg is "+JSON.stringify(err)); - }) - console.info("UPDATE_TEST ret is "+ret); - expect(ret).assertInstanceOf('Number'); - ret = updater.off(eventClassifyInfo,eventInfo=>{ - console.info("UPDATE_TEST eventInfo is "+JSON.stringify(eventInfo)); - }); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('UPDATE_TEST [testUpgradeCallback] fail.' + e); - } - console.info('UPDATE_TEST [client.testUpgradeCallback] success.'); - console.info('UPDATE_TEST testUpgradeCallback END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0095 - * @tc.name testUpgradePromise - * @tc.desc Test testUpgrade promise Type - */ - it('testUpgradePromise', 0, function() { - console.info('UPDATE_TEST testUpgradePromise START'); - try { - if(updater === undefined) { - updater = client.getOnlineUpdater(upgradeInfo); - } - let versionDigestInfo = { - versionDigest: "versionDigest pasue" - } - let upgradeOptions = { - order: 1 - } - let eventClassifyInfo = { - eventClassify : 0x01000000, - extraInfo: "" - } - let ret = updater.off(eventClassifyInfo,eventInfo=>{ - console.info("UPDATE_TEST eventInfo is "+JSON.stringify(eventInfo)); - }); - expect(ret).assertInstanceOf('Number'); - ret =updater.upgrade(versionDigestInfo,upgradeOptions).then(err=> { - console.info("UPDATE_TEST error msg is "+JSON.stringify(err)); - }); - console.info("UPDATE_TEST ret is "+ret); - expect(ret).assertInstanceOf('Promise'); - ret = updater.off(eventClassifyInfo,eventInfo=>{ - console.info("UPDATE_TEST eventInfo is "+JSON.stringify(eventInfo)); - }); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('UPDATE_TEST [testUpgradePromise] fail.' + e); - } - console.info('UPDATE_TEST [client.testUpgradePromise] success.'); - console.info('UPDATE_TEST testUpgradePromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0096 - * @tc.name testClearErrorCallback - * @tc.desc Test testClearError Callback Type - */ - it('testUpgradeCallback', 0, function() { - console.info('UPDATE_TEST testClearErrorCallback START'); - try { - if(updater === undefined) { - updater = client.getOnlineUpdater(upgradeInfo); - } - let versionDigestInfo = { - versionDigest: "versionDigest clearError" - } - let clearOptions = { - status: 1 - } - let ret =updater.upgrade(versionDigestInfo,clearOptions,err=>{ - console.info("UPDATE_TEST error msg is "+JSON.stringify(err)); - }) - expect(ret).assertInstanceOf('Undefined'); - } catch(e) { - console.error('UPDATE_TEST [testClearErrorCallback] fail.' + e); - } - console.info('UPDATE_TEST [client.testClearErrorCallback] success.'); - console.info('UPDATE_TEST testClearErrorCallback END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0097 - * @tc.name testClearErrorPromise - * @tc.desc Test testClearError promise Type - */ - it('testClearErrorPromise', 0, function() { - console.info('UPDATE_TEST testClearErrorPromise START'); - try { - if(updater === undefined) { - updater = client.getOnlineUpdater(upgradeInfo); - } - let versionDigestInfo = { - versionDigest: "versionDigest clearError" - } - let clearOptions = { - status: 1 - } - let ret =updater.upgrade(versionDigestInfo,clearOptions).then(err=>{ - console.info("UPDATE_TEST error msg is "+JSON.stringify(err)); - }); - expect(ret).assertInstanceOf('Promise'); - } catch(e) { - console.error('UPDATE_TEST [testClearErrorPromise] fail.' + e); - } - console.info('UPDATE_TEST [client.testClearErrorPromise] success.'); - console.info('UPDATE_TEST testClearErrorPromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0098 - * @tc.name testterminateUpgradeCallback - * @tc.desc Test testterminateUpgrade Callback Type - */ - it('testterminateUpgradeCallback', 0, function() { - console.info('UPDATE_TEST testterminateUpgradeCallback START'); - try { - let ret = updater.terminateUpgrade(function(result){ - console.info("UPDATE_TEST testterminateUpgradeCallback result is "+result); - }); - console.info("UPDATE_TEST testterminateUpgradeCallback ret is "+ret); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('UPDATE_TEST [testterminateUpgradeCallback] fail.' + e); - } - console.info('UPDATE_TEST [client.testterminateUpgradeCallback] success.'); - console.info('UPDATE_TEST testterminateUpgradeCallback END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0099 - * @tc.name testterminateUpgradePromise - * @tc.desc Test testterminateUpgrade Promise Type - */ - it('testterminateUpgradePromise', 0, function() { - console.info('UPDATE_TEST testterminateUpgradePromise START'); - try { - let ret = updater.terminateUpgrade().then((result)=>{ - console.info("UPDATE_TEST testterminateUpgradePromise result is "+result); - }); - console.info("UPDATE_TEST testterminateUpgradePromise ret is "+ret); - expect(ret).assertInstanceOf('Promise'); - } catch(e) { - console.error('UPDATE_TEST [testterminateUpgradePromise] fail.' + e); - } - console.info('UPDATE_TEST [client.testterminateUpgradePromise] success.'); - console.info('UPDATE_TEST testterminateUpgradePromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0100 - * @tc.name testGetRestorer - * @tc.desc Test GetRestorer API - */ - it('testGetRestorer', 0, function() { - console.info('UPDATE_TEST testGetRestorer START'); - try { - let ret = updater.getRestorer(); - console.info("UPDATE_TEST testGetRestorer ret is "+ret); - expect(ret).assertInstanceOf('Restorer'); - } catch(e) { - console.error('UPDATE_TEST [testGetRestorer] fail.' + e); - } - console.info('UPDATE_TEST [client.testGetRestorer] success.'); - console.info('UPDATE_TEST testGetRestorer END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0101 - * @tc.name testFactoryResetCallback - * @tc.desc Test testFactoryResetCallback API - */ - it('testFactoryResetCallback', 0, function() { - console.info('UPDATE_TEST testFactoryResetCallback START'); - try { - let restorer = updater.getRestorer(); - console.info("UPDATE_TEST testFactoryResetCallback restorer is "+restorer); - expect(restorer).assertInstanceOf('Restorer'); - let ret = restorer.factoryReset((result)=>{ - console.info("UPDATE_TEST testFactoryResetCallback result is "+result); - }) - console.info("UPDATE_TEST testFactoryResetCallback ret is "+ret); - expect(ret).assertInstanceOf('Undefined'); - } catch(e) { - console.error('UPDATE_TEST [testFactoryResetCallback] fail.' + e); - } - console.info('UPDATE_TEST [client.testFactoryResetCallback] success.'); - console.info('UPDATE_TEST testFactoryResetCallback END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0102 - * @tc.name testFactoryResetPromise - * @tc.desc Test testFactoryResetPromise API - */ - it('testFactoryResetPromise', 0, function() { - console.info('UPDATE_TEST testFactoryResetPromise START'); - try { - let restorer = updater.getRestorer(); - console.info("UPDATE_TEST testFactoryResetPromise restorer is "+restorer); - expect(restorer).assertInstanceOf('Restorer'); - let ret = restorer.factoryReset().then((result)=>{ - console.info("UPDATE_TEST testFactoryResetPromise result is "+result); - }); - console.info("UPDATE_TEST testFactoryResetPromise ret is "+ret); - expect(ret).assertInstanceOf('Promise'); - } catch(e) { - console.error('UPDATE_TEST [testFactoryResetPromise] fail.' + e); - } - console.info('UPDATE_TEST [client.testFactoryResetPromise] success.'); - console.info('UPDATE_TEST testFactoryResetPromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0103 - * @tc.name testGetLocalUpdater - * @tc.desc Test GetRestorer API - */ - it('testGetLocalUpdater', 0, function() { - console.info('UPDATE_TEST testGetLocalUpdater START'); - try { - let restorer = updater.getRestorer(); - console.info("UPDATE_TEST testGetLocalUpdater restorer is "+restorer); - expect(restorer).assertInstanceOf('Restorer'); - let ret = restorer.getLocalUpdater(); - console.info("UPDATE_TEST testGetLocalUpdater ret is "+ret); - expect(ret).assertInstanceOf('LocalUpdater'); - } catch(e) { - console.error('UPDATE_TEST [testGetLocalUpdater] fail.' + e); - } - console.info('UPDATE_TEST [client.testGetLocalUpdater] success.'); - console.info('UPDATE_TEST testGetLocalUpdater END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0104 - * @tc.name testVerifyUpgradePackageCallback - * @tc.desc Test GetRestorer API - */ - it('testVerifyVersionerifyUpgradePackageCallback', 0, function() { - console.info('UPDATE_TEST testVerifyVersionerifyUpgradePackageCallback START'); - try { - let restorer = updater.getRestorer(); - console.info("UPDATE_TEST testVerifyVersionerifyUpgradePackageCallback restorer is "+restorer); - expect(restorer).assertInstanceOf('Restorer'); - let localUpdater = restorer.getLocalUpdater(); - console.info("UPDATE_TEST testVerifyVersionerifyUpgradePackageCallback localUpdater is "+localUpdater); - expect(localUpdater).assertInstanceOf('LocalUpdater'); - let file = { - filePath: "/data/ota_package/updater.zip", - fileType: 1 - }; - let ret = localUpdater.verifyUpgradePackage(file,'/data/ota_package/signing_cert.crt',(result)=>{ - console.info("UPDATE_TEST testVerifyVersionerifyUpgradePackageCallback result is "+result); - }) - console.info("UPDATE_TEST testVerifyVersionerifyUpgradePackageCallback ret is "+ret); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('UPDATE_TEST [testVerifyVersionerifyUpgradePackageCallback] fail.' + e); - } - console.info('UPDATE_TEST [client.testVerifyVersionerifyUpgradePackageCallback] success.'); - console.info('UPDATE_TEST testVerifyVersionerifyUpgradePackageCallback END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0105 - * @tc.name testVerifyUpgradePackagePromise - * @tc.desc Test GetRestorer API - */ - it('testVerifyUpgradePackagePromise', 0, function() { - console.info('UPDATE_TEST testVerifyUpgradePackagePromise START'); - try { - let restorer = updater.getRestorer(); - console.info("UPDATE_TEST testVerifyUpgradePackagePromise restorer is "+restorer); - expect(restorer).assertInstanceOf('Restorer'); - let localUpdater = restorer.getLocalUpdater(); - console.info("UPDATE_TEST testVerifyUpgradePackagePromise localUpdater is "+localUpdater); - expect(localUpdater).assertInstanceOf('LocalUpdater'); - let file = { - filePath: "/data/ota_package/updater.zip", - fileType: 1 - }; - let ret = localUpdater.verifyUpgradePackage(file,'/data/ota_package/signing_cert.crt').then((result)=>{ - console.info("UPDATE_TEST testVerifyUpgradePackagePromise result is "+result); - }) - console.info("UPDATE_TEST testVerifyUpgradePackagePromise ret is "+ret); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('UPDATE_TEST [testVerifyUpgradePackagePromise] fail.' + e); - } - console.info('UPDATE_TEST [client.testVerifyUpgradePackagePromise] success.'); - console.info('UPDATE_TEST testVerifyUpgradePackagePromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0106 - * @tc.name testApplyNewVersionCallback - * @tc.desc Test GetRestorer API - */ - it('testApplyNewVersionCallback', 0, function() { - console.info('UPDATE_TEST testApplyNewVersionCallback START'); - try { - let restorer = updater.getRestorer(); - console.info("UPDATE_TEST testApplyNewVersionCallback restorer is "+restorer); - expect(restorer).assertInstanceOf('Restorer'); - let localUpdater = restorer.getLocalUpdater(); - console.info("UPDATE_TEST testApplyNewVersionCallback localUpdater is "+localUpdater); - expect(localUpdater).assertInstanceOf('LocalUpdater'); - let files = [{ - filePath: "/data/ota_package/updater1.zip", - fileType: 1 - }, - { - filePath: "/data/ota_package/updater2.zip", - fileType: 4 - }]; - let ret = localUpdater.applyNewVersion(files,(result)=>{ - console.info("UPDATE_TEST testApplyNewVersionCallback result is "+result); - }) - console.info("UPDATE_TEST testApplyNewVersionCallback ret is "+ret); - expect(ret).assertInstanceOf('Undefined'); - } catch(e) { - console.error('UPDATE_TEST [testApplyNewVersionCallback] fail.' + e); - } - console.info('UPDATE_TEST [client.testApplyNewVersionCallback] success.'); - console.info('UPDATE_TEST testApplyNewVersionCallback END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0107 - * @tc.name testApplyNewVersionPromise - * @tc.desc Test GetRestorer API - */ - it('testApplyNewVersionPromise', 0, function() { - console.info('UPDATE_TEST testApplyNewVersionPromise START'); - try { - let restorer = updater.getRestorer(); - console.info("UPDATE_TEST testApplyNewVersionPromise restorer is "+restorer); - expect(restorer).assertInstanceOf('Restorer'); - - let localUpdater = restorer.getLocalUpdater(); - console.info("UPDATE_TEST testApplyNewVersionPromise localUpdater is "+localUpdater); - expect(localUpdater).assertInstanceOf('LocalUpdater'); - let files = [{ - filePath: "/data/ota_package/updater1.zip", - fileType: 1 - }, - { - filePath: "/data/ota_package/updater2.zip", - fileType: 4 - }]; - let ret = localUpdater.applyNewVersion(files).then((result)=>{ - console.info("UPDATE_TEST testApplyNewVersionPromise result is "+result); - }) - console.info("UPDATE_TEST testApplyNewVersionPromise ret is "+ret); - expect(ret).assertInstanceOf('Promise'); - } catch(e) { - console.error('UPDATE_TEST [testApplyNewVersionPromise] fail.' + e); - } - console.info('UPDATE_TEST [client.testApplyNewVersionPromise] success.'); - console.info('UPDATE_TEST testApplyNewVersionPromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0108 - * @tc.name testGetCurrentVersionInfoCallback - * @tc.desc Test GetUpdater API - */ - it('testGetCurrentVersionInfoCallback', 0, function() { - console.info('UPDATE_TEST testGetCurrentVersionInfoCallback START'); - try { - let ret = updater.getCurrentVersionInfo((err, result)=>{ - console.info("UPDATE_TEST error msg is " + err); - console.info("UPDATE_TEST testGetCurrentVersionInfoCallback result is " + result); - }); - console.info("UPDATE_TEST testGetCurrentVersionInfoCallback ret is "+ret); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('UPDATE_TEST [testGetCurrentVersionInfoCallback] fail.' + e); - } - console.info('UPDATE_TEST [client.testGetCurrentVersionInfoCallback] success.'); - console.info('UPDATE_TEST testGetCurrentVersionInfoCallback END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0109 - * @tc.name testGetCurrentVersionInfoPromise - * @tc.desc Test GetUpdater API - */ - it('testGetCurrentVersionInfoPromise', 0, function() { - console.info('UPDATE_TEST testGetCurrentVersionInfoPromise START'); - try { - let ret = updater.getCurrentVersionInfo().then((err, result)=>{ - console.info("UPDATE_TEST error msg is " + err); - console.info("UPDATE_TEST testGetCurrentVersionInfoPromise result is " + result); - }); - console.info("UPDATE_TEST testGetCurrentVersionInfoPromise ret is "+ret); - expect(ret).assertInstanceOf('Promise'); - } catch(e) { - console.error('UPDATE_TEST [testGetCurrentVersionInfoPromise] fail.' + e); - } - console.info('UPDATE_TEST [client.testGetCurrentVersionInfoPromise] success.'); - console.info('UPDATE_TEST testGetCurrentVersionInfoPromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0110 - * @tc.name testResumeDownloadCallback - * @tc.desc Test GetUpdater API - */ - it('testResumeDownloadCallback', 0, function() { - console.info('UPDATE_TEST testResumeDownloadCallback START'); - try { - let versionDigestInfo = { - versionDigest: "versionDigest resume" - } - let resumeDownloadOptions = { - allowNetwork: 1 - } - let ret = updater.resumeDownload(versionDigestInfo, resumeDownloadOptions, (err)=>{ - console.info("UPDATE_TEST error msg is " + err); - }); - console.info("UPDATE_TEST testResumeDownloadCallback ret is " + ret); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('UPDATE_TEST [testResumeDownloadCallback] fail.' + e); - } - console.info('UPDATE_TEST [client.testResumeDownloadCallback] success.'); - console.info('UPDATE_TEST testResumeDownloadCallback END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0111 - * @tc.name testResumeDownloadPromise - * @tc.desc Test GetUpdater API - */ - it('testResumeDownloadPromise', 0, function() { - console.info('UPDATE_TEST testResumeDownloadPromise START'); - try { - let versionDigestInfo = { - versionDigest: "versionDigest resume" - } - let resumeDownloadOptions = { - allowNetwork: 1 - } - let ret = updater.resumeDownload(versionDigestInfo, resumeDownloadOptions).then((err)=>{ - console.info("UPDATE_TEST error msg is " + err); - }); - console.info("UPDATE_TEST testResumeDownloadPromise ret is " + ret); - expect(ret).assertInstanceOf('Promise'); - } catch(e) { - console.error('UPDATE_TEST [testResumeDownloadPromise] fail.' + e); - } - console.info('UPDATE_TEST [client.testResumeDownloadPromise] success.'); - console.info('UPDATE_TEST testResumeDownloadPromise END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0112 - * @tc.name testLocalUpdaterOn - * @tc.desc Test GetLocalUpdater API - */ - it('testLocalUpdaterOn', 0, function() { - console.info('UPDATE_TEST testLocalUpdaterOn START'); - try { - let restorer = updater.getRestorer(); - console.info("UPDATE_TEST testLocalUpdaterOn restorer is " + restorer); - expect(restorer).assertInstanceOf('Restorer'); - - let localUpdater = restorer.getLocalUpdater(); - console.info("UPDATE_TEST testLocalUpdaterOn localUpdater is " + localUpdater); - expect(localUpdater).assertInstanceOf('LocalUpdater'); - - let eventClassifyInfo = {eventClassify: 0x01000000, extraInfo: ""}; - let ret = localUpdater.on(eventClassifyInfo, (eventInfo) => { - console.info("UPDATE_TEST testLocalUpdaterOn eventInfo is " + eventInfo); - }); - console.info("UPDATE_TEST testLocalUpdaterOn ret is " + ret); - expect(ret).assertInstanceOf('Undefined'); - } catch(e) { - console.error('UPDATE_TEST [testLocalUpdaterOn] fail.' + e); - } - console.info('UPDATE_TEST [client.testLocalUpdaterOn] success.'); - console.info('UPDATE_TEST testLocalUpdaterOn END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0113 - * @tc.name testLocalUpdaterOff - * @tc.desc Test GetLocalUpdater API - */ - it('testLocalUpdaterOff', 0, function() { - console.info('UPDATE_TEST testLocalUpdaterOff START'); - try { - let restorer = updater.getRestorer(); - console.info("UPDATE_TEST testLocalUpdaterOff restorer is " + restorer); - expect(restorer).assertInstanceOf('Restorer'); - - let localUpdater = restorer.getLocalUpdater(); - console.info("UPDATE_TEST testLocalUpdaterOff localUpdater is " + localUpdater); - expect(localUpdater).assertInstanceOf('LocalUpdater'); - - let eventClassifyInfo = {eventClassify: 0x01000000, extraInfo: ""}; - let ret = localUpdater.off(eventClassifyInfo, (eventInfo) => { - console.info("UPDATE_TEST testLocalUpdaterOff eventInfo is " + eventInfo); - }); - console.info("UPDATE_TEST testLocalUpdaterOff ret is " + ret); - expect(ret).assertInstanceOf('Undefined'); - } catch(e) { - console.error('UPDATE_TEST [testLocalUpdaterOff] fail.' + e); - } - console.info('UPDATE_TEST [client.testLocalUpdaterOff] success.'); - console.info('UPDATE_TEST testLocalUpdaterOff END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0114 - * @tc.name testGetTaskInfoCallback - * @tc.desc Test GetUpdater API - */ - it('testGetTaskInfoCallback', 0, function() { - console.info('UPDATE_TEST testGetTaskInfoCallback START'); - try { - let ret = updater.getTaskInfo((err, result) => { - console.info("UPDATE_TEST error msg is " + err); - console.info("UPDATE_TEST result is " + result); - }); - console.info("UPDATE_TEST testGetTaskInfoCallback ret is " + ret); - expect(ret).assertInstanceOf('Number'); - } catch(e) { - console.error('UPDATE_TEST [testGetTaskInfoCallback] fail.' + e); - } - console.info('UPDATE_TEST [client.testGetTaskInfoCallback] success.'); - console.info('UPDATE_TEST testGetTaskInfoCallback END'); - }); - - /** - * @tc.number SUB_UPDATE_JS_API_0115 - * @tc.name testGetTaskInfoPromise - * @tc.desc Test GetUpdater API - */ - it('testGetTaskInfoPromise', 0, function() { - console.info('UPDATE_TEST testGetTaskInfoPromise START'); - try { - let ret = updater.getTaskInfo().then((err, result) => { - console.info("UPDATE_TEST error msg is " + err); - console.info("UPDATE_TEST result is " + result); - }); - console.info("UPDATE_TEST testGetTaskInfoPromise ret is " + ret); - expect(ret).assertInstanceOf('Promise'); - } catch(e) { - console.error('UPDATE_TEST [testGetTaskInfoPromise] fail.' + e); - } - console.info('UPDATE_TEST [client.testGetTaskInfoPromise] success.'); - console.info('UPDATE_TEST testGetTaskInfoPromise END'); - }); -}); diff --git a/updater/update_test/src/main/resources/base/element/string.json b/updater/update_test/src/main/resources/base/element/string.json deleted file mode 100644 index dd0c73ca8..000000000 --- a/updater/update_test/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "MyApplication0420" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/updater/update_test/src/main/resources/base/media/icon.png b/updater/update_test/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm~|L~ z7$0v5mkobriU!H<@mVJHLlmQqzQ3d6Rh_-|%Yy2li*tHO>_vcnuZ7OR_xkAIuIU&x z-|8Y0wj|6|a6_I(v91y%k_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