提交 df7e79f3 编写于 作者: G greada

power test code optimization

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