From 93a46cc1884009a77155e4c3eeae1ddfdba42483 Mon Sep 17 00:00:00 2001 From: liwuli Date: Sat, 29 Oct 2022 11:33:02 +0800 Subject: [PATCH] After running testCase, setback system time Signed-off-by: liwuli --- .../entry/src/main/ets/test/edmCallback.test.ets | 8 +++++--- .../entry/src/main/ets/test/edmPromise.test.ets | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets b/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets index 8b0145670..9b438235e 100644 --- a/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets +++ b/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets @@ -170,7 +170,7 @@ export default function edmCallbackTest() { expect(isEnabled).assertTrue(); try { - var retValue = await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); + await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); console.log('enterpriseDeviceManager.disableAdmin over'); } catch (error) { expect(error != null).assertTrue(); @@ -247,9 +247,11 @@ export default function edmCallbackTest() { let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager(); expect(dsmgr !== null).assertTrue(); console.log('before setDateTime'); - await dsmgr.setDateTime(SELFWANT, 1526003846000, OnReceiveEvent); - async function OnReceiveEvent() { + let currentTime = new Date().getTime(); + await dsmgr.setDateTime(SELFWANT, currentTime, OnReceiveEvent); + async function OnReceiveEvent(error) { await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); + expect(error === null).assertTrue(); done(); } }) diff --git a/customization/edm_xts_stage/entry/src/main/ets/test/edmPromise.test.ets b/customization/edm_xts_stage/entry/src/main/ets/test/edmPromise.test.ets index 98a0fa466..0854b5f9a 100644 --- a/customization/edm_xts_stage/entry/src/main/ets/test/edmPromise.test.ets +++ b/customization/edm_xts_stage/entry/src/main/ets/test/edmPromise.test.ets @@ -284,7 +284,10 @@ export default function edmPromiseTest() { let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager(); expect(dsmgr !== null).assertTrue(); console.log('before setDateTime'); - await dsmgr.setDateTime(SELFWANT, 1526003846000); + let currentTime = new Date().getTime(); + await dsmgr.setDateTime(SELFWANT, currentTime).catch((error)=>{ + expect(error === null).assertTrue(); + }) await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); done(); }) -- GitLab