提交 44c09795 编写于 作者: X xinking129

modify format

Signed-off-by: Nxinking129 <xinxin13@huawei.com>
上级 f8efc91c
...@@ -13,67 +13,67 @@ ...@@ -13,67 +13,67 @@
* limitations under the License. * limitations under the License.
*/ */
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.app.ability.UIAbility';
import Window from '@ohos.window' import Window from '@ohos.window';
import commonEvent from '@ohos.commonEvent'; import commonEvent from '@ohos.commonEvent';
let commonStateArr: number[] = [-1, -1, -1, -1] let commonStateArr: number[] = [-1, -1, -1, -1];
let commonEventData = { let commonEventData = {
parameters: { parameters: {
commonStateArr: commonStateArr commonStateArr: commonStateArr
} }
} };
let onForeGroundTAG = -1 let onForeGroundTAG = -1;
let TAG = 'StateChangeTestTAG' let TAG = 'StateChangeTestTAG';
let ApplicationStateChangeCallbackFir = { let applicationStateChangeCallbackFir = {
onApplicationForeground() { onApplicationForeground() {
console.log(TAG, 'ApplicationStateChangeCallbackFir onApplicationForeground') console.log(TAG, 'applicationStateChangeCallbackFir onApplicationForeground');
commonEventData.parameters.commonStateArr[0] = 1 commonEventData.parameters.commonStateArr[0] = 1;
setTimeout(() => { setTimeout(() => {
console.info('Enter onApplicationForeground publish!') console.info('Enter onApplicationForeground publish!')
commonEvent.publish('processState', commonEventData, (err) => { commonEvent.publish('processState', commonEventData, (err) => {
console.info("====>processState publish err: " + JSON.stringify(err)) console.info("====>processState publish err: " + JSON.stringify(err));
}) })
}, 1000) }, 1000);
}, },
onApplicationBackground() { onApplicationBackground() {
console.log(TAG, 'ApplicationStateChangeCallbackFir onApplicationBackground') console.log(TAG, 'applicationStateChangeCallbackFir onApplicationBackground');
commonEventData.parameters.commonStateArr[1] = 1 commonEventData.parameters.commonStateArr[1] = 1;
if (globalThis.want.action == 'NeedBackGroundOff' || globalThis.want.action == 'MultiAppRegister') { if (globalThis.want.action === 'NeedBackGroundOff' || globalThis.want.action === 'MultiAppRegister') {
console.info('entered needbackgroundoff!') console.info('entered needbackgroundoff!');
globalThis.applicationContext.off('applicationStateChange', ApplicationStateChangeCallbackFir) globalThis.applicationContext.off('applicationStateChange', applicationStateChangeCallbackFir);
} }
} }
} };
let ApplicationStateChangeCallbackSec = { let applicationStateChangeCallbackSec = {
onApplicationForeground() { onApplicationForeground() {
console.log(TAG, 'ApplicationStateChangeCallbackSec onApplicationForeground') console.log(TAG, 'applicationStateChangeCallbackSec onApplicationForeground');
commonEventData.parameters.commonStateArr[2] = 1 commonEventData.parameters.commonStateArr[2] = 1;
}, },
onApplicationBackground() { onApplicationBackground() {
console.log(TAG, 'ApplicationStateChangeCallbackSec onApplicationBackground') console.log(TAG, 'applicationStateChangeCallbackSec onApplicationBackground');
commonEventData.parameters.commonStateArr[3] = 1 commonEventData.parameters.commonStateArr[3] = 1;
if (globalThis.want.action == 'doubleNeedBackGroundOff') { if (globalThis.want.action === 'doubleNeedBackGroundOff') {
setTimeout(() => { setTimeout(() => {
globalThis.applicationContext.off('applicationStateChange', ApplicationStateChangeCallbackSec) globalThis.applicationContext.off('applicationStateChange', applicationStateChangeCallbackSec);
}, 500) }, 500);
} }
else if (globalThis.want.action == 'DoubleRegisterOff') { else if (globalThis.want.action === 'DoubleRegisterOff') {
setTimeout(() => { setTimeout(() => {
console.info('entered DoubleRegisterOff') console.info('entered DoubleRegisterOff');
globalThis.applicationContext.off('applicationStateChange') globalThis.applicationContext.off('applicationStateChange');
}, 500) }, 500);
} }
} }
} }
export default class EntryAbility extends Ability { export default class EntryAbility extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
onForeGroundTAG = -1 onForeGroundTAG = -1;
for (let i = 0; i < 4; i++) { for (let i = 0; i < 4; i++) {
commonStateArr[i] = -1 commonStateArr[i] = -1
} }
...@@ -81,18 +81,18 @@ export default class EntryAbility extends Ability { ...@@ -81,18 +81,18 @@ export default class EntryAbility extends Ability {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
globalThis.abilityContext = this.context globalThis.abilityContext = this.context;
globalThis.want = want globalThis.want = want;
globalThis.applicationContext = this.context.getApplicationContext(); globalThis.applicationContext = this.context.getApplicationContext();
if (globalThis.want.action == 'RegisterOnOffOn') { if (globalThis.want.action === 'RegisterOnOffOn') {
globalThis.applicationContext.on('applicationStateChange', ApplicationStateChangeCallbackFir) globalThis.applicationContext.on('applicationStateChange', applicationStateChangeCallbackFir);
globalThis.applicationContext.off('applicationStateChange', ApplicationStateChangeCallbackFir) globalThis.applicationContext.off('applicationStateChange', applicationStateChangeCallbackFir);
} }
globalThis.applicationContext.on('applicationStateChange', ApplicationStateChangeCallbackFir) globalThis.applicationContext.on('applicationStateChange', applicationStateChangeCallbackFir);
if (globalThis.want.action == 'doubleRegister' || globalThis.want.action == 'doubleNeedBackGroundOff' if (globalThis.want.action === 'doubleRegister' || globalThis.want.action === 'doubleNeedBackGroundOff'||
|| globalThis.want.action == 'DoubleRegisterOff') { globalThis.want.action === 'DoubleRegisterOff') {
console.info("double in action is logic entered!") console.info("double in action is logic entered!");
globalThis.applicationContext.on('applicationStateChange', ApplicationStateChangeCallbackSec) globalThis.applicationContext.on('applicationStateChange', applicationStateChangeCallbackSec);
} }
} }
...@@ -128,14 +128,14 @@ export default class EntryAbility extends Ability { ...@@ -128,14 +128,14 @@ export default class EntryAbility extends Ability {
// Ability has brought to foreground // Ability has brought to foreground
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Abilityone onForeground'); hilog.info(0x0000, 'testTag', '%{public}s', 'Abilityone onForeground');
onForeGroundTAG += 1 onForeGroundTAG += 1;
if (onForeGroundTAG == 1 && (globalThis.want.action == 'NeedBackGroundOff' || globalThis.want.action == 'MultiAppRegister' if (onForeGroundTAG === 1 && (globalThis.want.action === 'NeedBackGroundOff' || globalThis.want.action === 'MultiAppRegister'||
|| globalThis.want.action == 'DoubleRegisterOff')) { globalThis.want.action === 'DoubleRegisterOff')) {
setTimeout(() => { setTimeout(() => {
commonEvent.publish('processState', commonEventData, (err) => { commonEvent.publish('processState', commonEventData, (err) => {
console.info("====>processState publish err: " + JSON.stringify(err)) console.info("====>processState publish err: " + JSON.stringify(err));
}) })
}, 2000) }, 2000);
} }
} }
......
...@@ -13,47 +13,47 @@ ...@@ -13,47 +13,47 @@
* limitations under the License. * limitations under the License.
*/ */
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.app.ability.UIAbility';
import Window from '@ohos.window' import Window from '@ohos.window';
import commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent';
let TAG = 'getRunningProcess' let TAG = 'getRunningProcess';
let commonStateArr let commonStateArr;
let commonEventData = { let commonEventData = {
parameters: { parameters: {
commonStateArr: commonStateArr commonStateArr: commonStateArr
} }
} };
let ApplicationStateChangeCallbackFir = { let applicationStateChangeCallbackFir = {
onApplicationForeground() { onApplicationForeground() {
console.log(TAG, 'ApplicationStateChangeCallbackFir onApplicationForeground') console.log(TAG, 'applicationStateChangeCallbackFir onApplicationForeground');
}, },
onApplicationBackground() { onApplicationBackground() {
console.log(TAG, 'ApplicationStateChangeCallbackFir onApplicationBackground') console.log(TAG, 'applicationStateChangeCallbackFir onApplicationBackground');
setTimeout(() => { setTimeout(() => {
console.info('Enter onApplicationForeground publish!') console.info('Enter onApplicationForeground publish!');
commonEventData.parameters.commonStateArr = 1 commonEventData.parameters.commonStateArr = 1;
commonEvent.publish('processState', commonEventData, (err) => { commonEvent.publish('processState', commonEventData, (err) => {
console.info("====>processState publish err: " + JSON.stringify(err)) console.info('====>processState publish err: ' + JSON.stringify(err));
}) })
}, 1000) }, 1000);
} }
} }
let ForegroundTAG = -1 let ForegroundTAG = -1;
export default class EntryAbility extends Ability { export default class EntryAbility extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
ForegroundTAG = -1 ForegroundTAG = -1;
commonEventData.parameters.commonStateArr = -1 commonEventData.parameters.commonStateArr = -1;
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
globalThis.abilityContext1 = this.context globalThis.abilityContext1 = this.context;
globalThis.want1 = want globalThis.want1 = want;
globalThis.applicationContext1 = this.context.getApplicationContext(); globalThis.applicationContext1 = this.context.getApplicationContext();
globalThis.applicationContext1.on('applicationStateChange', ApplicationStateChangeCallbackFir) globalThis.applicationContext1.on('applicationStateChange', applicationStateChangeCallbackFir);
} }
...@@ -87,12 +87,12 @@ export default class EntryAbility extends Ability { ...@@ -87,12 +87,12 @@ export default class EntryAbility extends Ability {
onForeground() { onForeground() {
// Ability has brought to foreground // Ability has brought to foreground
ForegroundTAG++ ForegroundTAG++
if (ForegroundTAG == 1) { if (ForegroundTAG === 1) {
setTimeout(() => { setTimeout(() => {
commonEvent.publish('processState', commonEventData, (err) => { commonEvent.publish('processState', commonEventData, (err) => {
console.info("====>processState publish err: " + JSON.stringify(err)) console.info("====>processState publish err: " + JSON.stringify(err));
}) })
}, 3000) }, 3000);
} }
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.app.ability.UIAbility';
import Window from '@ohos.window' import Window from '@ohos.window';
export default class EntryAbility1 extends Ability { export default class EntryAbility1 extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
...@@ -22,8 +22,8 @@ export default class EntryAbility1 extends Ability { ...@@ -22,8 +22,8 @@ export default class EntryAbility1 extends Ability {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
globalThis.abilityContext2 = this.context globalThis.abilityContext2 = this.context;
globalThis.want2 = want globalThis.want2 = want;
globalThis.applicationContext2 = this.context.getApplicationContext(); globalThis.applicationContext2 = this.context.getApplicationContext();
} }
...@@ -62,7 +62,7 @@ export default class EntryAbility1 extends Ability { ...@@ -62,7 +62,7 @@ export default class EntryAbility1 extends Ability {
globalThis.abilityContext2.terminateSelf((err) => { globalThis.abilityContext2.terminateSelf((err) => {
console.log('terminateSelf result:' + JSON.stringify(err)); console.log('terminateSelf result:' + JSON.stringify(err));
}) })
}, 3000) }, 3000);
} }
onBackground() { onBackground() {
......
...@@ -13,20 +13,20 @@ ...@@ -13,20 +13,20 @@
* limitations under the License. * limitations under the License.
*/ */
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.app.ability.UIAbility';
import Window from '@ohos.window' import Window from '@ohos.window';
let TAG = 'StateChangeTestTAG' let TAG = 'StateChangeTestTAG';
let ApplicationStateChangeCallbackSec = { let applicationStateChangeCallbackSec = {
onApplicationForeground() { onApplicationForeground() {
console.info('==== ApplicationStateChange Foreground ===='); console.info('==== ApplicationStateChange Foreground ====');
console.log(TAG, 'App2 ApplicationStateChangeCallbackSec onApplicationForeground') console.log(TAG, 'App2 applicationStateChangeCallbackSec onApplicationForeground');
}, },
onApplicationBackground() { onApplicationBackground() {
console.info('==== ApplicationStateChange Background ===='); console.info('==== ApplicationStateChange Background ====');
console.log(TAG, 'App2 ApplicationStateChangeCallbackSec onApplicationBackground') console.log(TAG, 'App2 applicationStateChangeCallbackSec onApplicationBackground');
} }
} };
export default class EntryAbility extends Ability { export default class EntryAbility extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
...@@ -35,11 +35,11 @@ export default class EntryAbility extends Ability { ...@@ -35,11 +35,11 @@ export default class EntryAbility extends Ability {
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
globalThis.abilityContext = this.context globalThis.abilityContext = this.context;
globalThis.want = want globalThis.want = want;
if (want.action == 'MultiAppRegister' || want.action == 'DoubleRegisterOff') { if (want.action == 'MultiAppRegister' || want.action == 'DoubleRegisterOff') {
globalThis.applicationContext = this.context.getApplicationContext(); globalThis.applicationContext = this.context.getApplicationContext();
globalThis.applicationContext.on('applicationStateChange', ApplicationStateChangeCallbackSec) globalThis.applicationContext.on('applicationStateChange', applicationStateChangeCallbackSec);
} }
} }
......
...@@ -13,52 +13,52 @@ ...@@ -13,52 +13,52 @@
* limitations under the License. * limitations under the License.
*/ */
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.app.ability.UIAbility';
import Window from '@ohos.window' import Window from '@ohos.window';
import commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent';
import AbilityConstant from '@ohos.app.ability.AbilityConstant' import AbilityConstant from '@ohos.app.ability.AbilityConstant';
let sequence = 0; let sequence = 0;
let TAG = 'GetRunningProcessInformation' let TAG = 'GetRunningProcessInformation';
let commonStateArr: number[] = [-1, -1, -1, -1] let commonStateArr: number[] = [-1, -1, -1, -1];
let commonEventData = { let commonEventData = {
parameters: { parameters: {
commonStateArr: commonStateArr commonStateArr: commonStateArr
} }
} };
globalThis.StartFloatingAbility = () => { globalThis.StartFloatingAbility = () => {
let want = { let want = {
"deviceId": "", 'deviceId': '',
"bundleName": "com.example.getrunningprocessinformationtworeply", // 'bundleName': 'com.example.getrunningprocessinformationtworeply',
"abilityName": "EntryAbility" 'abilityName': 'EntryAbility'
}; };
let options = { let options = {
windowMode: AbilityConstant.WindowMode.WINDOW_MODE_FLOATING, windowMode: AbilityConstant.WindowMode.WINDOW_MODE_FLOATING,
}; };
globalThis.abilityContext.startAbility(want, options, (error) => { globalThis.abilityContext.startAbility(want, options, (error) => {
console.log(TAG, "start floating ability error.code = " + error.code) console.log(TAG, 'start floating ability error.code = ' + error.code);
}) })
} }
globalThis.StartNormalAbility = () => { globalThis.StartNormalAbility = () => {
let want = { let want = {
"deviceId": "", 'deviceId': '',
"bundleName": "com.example.getrunningprocessinformationtworeply", // 'bundleName': 'com.example.getrunningprocessinformationtworeply',
"abilityName": "EntryAbility" 'abilityName': 'EntryAbility'
}; };
globalThis.abilityContext.startAbility(want, (error) => { globalThis.abilityContext.startAbility(want, (error) => {
console.log(TAG, "start normal ability error.code = " + error.code) console.log(TAG, 'start normal ability error.code = ' + error.code);
}) })
} }
globalThis.GetRunningProcessInfoCallback = () => { globalThis.GetRunningProcessInfoCallback = () => {
globalThis.applicationContext.getRunningProcessInformation((err, data) => { globalThis.applicationContext.getRunningProcessInformation((err, data) => {
if (err) { if (err) {
console.log(TAG, `getRunningProcessInformation err: ` + JSON.stringify(err)); console.log(TAG, 'getRunningProcessInformation err: ' + JSON.stringify(err));
} }
else { else {
console.log(TAG, 'Oncreate Callback State: ' + JSON.stringify(data[0].state)); console.log(TAG, 'Oncreate Callback State: ' + JSON.stringify(data[0].state));
commonStateArr[sequence++] = data[0].state commonStateArr[sequence++] = data[0].state;
} }
}) })
} }
...@@ -66,15 +66,15 @@ globalThis.GetRunningProcessInfoCallback = () => { ...@@ -66,15 +66,15 @@ globalThis.GetRunningProcessInfoCallback = () => {
globalThis.GetRunningProcessInfoPromise = () => { globalThis.GetRunningProcessInfoPromise = () => {
globalThis.applicationContext.getRunningProcessInformation().then((data) => { globalThis.applicationContext.getRunningProcessInformation().then((data) => {
console.log(TAG, 'Oncreate Promise State: ' + JSON.stringify(data[0].state)); console.log(TAG, 'Oncreate Promise State: ' + JSON.stringify(data[0].state));
commonStateArr[sequence++] = data[0].state commonStateArr[sequence++] = data[0].state;
}).catch((err) => { }).catch((err) => {
console.log(TAG, `getRunningProcessInformation err: ` + JSON.stringify(err)); console.log(TAG, 'getRunningProcessInformation err: ' + JSON.stringify(err));
}); })
} }
globalThis.PublishStateArray = () => { globalThis.PublishStateArray = () => {
commonEvent.publish('processState', commonEventData, (err) => { commonEvent.publish('processState', commonEventData, (err) => {
console.info("====>processState publish err: " + JSON.stringify(err)) console.info('====>processState publish err: ' + JSON.stringify(err));
}) })
} }
...@@ -86,8 +86,8 @@ export default class EntryAbility extends Ability { ...@@ -86,8 +86,8 @@ export default class EntryAbility extends Ability {
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
globalThis.want = want globalThis.want = want;
globalThis.abilityContext = this.context globalThis.abilityContext = this.context;
globalThis.applicationContext = this.context.getApplicationContext(); globalThis.applicationContext = this.context.getApplicationContext();
} }
......
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import hilog from '@ohos.hilog' import hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import { Component, Driver, UiWindow, ON, UiDriver } from '@ohos.UiTest' import { Component, Driver, UiWindow, ON, UiDriver } from '@ohos.UiTest';
import commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent';
import appManager from '@ohos.app.ability.appManager' import appManager from '@ohos.app.ability.appManager';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
let ACTS_ProcessState = { let ACTS_ProcessState = {
events: ["processState"] events: ["processState"]
...@@ -29,23 +29,23 @@ export default function abilityTest() { ...@@ -29,23 +29,23 @@ export default function abilityTest() {
beforeEach(async function () { beforeEach(async function () {
var abilityDelegator; var abilityDelegator;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let cmd1 = 'hilog -r' let cmd1 = 'hilog -r';
await abilityDelegator.executeShellCommand(cmd1, (err: any, data: any) => { await abilityDelegator.executeShellCommand(cmd1, (err: any, data: any) => {
console.info("executeShellCommand1 callback"); console.info("executeShellCommand1 callback");
}); });
await abilityDelegator.executeShellCommand("hilog -G 20M", async (err, data) => { await abilityDelegator.executeShellCommand("hilog -G 20M", async (err, data) => {
}) });
}) })
afterEach(async function () { afterEach(async function () {
var abilityDelegator; var abilityDelegator;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let cmd1 = 'aa force-stop com.example.applicationstatechangeonereply' let cmd1 = 'aa force-stop com.example.applicationstatechangeonereply';
let cmd2 = 'aa force-stop com.example.applicationstatechangetworeply' let cmd2 = 'aa force-stop com.example.applicationstatechangetworeply';
let cmd6 = 'aa force-stop com.example.applicationstatechangethreereply' let cmd6 = 'aa force-stop com.example.applicationstatechangethreereply';
let cmd4 = 'aa force-stop com.example.getrunningprocessinformationonereply' let cmd4 = 'aa force-stop com.example.getrunningprocessinformationonereply';
let cmd5 = 'aa force-stop com.example.getrunningprocessinformationtworeply' let cmd5 = 'aa force-stop com.example.getrunningprocessinformationtworeply';
let cmd3 = 'hilog -r' let cmd3 = 'hilog -r';
await abilityDelegator.executeShellCommand(cmd1).then(() => { await abilityDelegator.executeShellCommand(cmd1).then(() => {
console.info("executeShellCommand1 callback"); console.info("executeShellCommand1 callback");
}); });
...@@ -103,7 +103,7 @@ export default function abilityTest() { ...@@ -103,7 +103,7 @@ export default function abilityTest() {
expect(data.parameters.commonStateArr[3]).assertEqual(-1); expect(data.parameters.commonStateArr[3]).assertEqual(-1);
} }
catch (error) { catch (error) {
console.log("An error is generated") console.log("An error is generated");
} }
commonEvent.unsubscribe(subscriber, unSubscribeCallback); commonEvent.unsubscribe(subscriber, unSubscribeCallback);
} }
...@@ -125,7 +125,7 @@ export default function abilityTest() { ...@@ -125,7 +125,7 @@ export default function abilityTest() {
console.log("auxiliary ability error.code = " + error.code); console.log("auxiliary ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
}, 3000) }, 3000);
}); });
}, 700); }, 700);
...@@ -150,7 +150,7 @@ export default function abilityTest() { ...@@ -150,7 +150,7 @@ export default function abilityTest() {
"abilityName": "EntryAbility", "abilityName": "EntryAbility",
"action": "Normal" "action": "Normal"
} }
let subscriber let subscriber;
function unSubscribeCallback() { function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0200 unSubscribeCallback"); console.debug("====>Acts_ApplicationStateChange_0200 unSubscribeCallback");
...@@ -161,15 +161,15 @@ export default function abilityTest() { ...@@ -161,15 +161,15 @@ export default function abilityTest() {
console.debug("====>Acts_ApplicationStateChange_0200 data: " + JSON.stringify(data)); console.debug("====>Acts_ApplicationStateChange_0200 data: " + JSON.stringify(data));
console.debug("====>Acts_ApplicationStateChange_0200 err: " + JSON.stringify(err)); console.debug("====>Acts_ApplicationStateChange_0200 err: " + JSON.stringify(err));
if (data.event == "processState") { if (data.event == "processState") {
console.info("entered assert zone!") console.info("entered assert zone!");
try { try {
expect(data.parameters.commonStateArr[0]).assertEqual(-1) expect(data.parameters.commonStateArr[0]).assertEqual(-1);
expect(data.parameters.commonStateArr[1]).assertEqual(1) expect(data.parameters.commonStateArr[1]).assertEqual(1);
expect(data.parameters.commonStateArr[2]).assertEqual(-1) expect(data.parameters.commonStateArr[2]).assertEqual(-1);
expect(data.parameters.commonStateArr[3]).assertEqual(-1) expect(data.parameters.commonStateArr[3]).assertEqual(-1);
} }
catch { catch {
console.log("An error is generated") console.log("An error is generated");
} }
commonEvent.unsubscribe(subscriber, unSubscribeCallback); commonEvent.unsubscribe(subscriber, unSubscribeCallback);
...@@ -183,18 +183,18 @@ export default function abilityTest() { ...@@ -183,18 +183,18 @@ export default function abilityTest() {
commonEvent.subscribe(subscriber, subscribeCallBack); commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (error) => { globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code) console.log("ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
setTimeout(() => { setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => { globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code) console.log("auxiliary ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
}, 3000) }, 3000);
}) })
}, 700) }, 700);
}) })
/* /*
...@@ -217,7 +217,7 @@ export default function abilityTest() { ...@@ -217,7 +217,7 @@ export default function abilityTest() {
"action": "Normal" "action": "Normal"
} }
let subscriber let subscriber;
function unSubscribeCallback() { function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0300 unSubscribeCallback"); console.debug("====>Acts_ApplicationStateChange_0300 unSubscribeCallback");
...@@ -230,13 +230,13 @@ export default function abilityTest() { ...@@ -230,13 +230,13 @@ export default function abilityTest() {
if (data.event == "processState") { if (data.event == "processState") {
console.info("entered assert zone!") console.info("entered assert zone!")
try { try {
expect(data.parameters.commonStateArr[0]).assertEqual(1) expect(data.parameters.commonStateArr[0]).assertEqual(1);
expect(data.parameters.commonStateArr[1]).assertEqual(1) expect(data.parameters.commonStateArr[1]).assertEqual(1);
expect(data.parameters.commonStateArr[2]).assertEqual(1) expect(data.parameters.commonStateArr[2]).assertEqual(1);
expect(data.parameters.commonStateArr[3]).assertEqual(1) expect(data.parameters.commonStateArr[3]).assertEqual(1);
} }
catch (error) { catch (error) {
console.log("An error is generated") console.log("An error is generated");
} }
commonEvent.unsubscribe(subscriber, unSubscribeCallback); commonEvent.unsubscribe(subscriber, unSubscribeCallback);
} }
...@@ -249,17 +249,17 @@ export default function abilityTest() { ...@@ -249,17 +249,17 @@ export default function abilityTest() {
commonEvent.subscribe(subscriber, subscribeCallBack); commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (error) => { globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code) console.log("ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
setTimeout(() => { setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => { globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code) console.log("auxiliary ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
}, 3000) }, 3000);
}) })
}, 700) }, 700);
}) })
/* /*
...@@ -284,7 +284,7 @@ export default function abilityTest() { ...@@ -284,7 +284,7 @@ export default function abilityTest() {
"action": "Normal" "action": "Normal"
} }
let subscriber let subscriber;
function unSubscribeCallback() { function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0400 unSubscribeCallback"); console.debug("====>Acts_ApplicationStateChange_0400 unSubscribeCallback");
...@@ -295,15 +295,15 @@ export default function abilityTest() { ...@@ -295,15 +295,15 @@ export default function abilityTest() {
console.debug("====>Acts_ApplicationStateChange_0400 data: " + JSON.stringify(data)); console.debug("====>Acts_ApplicationStateChange_0400 data: " + JSON.stringify(data));
console.debug("====>Acts_ApplicationStateChange_0400 err: " + JSON.stringify(err)); console.debug("====>Acts_ApplicationStateChange_0400 err: " + JSON.stringify(err));
if (data.event == "processState") { if (data.event == "processState") {
console.info("entered assert zone!") console.info("entered assert zone!");
try { try {
expect(data.parameters.commonStateArr[0]).assertEqual(1) expect(data.parameters.commonStateArr[0]).assertEqual(1);
expect(data.parameters.commonStateArr[1]).assertEqual(1) expect(data.parameters.commonStateArr[1]).assertEqual(1);
expect(data.parameters.commonStateArr[2]).assertEqual(-1) expect(data.parameters.commonStateArr[2]).assertEqual(-1);
expect(data.parameters.commonStateArr[3]).assertEqual(1) expect(data.parameters.commonStateArr[3]).assertEqual(1);
} }
catch (error) { catch (error) {
console.log("An error is generated") console.log("An error is generated");
} }
commonEvent.unsubscribe(subscriber, unSubscribeCallback); commonEvent.unsubscribe(subscriber, unSubscribeCallback);
} }
...@@ -316,12 +316,12 @@ export default function abilityTest() { ...@@ -316,12 +316,12 @@ export default function abilityTest() {
commonEvent.subscribe(subscriber, subscribeCallBack); commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (error) => { globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code) console.log("ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
setTimeout(() => { setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => { globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code) console.log("auxiliary ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
}, 3000) }, 3000)
...@@ -351,7 +351,7 @@ export default function abilityTest() { ...@@ -351,7 +351,7 @@ export default function abilityTest() {
"action": "MultiAppRegister" "action": "MultiAppRegister"
} }
let subscriber let subscriber;
function unSubscribeCallback() { function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0500 unSubscribeCallback"); console.debug("====>Acts_ApplicationStateChange_0500 unSubscribeCallback");
...@@ -362,15 +362,15 @@ export default function abilityTest() { ...@@ -362,15 +362,15 @@ export default function abilityTest() {
console.debug("====>Acts_ApplicationStateChange_0500 data: " + JSON.stringify(data)); console.debug("====>Acts_ApplicationStateChange_0500 data: " + JSON.stringify(data));
console.debug("====>Acts_ApplicationStateChange_0500 err: " + JSON.stringify(err)); console.debug("====>Acts_ApplicationStateChange_0500 err: " + JSON.stringify(err));
if (data.event == "processState") { if (data.event == "processState") {
console.info("entered assert zone!") console.info("entered assert zone!");
try { try {
expect(data.parameters.commonStateArr[0]).assertEqual(-1) expect(data.parameters.commonStateArr[0]).assertEqual(-1);
expect(data.parameters.commonStateArr[1]).assertEqual(1) expect(data.parameters.commonStateArr[1]).assertEqual(1);
expect(data.parameters.commonStateArr[2]).assertEqual(-1) expect(data.parameters.commonStateArr[2]).assertEqual(-1);
expect(data.parameters.commonStateArr[3]).assertEqual(-1) expect(data.parameters.commonStateArr[3]).assertEqual(-1);
} }
catch (error) { catch (error) {
console.log("An error is generated") console.log("An error is generated");
} }
commonEvent.unsubscribe(subscriber, unSubscribeCallback); commonEvent.unsubscribe(subscriber, unSubscribeCallback);
} }
...@@ -383,17 +383,17 @@ export default function abilityTest() { ...@@ -383,17 +383,17 @@ export default function abilityTest() {
commonEvent.subscribe(subscriber, subscribeCallBack); commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (error) => { globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code) console.log("ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
setTimeout(() => { setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => { globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code) console.log("auxiliary ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
}, 3000) }, 3000);
}) })
}, 700) }, 700);
}) })
/* /*
...@@ -418,7 +418,7 @@ export default function abilityTest() { ...@@ -418,7 +418,7 @@ export default function abilityTest() {
"action": "DoubleRegisterOff" "action": "DoubleRegisterOff"
} }
let subscriber let subscriber;
function unSubscribeCallback() { function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0600 unSubscribeCallback"); console.debug("====>Acts_ApplicationStateChange_0600 unSubscribeCallback");
...@@ -429,15 +429,15 @@ export default function abilityTest() { ...@@ -429,15 +429,15 @@ export default function abilityTest() {
console.debug("====>Acts_ApplicationStateChange_0600 data: " + JSON.stringify(data)); console.debug("====>Acts_ApplicationStateChange_0600 data: " + JSON.stringify(data));
console.debug("====>Acts_ApplicationStateChange_0600 err: " + JSON.stringify(err)); console.debug("====>Acts_ApplicationStateChange_0600 err: " + JSON.stringify(err));
if (data.event == "processState") { if (data.event == "processState") {
console.info("entered assert zone!") console.info("entered assert zone!");
try { try {
expect(data.parameters.commonStateArr[0]).assertEqual(-1) expect(data.parameters.commonStateArr[0]).assertEqual(-1);
expect(data.parameters.commonStateArr[1]).assertEqual(1) expect(data.parameters.commonStateArr[1]).assertEqual(1);
expect(data.parameters.commonStateArr[2]).assertEqual(-1) expect(data.parameters.commonStateArr[2]).assertEqual(-1);
expect(data.parameters.commonStateArr[3]).assertEqual(1) expect(data.parameters.commonStateArr[3]).assertEqual(1);
} }
catch (error) { catch (error) {
console.log("An error is generated") console.log("An error is generated");
} }
commonEvent.unsubscribe(subscriber, unSubscribeCallback); commonEvent.unsubscribe(subscriber, unSubscribeCallback);
} }
...@@ -450,15 +450,15 @@ export default function abilityTest() { ...@@ -450,15 +450,15 @@ export default function abilityTest() {
commonEvent.subscribe(subscriber, subscribeCallBack); commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (error) => { globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code) console.log("ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
setTimeout(() => { setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => { globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code) console.log("auxiliary ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
}, 3000) }, 3000);
}) })
}, 700); }, 700);
}) })
...@@ -482,7 +482,7 @@ export default function abilityTest() { ...@@ -482,7 +482,7 @@ export default function abilityTest() {
"abilityName": "EntryAbility", "abilityName": "EntryAbility",
"action": "Normal" "action": "Normal"
} }
let subscriber let subscriber;
function unSubscribeCallback() { function unSubscribeCallback() {
console.debug("====>Acts_ApplicationStateChange_0700 unSubscribeCallback"); console.debug("====>Acts_ApplicationStateChange_0700 unSubscribeCallback");
...@@ -494,13 +494,13 @@ export default function abilityTest() { ...@@ -494,13 +494,13 @@ export default function abilityTest() {
console.debug("====>Acts_ApplicationStateChange_0700 err: " + JSON.stringify(err)); console.debug("====>Acts_ApplicationStateChange_0700 err: " + JSON.stringify(err));
if (data.event == "processState") { if (data.event == "processState") {
try { try {
expect(data.parameters.commonStateArr[0]).assertEqual(1) expect(data.parameters.commonStateArr[0]).assertEqual(1);
expect(data.parameters.commonStateArr[1]).assertEqual(1) expect(data.parameters.commonStateArr[1]).assertEqual(1);
expect(data.parameters.commonStateArr[2]).assertEqual(-1) expect(data.parameters.commonStateArr[2]).assertEqual(-1);
expect(data.parameters.commonStateArr[3]).assertEqual(-1) expect(data.parameters.commonStateArr[3]).assertEqual(-1);
} }
catch (error) { catch (error) {
console.log("An error is generated") console.log("An error is generated");
} }
commonEvent.unsubscribe(subscriber, unSubscribeCallback); commonEvent.unsubscribe(subscriber, unSubscribeCallback);
} }
...@@ -513,16 +513,16 @@ export default function abilityTest() { ...@@ -513,16 +513,16 @@ export default function abilityTest() {
commonEvent.subscribe(subscriber, subscribeCallBack); commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (error) => { globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code) console.log("ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
setTimeout(() => { setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => { globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code) console.log("auxiliary ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
}, 3000) }, 3000);
}) })
}, 700); }, 700);
...@@ -559,12 +559,12 @@ export default function abilityTest() { ...@@ -559,12 +559,12 @@ export default function abilityTest() {
console.debug("====>Acts_ApplicationStateChange_0800 data: " + JSON.stringify(data)); console.debug("====>Acts_ApplicationStateChange_0800 data: " + JSON.stringify(data));
console.debug("====>Acts_ApplicationStateChange_0800 err: " + JSON.stringify(err)); console.debug("====>Acts_ApplicationStateChange_0800 err: " + JSON.stringify(err));
if (data.event == "processState") { if (data.event == "processState") {
console.info("entered assert zone!") console.info("entered assert zone!");
try { try {
expect(data.parameters.commonStateArr).assertEqual(-1) expect(data.parameters.commonStateArr).assertEqual(-1);
} }
catch (error) { catch (error) {
console.log("An error is generated") console.log("An error is generated");
} }
commonEvent.unsubscribe(subscriber, unSubscribeCallback); commonEvent.unsubscribe(subscriber, unSubscribeCallback);
} }
...@@ -577,15 +577,15 @@ export default function abilityTest() { ...@@ -577,15 +577,15 @@ export default function abilityTest() {
commonEvent.subscribe(subscriber, subscribeCallBack); commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (error) => { globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code) console.log("ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
setTimeout(() => { setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => { globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code) console.log("auxiliary ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
}, 3000) }, 3000);
}) })
}, 700); }, 700);
}) })
...@@ -605,11 +605,11 @@ export default function abilityTest() { ...@@ -605,11 +605,11 @@ export default function abilityTest() {
"abilityName": "EntryAbility", "abilityName": "EntryAbility",
"action": "Callback" "action": "Callback"
} }
let subscriber let subscriber;
function unSubscribeCallback() { function unSubscribeCallback() {
console.debug("====>Acts_GetRunningProcessInformation_AsyncCallback_0100 unSubscribeCallback"); console.debug("====>Acts_GetRunningProcessInformation_AsyncCallback_0100 unSubscribeCallback");
done() done();
} }
function subscribeCallBack(err, data) { function subscribeCallBack(err, data) {
...@@ -618,17 +618,17 @@ export default function abilityTest() { ...@@ -618,17 +618,17 @@ export default function abilityTest() {
if (data.event == "processState") { if (data.event == "processState") {
console.info("entered assert zone!") console.info("entered assert zone!")
try { try {
expect(data.parameters.commonStateArr[0]).assertEqual(2) expect(data.parameters.commonStateArr[0]).assertEqual(2);
console.info("this is array one") console.info("this is array one");
expect(data.parameters.commonStateArr[1]).assertEqual(1) expect(data.parameters.commonStateArr[1]).assertEqual(1);
console.info("this is array one") console.info("this is array one");
expect(data.parameters.commonStateArr[2]).assertEqual(3) expect(data.parameters.commonStateArr[2]).assertEqual(3);
console.info("this is array one") console.info("this is array one");
expect(data.parameters.commonStateArr[3]).assertEqual(-1) expect(data.parameters.commonStateArr[3]).assertEqual(-1);
console.info("this is array one") console.info("this is array one");
} }
catch (error) { catch (error) {
console.log("An error is generated") console.log("An error is generated");
} }
commonEvent.unsubscribe(subscriber, unSubscribeCallback); commonEvent.unsubscribe(subscriber, unSubscribeCallback);
} }
...@@ -641,29 +641,29 @@ export default function abilityTest() { ...@@ -641,29 +641,29 @@ export default function abilityTest() {
commonEvent.subscribe(subscriber, subscribeCallBack); commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (error) => { globalThis.abilityContext.startAbility(want, (error) => {
console.log("start normal ability error.code = " + error.code) console.log("start normal ability error.code = " + error.code);
expect(error.code).assertEqual(0); expect(error.code).assertEqual(0);
}) })
setTimeout(async () => { setTimeout(async () => {
let driver = Driver.create() let driver = Driver.create();
await driver.delayMs(1500) await driver.delayMs(1500);
let button1 = await driver.findComponent(ON.text('get focusedInfo')) let button1 = await driver.findComponent(ON.text('get focusedInfo'));
await expect(button1 != null).assertTrue() await expect(button1 != null).assertTrue();
let button2 = await driver.findComponent(ON.text('get unFocusedInfo')) let button2 = await driver.findComponent(ON.text('get unFocusedInfo'));
await expect(button2 != null).assertTrue() await expect(button2 != null).assertTrue();
let button3 = await driver.findComponent(ON.text('get BackInfo')) let button3 = await driver.findComponent(ON.text('get BackInfo'));
await expect(button3 != null).assertTrue() await expect(button3 != null).assertTrue();
await button1.click() await button1.click();
await driver.delayMs(2000) await driver.delayMs(2000);
await button2.click() await button2.click();
await driver.delayMs(4000) await driver.delayMs(4000);
await driver.pressBack() await driver.pressBack();
await driver.delayMs(2000) await driver.delayMs(2000);
await button3.click() await button3.click();
}, 3000) }, 3000);
}) })
}, 1000) }, 1000);
}) })
/* /*
...@@ -681,7 +681,7 @@ export default function abilityTest() { ...@@ -681,7 +681,7 @@ export default function abilityTest() {
"abilityName": "EntryAbility", "abilityName": "EntryAbility",
"action": "Promise" "action": "Promise"
} }
let subscriber let subscriber;
function unSubscribeCallback() { function unSubscribeCallback() {
console.debug("====>Acts_GetRunningProcessInformation_Promise_0100 unSubscribeCallback"); console.debug("====>Acts_GetRunningProcessInformation_Promise_0100 unSubscribeCallback");
...@@ -692,19 +692,19 @@ export default function abilityTest() { ...@@ -692,19 +692,19 @@ export default function abilityTest() {
console.debug("====>Acts_GetRunningProcessInformation_Promise_0100 data: " + JSON.stringify(data)); console.debug("====>Acts_GetRunningProcessInformation_Promise_0100 data: " + JSON.stringify(data));
console.debug("====>Acts_GetRunningProcessInformation_Promise_0100 err: " + JSON.stringify(err)); console.debug("====>Acts_GetRunningProcessInformation_Promise_0100 err: " + JSON.stringify(err));
if (data.event == "processState") { if (data.event == "processState") {
console.info("entered assert zone!") console.info("entered assert zone!");
try { try {
expect(data.parameters.commonStateArr[0]).assertEqual(2) expect(data.parameters.commonStateArr[0]).assertEqual(2);
console.info("this is array one") console.info("this is array one");
expect(data.parameters.commonStateArr[1]).assertEqual(1) expect(data.parameters.commonStateArr[1]).assertEqual(1);
console.info("this is array one") console.info("this is array one");
expect(data.parameters.commonStateArr[2]).assertEqual(3) expect(data.parameters.commonStateArr[2]).assertEqual(3);
console.info("this is array one") console.info("this is array one");
expect(data.parameters.commonStateArr[3]).assertEqual(-1) expect(data.parameters.commonStateArr[3]).assertEqual(-1);
console.info("this is array one") console.info("this is array one");
} }
catch (error) { catch (error) {
console.log("An error is generated") console.log("An error is generated");
} }
commonEvent.unsubscribe(subscriber, unSubscribeCallback); commonEvent.unsubscribe(subscriber, unSubscribeCallback);
} }
...@@ -722,24 +722,24 @@ export default function abilityTest() { ...@@ -722,24 +722,24 @@ export default function abilityTest() {
}) })
setTimeout(async () => { setTimeout(async () => {
let driver = Driver.create() let driver = Driver.create();
await driver.delayMs(1500) await driver.delayMs(1500);
let button1 = await driver.findComponent(ON.text('get focusedInfo')) let button1 = await driver.findComponent(ON.text('get focusedInfo'));
await expect(button1 != null).assertTrue() await expect(button1 != null).assertTrue();
let button2 = await driver.findComponent(ON.text('get unFocusedInfo')) let button2 = await driver.findComponent(ON.text('get unFocusedInfo'));
await expect(button2 != null).assertTrue() await expect(button2 != null).assertTrue();
let button3 = await driver.findComponent(ON.text('get BackInfo')) let button3 = await driver.findComponent(ON.text('get BackInfo'));
await expect(button3 != null).assertTrue() await expect(button3 != null).assertTrue();
await button1.click() await button1.click();
await driver.delayMs(2000) await driver.delayMs(2000);
await button2.click() await button2.click();
await driver.delayMs(4000) await driver.delayMs(4000);
await driver.pressBack() await driver.pressBack();
await driver.delayMs(2000) await driver.delayMs(2000);
await button3.click() await button3.click();
}, 3000) }, 3000);
}) })
}, 1000) }, 1000);
}) })
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.app.ability.UIAbility';
import Window from '@ohos.window' import Window from '@ohos.window';
export default class EntryAbility extends Ability { export default class EntryAbility extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册