提交 df7e79f3 编写于 作者: G greada

power test code optimization

Signed-off-by: Ngreada <kangqiao1@huawei.com>
上级 7b8657cf
...@@ -17,7 +17,7 @@ import batteryInfo from '@ohos.batteryInfo'; ...@@ -17,7 +17,7 @@ import batteryInfo from '@ohos.batteryInfo';
import { describe, it, expect } from '@ohos/hypium' import { describe, it, expect } from '@ohos/hypium'
export default function BatteryCommonEventTest() { export default function BatteryCommonEventTest() {
describe('BatteryCommonEventTest', function () { describe('BatteryCommonEventTest', function () {
console.log("*************Battery commonEvent Test Begin*************"); console.log("*************Battery commonEvent Test Begin*************");
/** /**
...@@ -1421,7 +1421,7 @@ describe('BatteryCommonEventTest', function () { ...@@ -1421,7 +1421,7 @@ describe('BatteryCommonEventTest', function () {
}) })
console.log("*************Battery commonEvent Test End*************"); console.log("*************Battery commonEvent Test End*************");
}) })
} }
function createCommonEventAirplaneModeChangedSubscriber() { function createCommonEventAirplaneModeChangedSubscriber() {
...@@ -1464,6 +1464,13 @@ function createCommonEventAirplaneModeChangedSubscriber() { ...@@ -1464,6 +1464,13 @@ function createCommonEventAirplaneModeChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -1510,6 +1517,13 @@ function createCommonEventFoundationReadySubscriber() { ...@@ -1510,6 +1517,13 @@ function createCommonEventFoundationReadySubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -1555,6 +1569,13 @@ function createCommonEventAccountDeletedSubscriber() { ...@@ -1555,6 +1569,13 @@ function createCommonEventAccountDeletedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -1600,6 +1621,13 @@ function createCommonEventVisibleAccountsUpdatedSubscriber() { ...@@ -1600,6 +1621,13 @@ function createCommonEventVisibleAccountsUpdatedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -1645,6 +1673,13 @@ function createCommonEventDickEjectSubscriber() { ...@@ -1645,6 +1673,13 @@ function createCommonEventDickEjectSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -1690,6 +1725,13 @@ function createCommonEventDickUnmoutableSubscriber() { ...@@ -1690,6 +1725,13 @@ function createCommonEventDickUnmoutableSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -1735,6 +1777,13 @@ function createCommonEventDickNadRemovalSubscriber() { ...@@ -1735,6 +1777,13 @@ function createCommonEventDickNadRemovalSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -1780,6 +1829,13 @@ function createCommonEventDickMountedSubscriber() { ...@@ -1780,6 +1829,13 @@ function createCommonEventDickMountedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -1825,6 +1881,13 @@ function createCommonEventDickUnmountedSubscriber() { ...@@ -1825,6 +1881,13 @@ function createCommonEventDickUnmountedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -1870,6 +1933,13 @@ function createCommonEventDickRemovedSubscriber() { ...@@ -1870,6 +1933,13 @@ function createCommonEventDickRemovedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -1915,6 +1985,13 @@ function createCommonEventSUBAccessoryDetachedSubscriber() { ...@@ -1915,6 +1985,13 @@ function createCommonEventSUBAccessoryDetachedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -1960,6 +2037,13 @@ function createCommonEventSUBAccessoryAttachedSubscriber() { ...@@ -1960,6 +2037,13 @@ function createCommonEventSUBAccessoryAttachedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2005,6 +2089,13 @@ function createCommonEventSUBDevidceDetachedSubscriber() { ...@@ -2005,6 +2089,13 @@ function createCommonEventSUBDevidceDetachedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2050,6 +2141,13 @@ function createCommonEventSUBDevidceAttachedSubscriber() { ...@@ -2050,6 +2141,13 @@ function createCommonEventSUBDevidceAttachedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2095,6 +2193,13 @@ function createCommonEventIVIActiveSubscriber() { ...@@ -2095,6 +2193,13 @@ function createCommonEventIVIActiveSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2140,6 +2245,13 @@ function createCommonEventIVITempratureRecoverySubscriber() { ...@@ -2140,6 +2245,13 @@ function createCommonEventIVITempratureRecoverySubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2185,6 +2297,13 @@ function createCommonEventIVIVoltageRecoverySubscriber() { ...@@ -2185,6 +2297,13 @@ function createCommonEventIVIVoltageRecoverySubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2230,6 +2349,13 @@ function createCommonEventIVITemperatureAbnormalSubscriber() { ...@@ -2230,6 +2349,13 @@ function createCommonEventIVITemperatureAbnormalSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2275,6 +2401,13 @@ function createCommonEventIVIExtremeTemperatureSubscriber() { ...@@ -2275,6 +2401,13 @@ function createCommonEventIVIExtremeTemperatureSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2320,6 +2453,13 @@ function createCommonEventIVIHightTemperatureSubscriber() { ...@@ -2320,6 +2453,13 @@ function createCommonEventIVIHightTemperatureSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2365,6 +2505,13 @@ function createCommonEventIVIVoltageAbnormalSubscriber() { ...@@ -2365,6 +2505,13 @@ function createCommonEventIVIVoltageAbnormalSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2410,6 +2557,13 @@ function createCommonEventIVILastmodeSaveSubscriber() { ...@@ -2410,6 +2557,13 @@ function createCommonEventIVILastmodeSaveSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2455,6 +2609,13 @@ function createCommonEventIVIStandBySubscriber() { ...@@ -2455,6 +2609,13 @@ function createCommonEventIVIStandBySubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2500,6 +2661,13 @@ function createCommonEventIVIPauseSubscriber() { ...@@ -2500,6 +2661,13 @@ function createCommonEventIVIPauseSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2545,6 +2713,13 @@ function createCommonEventIVISleepSubscriber() { ...@@ -2545,6 +2713,13 @@ function createCommonEventIVISleepSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2590,6 +2765,13 @@ function createCommonEventLocationModeStateChangedSubscriber() { ...@@ -2590,6 +2765,13 @@ function createCommonEventLocationModeStateChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2635,6 +2817,13 @@ function createCommonEventAbilityUpdatedSubscriber() { ...@@ -2635,6 +2817,13 @@ function createCommonEventAbilityUpdatedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2680,6 +2869,13 @@ function createCommonEventAbilityRemovedSubscriber() { ...@@ -2680,6 +2869,13 @@ function createCommonEventAbilityRemovedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2725,6 +2921,13 @@ function createCommonEventAbilityAddedSubscriber() { ...@@ -2725,6 +2921,13 @@ function createCommonEventAbilityAddedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2770,6 +2973,13 @@ function createCommonEventUserRemovedSubscriber() { ...@@ -2770,6 +2973,13 @@ function createCommonEventUserRemovedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2815,6 +3025,13 @@ function createCommonEventUserAddedSubscriber() { ...@@ -2815,6 +3025,13 @@ function createCommonEventUserAddedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2860,6 +3077,13 @@ function createCommonEventPowerSaveModeChangedSubscriber() { ...@@ -2860,6 +3077,13 @@ function createCommonEventPowerSaveModeChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2905,6 +3129,13 @@ function createCommonEventDeviceIdleModeChangedSubscriber() { ...@@ -2905,6 +3129,13 @@ function createCommonEventDeviceIdleModeChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2950,6 +3181,13 @@ function createCommonEventNFCActionRFFieldOffDetectedSubscriber() { ...@@ -2950,6 +3181,13 @@ function createCommonEventNFCActionRFFieldOffDetectedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -2995,6 +3233,13 @@ function createCommonEventNFCActionRFFieldOnDetectedSubscriber() { ...@@ -2995,6 +3233,13 @@ function createCommonEventNFCActionRFFieldOnDetectedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3040,6 +3285,13 @@ function createCommonEventNFCActionAdapterStateChangedSubscriber() { ...@@ -3040,6 +3285,13 @@ function createCommonEventNFCActionAdapterStateChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3085,6 +3337,13 @@ function createCommonEventA2DPsinkAudioStateUpdateSubscriber() { ...@@ -3085,6 +3337,13 @@ function createCommonEventA2DPsinkAudioStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3130,6 +3389,13 @@ function createCommonEventA2DPsinkPlayingStateUpdateSubscriber() { ...@@ -3130,6 +3389,13 @@ function createCommonEventA2DPsinkPlayingStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3175,6 +3441,13 @@ function createCommonEventHostStateUpdateSubscriber() { ...@@ -3175,6 +3441,13 @@ function createCommonEventHostStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3220,6 +3493,13 @@ function createCommonEventHostNameUpdateSubscriber() { ...@@ -3220,6 +3493,13 @@ function createCommonEventHostNameUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3265,6 +3545,13 @@ function createCommonEventHostDiscovetyFinishedSubscriber() { ...@@ -3265,6 +3545,13 @@ function createCommonEventHostDiscovetyFinishedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3310,6 +3597,13 @@ function createCommonEventHostDiscovetyStartedSubscriber() { ...@@ -3310,6 +3597,13 @@ function createCommonEventHostDiscovetyStartedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3355,6 +3649,13 @@ function createCommonEventHostScanModeUpdateSubscriber() { ...@@ -3355,6 +3649,13 @@ function createCommonEventHostScanModeUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3400,6 +3701,13 @@ function createCommonEventHostReqDisableSubscriber() { ...@@ -3400,6 +3701,13 @@ function createCommonEventHostReqDisableSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3445,6 +3753,13 @@ function createCommonEventHostReqEnableSubscriber() { ...@@ -3445,6 +3753,13 @@ function createCommonEventHostReqEnableSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3490,6 +3805,13 @@ function createBluetoothHostReqDiscoverableSubscriber() { ...@@ -3490,6 +3805,13 @@ function createBluetoothHostReqDiscoverableSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3535,6 +3857,13 @@ function createBluetoothHostStateUpdateSubscriber() { ...@@ -3535,6 +3857,13 @@ function createBluetoothHostStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3580,6 +3909,13 @@ function createBluetoothHandsfreeunitAgCallStateUpdateSubscriber() { ...@@ -3580,6 +3909,13 @@ function createBluetoothHandsfreeunitAgCallStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3625,6 +3961,13 @@ function createBluetoothHandsfreeunitAgCommonEventSubscriber() { ...@@ -3625,6 +3961,13 @@ function createBluetoothHandsfreeunitAgCommonEventSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3670,6 +4013,13 @@ function createBluetoothHandsfreeunitAudioStateUpdateSubscriber() { ...@@ -3670,6 +4013,13 @@ function createBluetoothHandsfreeunitAudioStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3715,6 +4065,13 @@ function createBluetoothHandsfreeunitConntectStateUpdateSubscriber() { ...@@ -3715,6 +4065,13 @@ function createBluetoothHandsfreeunitConntectStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3760,6 +4117,13 @@ function createBluetoothRemotedeviceConntectCancelSubscriber() { ...@@ -3760,6 +4117,13 @@ function createBluetoothRemotedeviceConntectCancelSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3805,6 +4169,13 @@ function createBluetoothRemotedeviceConntectReplySubscriber() { ...@@ -3805,6 +4169,13 @@ function createBluetoothRemotedeviceConntectReplySubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3850,6 +4221,13 @@ function createBluetoothRemotedeviceConntectReqSubscriber() { ...@@ -3850,6 +4221,13 @@ function createBluetoothRemotedeviceConntectReqSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3895,6 +4273,13 @@ function createBluetoothRemotedevicePairingCancelSubscriber() { ...@@ -3895,6 +4273,13 @@ function createBluetoothRemotedevicePairingCancelSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3940,6 +4325,13 @@ function createBluetoothPairingReqSubscriber() { ...@@ -3940,6 +4325,13 @@ function createBluetoothPairingReqSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -3985,6 +4377,13 @@ function createBluetoothRemotedeviceUuidValueSubscriber() { ...@@ -3985,6 +4377,13 @@ function createBluetoothRemotedeviceUuidValueSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4030,6 +4429,13 @@ function createBluetoothRemotedeviceSdpResultSubscriber() { ...@@ -4030,6 +4429,13 @@ function createBluetoothRemotedeviceSdpResultSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4075,6 +4481,13 @@ function createBluetoothRemotedeviceBateryValueUpdateSubscriber() { ...@@ -4075,6 +4481,13 @@ function createBluetoothRemotedeviceBateryValueUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4120,6 +4533,13 @@ function createBluetoothRemotedevicePairStateSubscriber() { ...@@ -4120,6 +4533,13 @@ function createBluetoothRemotedevicePairStateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4165,6 +4585,13 @@ function createBluetoothRemotedeviceNameUpdateSubscriber() { ...@@ -4165,6 +4585,13 @@ function createBluetoothRemotedeviceNameUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4210,6 +4637,13 @@ function createBluetoothRemotedeviceAclDisconnectedSubscriber() { ...@@ -4210,6 +4637,13 @@ function createBluetoothRemotedeviceAclDisconnectedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4255,6 +4689,13 @@ function createBluetoothRemotedeviceAclConnectedSubscriber() { ...@@ -4255,6 +4689,13 @@ function createBluetoothRemotedeviceAclConnectedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4300,6 +4741,13 @@ function createBluetoothRemotedeviceClassValueUpdateSubscriber() { ...@@ -4300,6 +4741,13 @@ function createBluetoothRemotedeviceClassValueUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4345,6 +4793,13 @@ function createBluetoothRemotedeviceDiscoveredSubscriber() { ...@@ -4345,6 +4793,13 @@ function createBluetoothRemotedeviceDiscoveredSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4390,6 +4845,13 @@ function createBluetoothA2DPsourceCodecValueUpdateSubscriber() { ...@@ -4390,6 +4845,13 @@ function createBluetoothA2DPsourceCodecValueUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4435,6 +4897,13 @@ function createBluetoothA2DPsourceAvrcpConntectStateUpdateSubscriber() { ...@@ -4435,6 +4897,13 @@ function createBluetoothA2DPsourceAvrcpConntectStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4480,6 +4949,13 @@ function createBluetoothA2DPsourcePlayingStateUpdateSubscriber() { ...@@ -4480,6 +4949,13 @@ function createBluetoothA2DPsourcePlayingStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4525,6 +5001,13 @@ function createBluetoothA2DPsourceCurrentDeviceUpdateSubscriber() { ...@@ -4525,6 +5001,13 @@ function createBluetoothA2DPsourceCurrentDeviceUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4570,6 +5053,13 @@ function createBluetoothA2DPsourceConnectStateUpdateSubscriber() { ...@@ -4570,6 +5053,13 @@ function createBluetoothA2DPsourceConnectStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4615,6 +5105,13 @@ function createBluetoothHandsfreeAgAudioStateUpdateSubscriber() { ...@@ -4615,6 +5105,13 @@ function createBluetoothHandsfreeAgAudioStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4660,6 +5157,13 @@ function createBluetoothHandsfreeAgConntectDeviceUpdateSubscriber() { ...@@ -4660,6 +5157,13 @@ function createBluetoothHandsfreeAgConntectDeviceUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4705,6 +5209,13 @@ function createBluetoothHandsfreeAgConntectStateUpdateSubscriber() { ...@@ -4705,6 +5209,13 @@ function createBluetoothHandsfreeAgConntectStateUpdateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4750,6 +5261,13 @@ function createWifiP2PGroupStateChangedSubscriber() { ...@@ -4750,6 +5261,13 @@ function createWifiP2PGroupStateChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4795,6 +5313,13 @@ function createWifiP2PCurrentDeviceStateChangedSubscriber() { ...@@ -4795,6 +5313,13 @@ function createWifiP2PCurrentDeviceStateChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4840,6 +5365,13 @@ function createWifiP2PPeersDiscoveryStateChangedSubscriber() { ...@@ -4840,6 +5365,13 @@ function createWifiP2PPeersDiscoveryStateChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4885,6 +5417,13 @@ function createWifiP2PPeersStateChangedSubscriber() { ...@@ -4885,6 +5417,13 @@ function createWifiP2PPeersStateChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4930,6 +5469,13 @@ function createWifiP2PStateChangedSubscriber() { ...@@ -4930,6 +5469,13 @@ function createWifiP2PStateChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -4975,6 +5521,13 @@ function createWifiP2PConnStateSubscriber() { ...@@ -4975,6 +5521,13 @@ function createWifiP2PConnStateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5020,6 +5573,13 @@ function createWifiMplinkStateChangeSubscriber() { ...@@ -5020,6 +5573,13 @@ function createWifiMplinkStateChangeSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5065,6 +5625,13 @@ function createWifiApStaLeaveSubscriber() { ...@@ -5065,6 +5625,13 @@ function createWifiApStaLeaveSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5110,6 +5677,13 @@ function createWifiApStaJoinSubscriber() { ...@@ -5110,6 +5677,13 @@ function createWifiApStaJoinSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5155,6 +5729,13 @@ function createWifiHostpotStateSubscriber() { ...@@ -5155,6 +5729,13 @@ function createWifiHostpotStateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5200,6 +5781,13 @@ function createWifiConnStateSubscriber() { ...@@ -5200,6 +5781,13 @@ function createWifiConnStateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5245,6 +5833,13 @@ function createWifiRssiValueSubscriber() { ...@@ -5245,6 +5833,13 @@ function createWifiRssiValueSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5290,6 +5885,13 @@ function createWifiScanFinishedSubscriber() { ...@@ -5290,6 +5885,13 @@ function createWifiScanFinishedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5335,6 +5937,13 @@ function createWifiPowerStateSubscriber() { ...@@ -5335,6 +5937,13 @@ function createWifiPowerStateSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5380,6 +5989,13 @@ function createHwidLogOffSubscriber() { ...@@ -5380,6 +5989,13 @@ function createHwidLogOffSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5425,6 +6041,13 @@ function createHwidTokenInvalidSubscriber() { ...@@ -5425,6 +6041,13 @@ function createHwidTokenInvalidSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5470,6 +6093,13 @@ function createHwidLogoutSubscriber() { ...@@ -5470,6 +6093,13 @@ function createHwidLogoutSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5515,6 +6145,13 @@ function createHwidLoginSubscriber() { ...@@ -5515,6 +6145,13 @@ function createHwidLoginSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5560,6 +6197,13 @@ function createUserStoppedSubscriber() { ...@@ -5560,6 +6197,13 @@ function createUserStoppedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5605,6 +6249,13 @@ function createUserStoppingSubscriber() { ...@@ -5605,6 +6249,13 @@ function createUserStoppingSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5650,6 +6301,13 @@ function createUserUnlockedSubscriber() { ...@@ -5650,6 +6301,13 @@ function createUserUnlockedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5695,6 +6353,13 @@ function createUserStartingSubscriber() { ...@@ -5695,6 +6353,13 @@ function createUserStartingSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5740,6 +6405,13 @@ function createUserSwitchedSubscriber() { ...@@ -5740,6 +6405,13 @@ function createUserSwitchedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5785,6 +6457,13 @@ function createUserForgroundSubscriber() { ...@@ -5785,6 +6457,13 @@ function createUserForgroundSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5830,6 +6509,13 @@ function createUserBackgroundSubscriber() { ...@@ -5830,6 +6509,13 @@ function createUserBackgroundSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5875,6 +6561,13 @@ function createUserStartedSubscriber() { ...@@ -5875,6 +6561,13 @@ function createUserStartedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5920,6 +6613,13 @@ function createOfficeModeSubscriber() { ...@@ -5920,6 +6613,13 @@ function createOfficeModeSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -5965,6 +6665,13 @@ function createHomeModeSubscriber() { ...@@ -5965,6 +6665,13 @@ function createHomeModeSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6010,6 +6717,13 @@ function createDriveModeSubscriber() { ...@@ -6010,6 +6717,13 @@ function createDriveModeSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6055,6 +6769,13 @@ function createManagePackageStorageSubscriber() { ...@@ -6055,6 +6769,13 @@ function createManagePackageStorageSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6100,6 +6821,13 @@ function createLocateChangedSubscriber() { ...@@ -6100,6 +6821,13 @@ function createLocateChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6145,6 +6873,13 @@ function createConfigurationChangedSubscriber() { ...@@ -6145,6 +6873,13 @@ function createConfigurationChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6190,6 +6925,13 @@ function createExternalApplicationsUnAvailableSubscriber() { ...@@ -6190,6 +6925,13 @@ function createExternalApplicationsUnAvailableSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6235,6 +6977,13 @@ function createExternalApplicationsAvailableSubscriber() { ...@@ -6235,6 +6977,13 @@ function createExternalApplicationsAvailableSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6280,6 +7029,13 @@ function createMyPackageNeedsVerificationSubscriber() { ...@@ -6280,6 +7029,13 @@ function createMyPackageNeedsVerificationSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6325,6 +7081,13 @@ function createMyPackageFirstLaunchSubscriber() { ...@@ -6325,6 +7081,13 @@ function createMyPackageFirstLaunchSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6370,6 +7133,13 @@ function createMyPackageUnsuspendedSubscriber() { ...@@ -6370,6 +7133,13 @@ function createMyPackageUnsuspendedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6415,6 +7185,13 @@ function createMyPackageSuspendedSubscriber() { ...@@ -6415,6 +7185,13 @@ function createMyPackageSuspendedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6460,6 +7237,13 @@ function createPackagesUnsuspendedSubscriber() { ...@@ -6460,6 +7237,13 @@ function createPackagesUnsuspendedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6505,6 +7289,13 @@ function createPackageSuspendedSubscriber() { ...@@ -6505,6 +7289,13 @@ function createPackageSuspendedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6550,6 +7341,13 @@ function createPackageDataClearedSubscriber() { ...@@ -6550,6 +7341,13 @@ function createPackageDataClearedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6595,6 +7393,13 @@ function createPackageRestartedSubscriber() { ...@@ -6595,6 +7393,13 @@ function createPackageRestartedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6640,6 +7445,13 @@ function createPackageChangedSubscriber() { ...@@ -6640,6 +7445,13 @@ function createPackageChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6685,6 +7497,13 @@ function createPackageFullyRemovedSubscriber() { ...@@ -6685,6 +7497,13 @@ function createPackageFullyRemovedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6730,6 +7549,13 @@ function createBundleRemovedSubscriber() { ...@@ -6730,6 +7549,13 @@ function createBundleRemovedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6775,6 +7601,13 @@ function createPackageRemovedSubscriber() { ...@@ -6775,6 +7601,13 @@ function createPackageRemovedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6820,6 +7653,13 @@ function createMyPackageReplacedSubscriber() { ...@@ -6820,6 +7653,13 @@ function createMyPackageReplacedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6865,6 +7705,13 @@ function createPackageReplacedSubscriber() { ...@@ -6865,6 +7705,13 @@ function createPackageReplacedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6910,6 +7757,13 @@ function createPackageAddedSubscriber() { ...@@ -6910,6 +7757,13 @@ function createPackageAddedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -6955,6 +7809,13 @@ function createCloseSystemDialogsSubscriber() { ...@@ -6955,6 +7809,13 @@ function createCloseSystemDialogsSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7000,6 +7861,13 @@ function createTimezoneChangedSubscriber() { ...@@ -7000,6 +7861,13 @@ function createTimezoneChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7045,6 +7913,13 @@ function createDateChangedSubscriber() { ...@@ -7045,6 +7913,13 @@ function createDateChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7090,6 +7965,13 @@ function createTimeChangedSubscriber() { ...@@ -7090,6 +7965,13 @@ function createTimeChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7135,6 +8017,13 @@ function createTimeTickSubscriber() { ...@@ -7135,6 +8017,13 @@ function createTimeTickSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7180,6 +8069,13 @@ function createUserPresentSubscriber() { ...@@ -7180,6 +8069,13 @@ function createUserPresentSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7225,6 +8121,13 @@ function createScreenOnSubscriber() { ...@@ -7225,6 +8121,13 @@ function createScreenOnSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7270,6 +8173,13 @@ function createScreenOffSubscriber() { ...@@ -7270,6 +8173,13 @@ function createScreenOffSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7315,6 +8225,13 @@ function createShutdownSubscriber() { ...@@ -7315,6 +8225,13 @@ function createShutdownSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7360,6 +8277,13 @@ function createLockedBootCompletedSubscriber() { ...@@ -7360,6 +8277,13 @@ function createLockedBootCompletedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7405,6 +8329,13 @@ function createBootCompletedSubscriber() { ...@@ -7405,6 +8329,13 @@ function createBootCompletedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7451,6 +8382,13 @@ function createBatteryChangedSubscriber() { ...@@ -7451,6 +8382,13 @@ function createBatteryChangedSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7496,6 +8434,13 @@ function createBatteryOkaySubscriber() { ...@@ -7496,6 +8434,13 @@ function createBatteryOkaySubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7541,6 +8486,13 @@ function createBatteryLowSubscriber() { ...@@ -7541,6 +8486,13 @@ function createBatteryLowSubscriber() {
console.info("capacity is:" + capacity); console.info("capacity is:" + capacity);
expect(capacity >= 0 && capacity <= 100).assertTrue(); expect(capacity >= 0 && capacity <= 100).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7586,6 +8538,13 @@ function createBatteryPowerConnectedSubscriber() { ...@@ -7586,6 +8538,13 @@ function createBatteryPowerConnectedSubscriber() {
console.info("pluggedType is:" + pluggedType); console.info("pluggedType is:" + pluggedType);
expect(pluggedType >= 0 && pluggedType <= 4).assertTrue(); expect(pluggedType >= 0 && pluggedType <= 4).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7631,6 +8590,13 @@ function createBatteryPowerDisconnectedSubscriber() { ...@@ -7631,6 +8590,13 @@ function createBatteryPowerDisconnectedSubscriber() {
console.info("pluggedType is:" + pluggedType); console.info("pluggedType is:" + pluggedType);
expect(pluggedType >= 0 && pluggedType <= 4).assertTrue(); expect(pluggedType >= 0 && pluggedType <= 4).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7676,6 +8642,13 @@ function createBatteryChargingSubscriber() { ...@@ -7676,6 +8642,13 @@ function createBatteryChargingSubscriber() {
console.info("chargeState is:" + chargeState); console.info("chargeState is:" + chargeState);
expect(chargeState >= 0 && chargeState <= 10).assertTrue(); expect(chargeState >= 0 && chargeState <= 10).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
...@@ -7721,6 +8694,13 @@ function createBatteryDischargingSubscriber() { ...@@ -7721,6 +8694,13 @@ function createBatteryDischargingSubscriber() {
console.info("chargeState is:" + chargeState); console.info("chargeState is:" + chargeState);
expect(chargeState >= 0 && chargeState <= 10).assertTrue(); expect(chargeState >= 0 && chargeState <= 10).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
......
...@@ -93,22 +93,19 @@ export default async function SystemDisplayTest() { ...@@ -93,22 +93,19 @@ export default async function SystemDisplayTest() {
brightness.setKeepScreenOn({ brightness.setKeepScreenOn({
keepScreenOn: true, keepScreenOn: true,
success: function () { success: function () {
console.log('handling set keep screen on success0.'); console.log('handling set keep screen on success.');
brightness.setValue({ brightness.setValue({
value: 50, value: 50,
success: function () { success: function () {
console.log('set keep screen on success1.'); console.log('set_value_success_value success.');
setTimeout(() => { expect(true).assertTrue();
console.log('set keep screen on success2.');
brightness.getValue({
success: (data) => {
console.log("set_value_success_value, brightness: " + data.value);
expect(data.value === 50).assertTrue();
done(); done();
}
});
}, 1000);
}, },
fail: function () {
console.log('set_value_success_value fail.');
expect().assertFail();
done();
}
}); });
}, },
fail: function (data, code) { fail: function (data, code) {
...@@ -188,13 +185,12 @@ export default async function SystemDisplayTest() { ...@@ -188,13 +185,12 @@ export default async function SystemDisplayTest() {
mode: 0, mode: 0,
success: () => { success: () => {
console.log("set_mode_success success"); console.log("set_mode_success success");
brightness.getMode({ expect(true).assertTrue();
success: (data) => { },
console.log("set_mode_success, data: " + data.mode); fail: (data, code) => {
expect(data.mode === 0).assertTrue(); console.log("set_mode_success, data: " + data + ", code: " + code);
expect(code == 200).assertTrue();
done(); done();
}
});
}, },
complete: () => { complete: () => {
console.log("The device information is obtained successfully. Procedure"); console.log("The device information is obtained successfully. Procedure");
......
...@@ -67,9 +67,9 @@ describe('PowerManagerPowerTest', function () { ...@@ -67,9 +67,9 @@ describe('PowerManagerPowerTest', function () {
console.log('Power_Is_Screnn_On_Callback_JSTest0030: ' + error); console.log('Power_Is_Screnn_On_Callback_JSTest0030: ' + error);
expect().assertFail(); expect().assertFail();
} }
})
done(); done();
}) })
})
/** /**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0040 * @tc.number SUB_PowerSystem_PowerManager_JSTest_0040
......
...@@ -16,7 +16,7 @@ import commonEvent from '@ohos.commonEvent'; ...@@ -16,7 +16,7 @@ import commonEvent from '@ohos.commonEvent';
import thermal from "@ohos.thermal" import thermal from "@ohos.thermal"
export default function ThermalCommonEvent() { export default function ThermalCommonEvent() {
describe('ThermalCommonEvent', function () { describe('ThermalCommonEvent', function () {
console.log("*************Thermal commonEvent Test Begin*************"); console.log("*************Thermal commonEvent Test Begin*************");
/** /**
...@@ -29,9 +29,9 @@ describe('ThermalCommonEvent', function () { ...@@ -29,9 +29,9 @@ describe('ThermalCommonEvent', function () {
done(); done();
}) })
console.log("*************Thermal commonEvent Test End*************"); console.log("*************Thermal commonEvent Test End*************");
}) })
function createSubscriber() { function createSubscriber() {
let commonEventSubscribeInfo = { let commonEventSubscribeInfo = {
events: [commonEvent.Support.COMMON_EVENT_THERMAL_LEVEL_CHANGED], events: [commonEvent.Support.COMMON_EVENT_THERMAL_LEVEL_CHANGED],
}; };
...@@ -68,7 +68,15 @@ function createSubscriber() { ...@@ -68,7 +68,15 @@ function createSubscriber() {
let level = -1; let level = -1;
expect(level >= thermal.ThermalLevel.COOL && warm <= level.ThermalLevel.EMERGENCY).assertTrue(); expect(level >= thermal.ThermalLevel.COOL && warm <= level.ThermalLevel.EMERGENCY).assertTrue();
}); });
commonEvent.unsubscribe(mySubscriber, (error) => {
if (error.code) {
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
})
}).catch((error) => { }).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error)); console.error('Operation failed. Cause: ' + JSON.stringify(error));
}); });
}} }
}
// @ts-nocheck
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册