diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/ContextJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/ContextJsunit.test.ets index 2aebc61076981ac3882b4fab15a9e3bafe4b8b5e..6f8d8ca865ac8fe95bce139d32e162ce86459249 100644 --- a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/ContextJsunit.test.ets +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/ContextJsunit.test.ets @@ -14,11 +14,38 @@ */ import featureAbility from '@ohos.ability.featureAbility' -import {describe, beforeEach, afterEach, it, expect} from '@ohos/hypium'; +import {describe, beforeEach, afterEach, beforeAll, afterAll, it, expect} from '@ohos/hypium'; import Utils from './Utils'; +import backgroundTaskManager from '@ohos.backgroundTaskManager'; export default function ContextJsunit() { describe('faContextTest', function () { + + let TAG1 = "SUB_AA_OpenHarmony == faContextTest: "; + let sleepTimeOne = 1000; + let id = undefined; + beforeAll(async (done) => { + console.log(TAG1 + "beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log(TAG1 + "Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log(TAG1 + "requestId is : " + id); + setTimeout(function () { + console.log(TAG1 + "beforeAll end"); + done(); + }, sleepTimeOne); + }) + + afterAll(async (done) => { + console.log(TAG1 + "afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log(TAG1 + "afterAll end"); + done(); + }, sleepTimeOne); + }) beforeEach(async function (done) { console.info("context before each called"); done() diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/addContextAndAbilityJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/addContextAndAbilityJsunit.test.ets index 9f07dcd3a4e752c30d5bdefef139d5a688ac8b1f..f05b949cdf7f03e23300b6770c8d40c5b2055935 100644 --- a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/addContextAndAbilityJsunit.test.ets +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/addContextAndAbilityJsunit.test.ets @@ -12,11 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, it, expect} from '@ohos/hypium'; +import { describe, beforeAll, afterAll, it, expect } from '@ohos/hypium'; import Utils from './Utils'; import ability_featureAbility from '@ohos.ability.featureAbility'; -import ability_particleAbility from '@ohos.ability.particleAbility'; import abilityManager from "@ohos.application.appManager" +import backgroundTaskManager from '@ohos.backgroundTaskManager'; const TAG_TEST_0100 = ' context_isUpdatingConfigurations_test_0100 '; const TAG_TEST_0200 = ' context_isUpdatingConfigurations_test_0200 '; @@ -33,6 +33,33 @@ const TAG_TEST_0012 = ' context_featureAbility_test_0400 '; export default function addContextAndAbilityJsunit() { describe('addContextTest', function () { + + let TAG1 = "SUB_AA_OpenHarmony == addContextTest: "; + let sleepTimeOne = 1000; + let id = undefined; + beforeAll(async (done) => { + console.log(TAG1 + "beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log(TAG1 + "Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log(TAG1 + "requestId is : " + id); + setTimeout(function () { + console.log(TAG1 + "beforeAll end"); + done(); + }, sleepTimeOne); + }) + + afterAll(async (done) => { + console.log(TAG1 + "afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log(TAG1 + "afterAll end"); + done(); + }, sleepTimeOne); + }) + /* * @tc.number: context_isUpdatingConfigurations_test_0100 * @tc.name: isUpdatingConfigurations : Obtains whether the configuration of the current ability is changing. diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets index e74925b2006b532dfa226ffdcaa4d410856ccdca..bdbbd35387db34f7b7d109e5fa50e2c15b9aa1d2 100644 --- a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets @@ -12,13 +12,40 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, it, expect} from '@ohos/hypium'; +import { describe, beforeAll, afterAll, it, expect } from '@ohos/hypium'; import Utils from './Utils'; import ability_featureAbility from '@ohos.ability.featureAbility'; +import backgroundTaskManager from '@ohos.backgroundTaskManager'; export default function getHapModuleInfoJsunit() { describe('getAbilityInfoTest', function () { + let TAG1 = "SUB_AA_OpenHarmony == getAbilityInfoTest: "; + let sleepTimeOne = 1000; + let id = undefined; + beforeAll(async (done) => { + console.log(TAG1 + "beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log(TAG1 + "Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log(TAG1 + "requestId is : " + id); + setTimeout(function () { + console.log(TAG1 + "beforeAll end"); + done(); + }, sleepTimeOne); + }) + + afterAll(async (done) => { + console.log(TAG1 + "afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log(TAG1 + "afterAll end"); + done(); + }, sleepTimeOne); + }) + /** * @tc.number: context_getAbilityInfo_test_0100 * @tc.name: getAbilityInfo:Query the current attributionability details. diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAppVersionInfoJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAppVersionInfoJsunit.test.ets index 8cb793202b148aea74cf51635d6c6020903e2412..0d97ec60fe056d9acc8325b5a182cc9fbb541213 100644 --- a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAppVersionInfoJsunit.test.ets +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAppVersionInfoJsunit.test.ets @@ -12,12 +12,40 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, it, expect} from '@ohos/hypium'; +import { describe, beforeAll, afterAll, it, expect } from '@ohos/hypium'; import Utils from './Utils'; import ability_featureAbility from '@ohos.ability.featureAbility'; +import backgroundTaskManager from '@ohos.backgroundTaskManager'; export default function getHapModuleInfoJsunit() { describe('getAppVersionInfoTest', function () { + + let TAG1 = "SUB_AA_OpenHarmony == getAppVersionInfoTest: "; + let sleepTimeOne = 1000; + let id = undefined; + beforeAll(async (done) => { + console.log(TAG1 + "beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log(TAG1 + "Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log(TAG1 + "requestId is : " + id); + setTimeout(function () { + console.log(TAG1 + "beforeAll end"); + done(); + }, sleepTimeOne); + }) + + afterAll(async (done) => { + console.log(TAG1 + "afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log(TAG1 + "afterAll end"); + done(); + }, sleepTimeOne); + }) + /** * @tc.number: context_getAppVersionInfo_test_0100 * @tc.name: getAppVersionInfo:Gets the version information for the application. diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getApplicationContextJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getApplicationContextJsunit.test.ets index 9fa00471c5174cccf2e662263f870d27b434af68..a2b446760271079c3bac9b1f38dc3aea0f32f5ea 100644 --- a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getApplicationContextJsunit.test.ets +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getApplicationContextJsunit.test.ets @@ -12,12 +12,40 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, it, expect} from '@ohos/hypium'; +import { describe, beforeAll, afterAll, it, expect } from '@ohos/hypium'; import Utils from './Utils'; import ability_featureAbility from '@ohos.ability.featureAbility'; +import backgroundTaskManager from '@ohos.backgroundTaskManager'; export default function getHapModuleInfoJsunit() { describe('getApplicationContextTest', function () { + + let TAG1 = "SUB_AA_OpenHarmony == getApplicationContextTest: "; + let sleepTimeOne = 1000; + let id = undefined; + beforeAll(async (done) => { + console.log(TAG1 + "beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log(TAG1 + "Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log(TAG1 + "requestId is : " + id); + setTimeout(function () { + console.log(TAG1 + "beforeAll end"); + done(); + }, sleepTimeOne); + }) + + afterAll(async (done) => { + console.log(TAG1 + "afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log(TAG1 + "afterAll end"); + done(); + }, sleepTimeOne); + }) + /** * @tc.number: context_getApplicationContext_test_0100 * @tc.name: getApplicationContext:Gets the application context information. diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets index 3703d15b1f64c00c3bb288b5eb853d9d207aaf43..0f4a2e1b566a799e4310d84c193809d525ca00a0 100644 --- a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets @@ -12,14 +12,40 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, it, expect} from '@ohos/hypium'; +import { describe, beforeAll, afterAll, it, expect } from '@ohos/hypium'; import Utils from './Utils'; import ability_featureAbility from '@ohos.ability.featureAbility'; - - +import backgroundTaskManager from '@ohos.backgroundTaskManager'; export default function getHapModuleInfoJsunit() { describe('getHapModuleInfoTest', function () { + + let TAG1 = "SUB_AA_OpenHarmony == getHapModuleInfoTest: "; + let sleepTimeOne = 1000; + let id = undefined; + beforeAll(async (done) => { + console.log(TAG1 + "beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log(TAG1 + "Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log(TAG1 + "requestId is : " + id); + setTimeout(function () { + console.log(TAG1 + "beforeAll end"); + done(); + }, sleepTimeOne); + }) + + afterAll(async (done) => { + console.log(TAG1 + "afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log(TAG1 + "afterAll end"); + done(); + }, sleepTimeOne); + }) + /** * @tc.number: context_getHapModuleInfo_test_0100 * @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application. diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets index 010fd06f7b1aee07e6519db056b14be600bb5586..ce9fc0a9c14779b464dc4de409edad54a13ddb55 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets @@ -642,6 +642,7 @@ export default function ApiCoverTest() { console.info("SUB_AA_FMS_AbilityStage_0100===AbilityStage===" + JSON.stringify(globalThis.stageContext)) console.info("SUB_AA_FMS_AbilityStage_0100===AbilityStage===" + JSON.stringify(globalThis.stageContext.config)) let directions = globalThis.stageContext.config.direction + let pointer = globalThis.stageContext.config.hasPointerDevice let subscriber = null let subscribeInfo = { events: ["AbilityStage_StartAbility"] @@ -654,6 +655,7 @@ export default function ApiCoverTest() { console.info("SUB_AA_FMS_AbilityStage_0100===SubscribeInfoCallback===" + JSON.stringify(data)) expect(data.parameters["config"]).assertEqual(-1) expect(data.parameters["config"]).assertEqual(directions) + expect(pointer).assertFalse() commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback) await sleep(4000) done()