From 384bd88401ecde520c12af1166fae4837fb19ceb Mon Sep 17 00:00:00 2001 From: inter515 Date: Mon, 20 Jun 2022 21:11:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9C=AA=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E7=9A=84=E6=9E=9A=E4=B8=BE=E5=80=BC=E6=96=AD=E8=A8=80'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: inter515 --- .../js/test/ActsBmsAccessTokenTest.test.js | 28 +++++----- .../test/getApplicationInfoJsunit.test.ets | 6 +-- .../src/main/js/test/ExampleJsunit.test.js | 53 +++++++++++++++---- 3 files changed, 61 insertions(+), 26 deletions(-) diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js index 8aa5e5532..2e66489f9 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js @@ -67,9 +67,9 @@ describe('ActsBmsAccessTokenTest', function () { expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA"); expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING"); expect(bundleInfo.reqPermissionStates.length).assertEqual(3); - expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1); - expect(bundleInfo.reqPermissionStates[1]).assertEqual(-1); - expect(bundleInfo.reqPermissionStates[2]).assertEqual(0); + expect(bundleInfo.reqPermissionStates[0]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED); + expect(bundleInfo.reqPermissionStates[1]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED); + expect(bundleInfo.reqPermissionStates[2]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED); done(); }).catch((err) => { expect(err).assertFail(); @@ -93,11 +93,11 @@ describe('ActsBmsAccessTokenTest', function () { expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW"); expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.USE_BLUETOOTH"); expect(bundleInfo.reqPermissionStates.length).assertEqual(5); - expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1); - expect(bundleInfo.reqPermissionStates[1]).assertEqual(0); - expect(bundleInfo.reqPermissionStates[2]).assertEqual(-1); - expect(bundleInfo.reqPermissionStates[3]).assertEqual(0); - expect(bundleInfo.reqPermissionStates[4]).assertEqual(0); + expect(bundleInfo.reqPermissionStates[0]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED); + expect(bundleInfo.reqPermissionStates[1]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED); + expect(bundleInfo.reqPermissionStates[2]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED); + expect(bundleInfo.reqPermissionStates[3]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED); + expect(bundleInfo.reqPermissionStates[4]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED); done(); }).catch((err) => { expect(err).assertFail(); @@ -122,12 +122,12 @@ describe('ActsBmsAccessTokenTest', function () { expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW"); expect(bundleInfo.reqPermissions[5]).assertEqual("ohos.permission.USE_BLUETOOTH"); expect(bundleInfo.reqPermissionStates.length).assertEqual(6); - expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1); - expect(bundleInfo.reqPermissionStates[1]).assertEqual(-1); - expect(bundleInfo.reqPermissionStates[2]).assertEqual(0); - expect(bundleInfo.reqPermissionStates[3]).assertEqual(-1); - expect(bundleInfo.reqPermissionStates[4]).assertEqual(0); - expect(bundleInfo.reqPermissionStates[5]).assertEqual(0); + expect(bundleInfo.reqPermissionStates[0]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED); + expect(bundleInfo.reqPermissionStates[1]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED); + expect(bundleInfo.reqPermissionStates[2]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED); + expect(bundleInfo.reqPermissionStates[3]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED); + expect(bundleInfo.reqPermissionStates[4]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED); + expect(bundleInfo.reqPermissionStates[5]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED); done(); }).catch((err) => { expect(err).assertFail(); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets index 933a5601f..5fe9759dc 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets @@ -429,13 +429,13 @@ export default function applicationBundleJsunit() { .then((applicationInfo) => { expect(applicationInfo.iconResource.bundleName).assertEqual('com.open.harmony.packagemag') expect(applicationInfo.iconResource.moduleName).assertEqual('entry') - expect(applicationInfo.iconResource.id).assertEqual(16777218) + expect(applicationInfo.iconResource.id).assertLarger(0) expect(applicationInfo.labelResource.bundleName).assertEqual('com.open.harmony.packagemag') expect(applicationInfo.labelResource.moduleName).assertEqual('entry') - expect(applicationInfo.labelResource.id).assertEqual(16777216) + expect(applicationInfo.labelResource.id).assertLarger(0) expect(applicationInfo.descriptionResource.bundleName).assertEqual('com.open.harmony.packagemag') expect(applicationInfo.descriptionResource.moduleName).assertEqual('entry') - expect(applicationInfo.descriptionResource.id).assertEqual(16777217) + expect(applicationInfo.descriptionResource.id).assertLarger(0) done(); }).catch((err) => { expect(err).assertFail(); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js index 668b6ddbc..1cd0f0a28 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js @@ -262,7 +262,8 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test getBundleInfo interfaces with one hap. (by callback) */ it('getBundleInfo_0600', 0, async function (done) { - await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, OnReceiveEvent); + await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES| + demo.BundleFlag.GET_ABILITY_INFO_WITH_DISABLE , OnReceiveEvent); function OnReceiveEvent(err, datainfo) { console.info("getBundleInfo_0600 dataInfo ====" + datainfo); expect(datainfo.name).assertEqual(NAME1); @@ -1503,7 +1504,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.icon).assertEqual("$media:icon"); expect(datainfo.moduleName).assertEqual("entry"); expect(datainfo.bundleName).assertEqual(NAME2); - expect(datainfo.orientation).assertEqual(1); + expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.LANDSCAPE); expect(datainfo.launchMode).assertEqual(demo.LaunchMode.SINGLETON); expect(datainfo.applicationInfo.name).assertEqual(NAME2); expect(datainfo.applicationInfo.description).assertEqual(APPLICATION_DESCRIPTION); @@ -1595,6 +1596,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.icon).assertEqual("$media:icon"); expect(datainfo.moduleName).assertEqual("entry"); expect(datainfo.bundleName).assertEqual(NAME3); + expect(datainfo.type).assertEqual(demo.AbilityType.PAGE); expect(datainfo.applicationInfo.name).assertEqual(NAME3); expect(datainfo.applicationInfo.description).assertEqual(APPLICATION_DESCRIPTION); expect(datainfo.applicationInfo.descriptionId >= 0).assertTrue(); @@ -1604,6 +1606,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.applicationInfo.labelId >= 0).assertTrue(); expect(datainfo.applicationInfo.systemApp).assertEqual(true); expect(datainfo.applicationInfo.supportedModes).assertEqual(0); + expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.PORTRAIT); expect(datainfo.orientation).assertEqual(2); expect(datainfo.applicationInfo.enabled).assertEqual(true); for (let j = 0; j < datainfo.applicationInfo.moduleInfos.length; j++) { @@ -1613,14 +1616,16 @@ describe('ActsBundleManagerTest', function () { } if (datainfo.bundleName == NAME4) { expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility"); + expect(datainfo.type).assertEqual(demo.AbilityType.DATA); expect(datainfo.bundleName).assertEqual(NAME4); - expect(datainfo.orientation).assertEqual(3); + expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.FOLLOW_RECENT); queryResultCount++; } if (datainfo.bundleName == NAME5) { expect(datainfo.name).assertEqual("com.example.myapplication.MainAbility"); + expect(datainfo.type).assertEqual(demo.AbilityType.PAGE); expect(datainfo.bundleName).assertEqual(NAME5); - expect(datainfo.orientation).assertEqual(0); + expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.UNSPECIFIED); queryResultCount++; } } @@ -1783,19 +1788,49 @@ describe('ActsBundleManagerTest', function () { * @tc.name InstallErrorCode::STATUS_FAILED_NO_SPACE_LEFT * @tc.desc Test install errcode STATUS_FAILED_NO_SPACE_LEFT. */ - it('installErrCodeTest_0100', 0, async function (done) { + it('installErrCodeTest_0100', 0, async function (done) { + expect(demo.InstallErrorCode.SUCCESS).assertEqual(0); + expect(demo.InstallErrorCode.STATUS_INSTALL_FAILURE).assertEqual(1); + expect(demo.InstallErrorCode.STATUS_INSTALL_FAILURE_ABORTED).assertEqual(2); + expect(demo.InstallErrorCode.STATUS_INSTALL_FAILURE_INVALID).assertEqual(3); + expect(demo.InstallErrorCode.STATUS_INSTALL_FAILURE_CONFLICT).assertEqual(4); + expect(demo.InstallErrorCode.STATUS_INSTALL_FAILURE_STORAGE).assertEqual(5); + expect(demo.InstallErrorCode.STATUS_INSTALL_FAILURE_INCOMPATIBLE).assertEqual(6); + expect(demo.InstallErrorCode.STATUS_UNINSTALL_FAILURE).assertEqual(7); + expect(demo.InstallErrorCode.STATUS_UNINSTALL_FAILURE_BLOCKED).assertEqual(8); + expect(demo.InstallErrorCode.STATUS_UNINSTALL_FAILURE_ABORTED).assertEqual(9); + expect(demo.InstallErrorCode.STATUS_UNINSTALL_FAILURE_CONFLICT).assertEqual(10); + expect(demo.InstallErrorCode.STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT).assertEqual(11); + expect(demo.InstallErrorCode.STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED).assertEqual(12); + expect(demo.InstallErrorCode.STATUS_RECOVER_FAILURE_INVALID ).assertEqual(13); + expect(demo.InstallErrorCode.STATUS_ABILITY_NOT_FOUND).assertEqual(64); + expect(demo.InstallErrorCode.STATUS_BMS_SERVICE_ERROR).assertEqual(65); expect(demo.InstallErrorCode.STATUS_FAILED_NO_SPACE_LEFT).assertEqual(66); - expect(demo.AbilitySubType.CA).assertEqual(1); + expect(demo.InstallErrorCode.STATUS_GRANT_REQUEST_PERMISSIONS_FAILED).assertEqual(67); + expect(demo.InstallErrorCode.STATUS_INSTALL_PERMISSION_DENIED).assertEqual(68); + expect(demo.InstallErrorCode.STATUS_UNINSTALL_PERMISSION_DENIED).assertEqual(69); done(); }) /** - * @tc.number installErrCodeTest_0200 + * @tc.number AbilityTypeTest_0100 * @tc.name InstallErrorCode::STATUS_FAILED_NO_SPACE_LEFT * @tc.desc Test install errcode STATUS_FAILED_NO_SPACE_LEFT. */ - it('installErrCodeTest_0200', 0, async function (done) { - expect(demo.InstallErrorCode.STATUS_GRANT_REQUEST_PERMISSIONS_FAILED).assertEqual(67); + it('AbilityTypeTest_0100', 0, async function (done) { + expect(demo.AbilitySubType.CA).assertEqual(1); + expect(demo.AbilityType.UNKNOWN).assertEqual(0); + expect(demo.ExtensionAbilityType.WORK_SCHEDULER).assertEqual(1); + expect(demo.ExtensionAbilityType.INPUT_METHOD).assertEqual(2); + expect(demo.ExtensionAbilityType.ACCESSIBILITY).assertEqual(4); + expect(demo.ExtensionAbilityType.DATA_SHARE).assertEqual(5); + expect(demo.ExtensionAbilityType.FILE_SHARE).assertEqual(6); + expect(demo.ExtensionAbilityType.STATIC_SUBSCRIBER).assertEqual(7); + expect(demo.ExtensionAbilityType.WALLPAPER).assertEqual(8); + expect(demo.ExtensionAbilityType.BACKUP).assertEqual(9); + expect(demo.ColorMode.AUTO_MODE).assertEqual(-1); + expect(demo.ColorMode.DARK_MODE).assertEqual(0); + expect(demo.ColorMode.LIGHT_MODE).assertEqual(1); done(); }) }) -- GitLab