From 7d065136256be9844763d8a0ca9efb62780deac5 Mon Sep 17 00:00:00 2001 From: donglin Date: Wed, 26 Oct 2022 14:35:51 +0800 Subject: [PATCH] abilityManager Signed-off-by: donglin Change-Id: I858819ba5fc8cb881c4b1a02db391ec9f7c1dfb1 --- .../main/ets/test/NewApiCoverAbility.test.ets | 95 ++++++++++++++++++ .../entry/src/main/module.json | 3 + .../signature/openharmony_sx.p7b | Bin 3539 -> 3577 bytes 3 files changed, 98 insertions(+) diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/NewApiCoverAbility.test.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/NewApiCoverAbility.test.ets index 97e30ee93..751795ea2 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/NewApiCoverAbility.test.ets +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/NewApiCoverAbility.test.ets @@ -14,6 +14,7 @@ */ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import abilityManager from '@ohos.app.ability.abilityManager'; import errorManager from '@ohos.app.ability.errorManager'; function sleep(time) { @@ -78,5 +79,99 @@ export default function ApiCoverTest() { done(); } }); + + /* + * @tc.number SUB_AA_GetTopAbility_0100 + * @tc.name Test getTopAbility. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_GetTopAbility_0100', 0, async function (done) { + try { + await abilityManager.getTopAbility().then((data)=>{ + expect(true).assertTrue(); + done(); + }).catch((err)=>{ + expect().assertFail() + done(); + }) + } catch (error) { + expect().assertFail() + done(); + } + }); + + /* + * @tc.number SUB_AA_GetAbilityRunningInfo_0100 + * @tc.name Test getAbilityRunningInfo. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_GetAbilityRunningInfo_0100', 0, async function (done) { + try { + await abilityManager.getAbilityRunningInfos().then((data)=>{ + expect(true).assertTrue(); + done(); + }).catch((err)=>{ + expect().assertFail() + done(); + }) + } catch (error) { + expect().assertFail() + done(); + } + }); + + /* + * @tc.number SUB_AA_GetExtensionRunningInfos_0100 + * @tc.name Test getExtensionRunningInfos. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_GetExtensionRunningInfos_0100', 0, async function (done) { + try { + let upperLimit = 1; + await abilityManager.getExtensionRunningInfos(upperLimit).then((data)=>{ + expect(true).assertTrue(); + done(); + }).catch((err)=>{ + expect().assertFail() + done(); + }) + } catch (error) { + expect().assertFail() + done(); + } + }); + + /* + * @tc.number SUB_AA_UpdateConfiguration_0100 + * @tc.name Test updateConfiguration. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_UpdateConfiguration_0100', 0, async function (done) { + try { + // init for repeat test + var configInit = { + language: 'english' + } + await abilityManager.updateConfiguration(configInit, (err,data)=>{}); + + var config = { + language: 'chinese' + } + await abilityManager.updateConfiguration(config).then((data)=>{ + expect(true).assertTrue(); + done(); + }).catch((err)=>{ + expect().assertFail() + done(); + }) + } catch (error) { + expect().assertFail() + done(); + } + }); }) } diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/module.json b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/module.json index 818876697..4c74b6f8d 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/module.json +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/module.json @@ -106,6 +106,9 @@ }, { "name":"ohos.permission.START_INVISIBLE_ABILITY" + }, + { + "name":"ohos.permission.UPDATE_CONFIGURATION" } ] } diff --git a/ability/ability_runtime/apicover/apicoverhaptest/signature/openharmony_sx.p7b b/ability/ability_runtime/apicover/apicoverhaptest/signature/openharmony_sx.p7b index 6c7c8e29e3c4a1f8d0419932ebc28f665e4ae974..b9dd315b3ef5351f8bedf932f5800996a12e62f8 100644 GIT binary patch delta 263 zcmcaC{Zrb(po#Y@8>d#AN85K^Ms}tJO}x*5LXVgj84Y<2xY;-p+B_IjnOT?^4VqY| zBNQ?&XkzVPX<}{J=ek%7Q}4XnfQyX-=+twzEX+(SZU!z)3ONsYdF``be74xW;o-`6dfJ6v#pd#AN85K^Ms}tJO}qzyLVK7P84Y<2xY;-p+B_IjnOT?^4VqXB z5egX>G_fYJG_l5QbokG*IhB=#qu#*M(8R#P#L(D0%0M5kl9RyWP-}XCFitzIw!VwY6)(LtXXc@{_WM7 NuQ^8B&ZV5)0{~usP-FlA -- GitLab