From bf2b22ba11a57318ac7b172b30e520b0cd751a34 Mon Sep 17 00:00:00 2001 From: ShiJie Date: Fri, 1 Jul 2022 09:51:44 +0800 Subject: [PATCH] test: system_display.test Change bit asynchronous Signed-off-by: ShiJie Change-Id: I43ca6457fdd0c4cb6911b39b49e08cbb8f96b57e --- .../js/default/test/system_display.test.js | 52 ------------------- 1 file changed, 52 deletions(-) diff --git a/powermgr/display_manager/src/main/js/default/test/system_display.test.js b/powermgr/display_manager/src/main/js/default/test/system_display.test.js index f1b2ef5cd..6e7a911f0 100644 --- a/powermgr/display_manager/src/main/js/default/test/system_display.test.js +++ b/powermgr/display_manager/src/main/js/default/test/system_display.test.js @@ -37,8 +37,6 @@ describe('appInfoTest', function () { * @tc.desc Get brightness success */ it('get_value_success', 0, function () { - let execSucc = false; - let execComplete = false; let currValue = 100; let setValue = 120; brightness.getValue({ @@ -53,7 +51,6 @@ describe('appInfoTest', function () { }); brightness.getValue({ success: (data) => { - execSucc = true; expect(setValue === data.value).assertTrue(); }, fail: (data, code) => { @@ -61,12 +58,9 @@ describe('appInfoTest', function () { expect().assertFail(); }, complete: () => { - execComplete = true; console.log("The device information is obtained successfully. Procedure"); } }); - expect(execSucc).assertTrue(); - expect(execComplete).assertTrue(); brightness.setValue({ value: currValue @@ -79,18 +73,15 @@ describe('appInfoTest', function () { * @tc.desc Get brightness */ it('get_status_test_success_not_must', 0, function () { - let execComplete = false; brightness.getValue({ fail: (data, code) => { console.log("get_status_test_success_not_must, data: " + data + ", code: " + code); expect().assertFail(); }, complete: () => { - execComplete = true; console.log("The device information is obtained successfully. Procedure"); } }); - expect(execComplete).assertTrue(); }) /** @@ -99,14 +90,11 @@ describe('appInfoTest', function () { * @tc.desc Get brightness */ it('get_value_fail_not_must_test', 0, function () { - let execComplete = false; brightness.getValue({ complete: () => { - execComplete = true; console.log("The device information is obtained successfully. Procedure"); } }); - expect(execComplete).assertTrue(); }); /** @@ -125,8 +113,6 @@ describe('appInfoTest', function () { * @tc.desc Set brightness success */ it('set_value_success_all', 0, function () { - let execSucc = false; - let execComplete = false; let setValue = 200; let currValue = 100; brightness.getValue({ @@ -138,7 +124,6 @@ describe('appInfoTest', function () { brightness.setValue({ value: setValue, success: () => { - execSucc = true; brightness.getValue({ success: (data) => { expect(data.value === setValue).assertTrue(); @@ -150,12 +135,9 @@ describe('appInfoTest', function () { expect().assertFail(); }, complete: () => { - execComplete = true; console.log("The device information is obtained successfully. Procedure"); } }); - expect(execSucc).assertTrue(); - expect(execComplete).assertTrue(); brightness.setValue({ value: currValue @@ -212,8 +194,6 @@ describe('appInfoTest', function () { * @tc.desc Get mode success */ it('get_mode_success', 0, function () { - let execSucc = false; - let execComplete = false; let modeVal = 0; let exec = true; brightness.getMode({ @@ -234,7 +214,6 @@ describe('appInfoTest', function () { } brightness.getMode({ success: (data) => { - execSucc = true; expect(data.mode === (modeVal ? 0 : 1)).assertTrue(); }, fail: (data, code) => { @@ -242,12 +221,9 @@ describe('appInfoTest', function () { expect().assertFail(); }, complete: () => { - execComplete = true; console.log("The device information is obtained successfully. Procedure"); } }); - expect(execSucc).assertTrue(); - expect(execComplete).assertTrue(); brightness.setMode({ mode: modeVal }); }) @@ -258,18 +234,15 @@ describe('appInfoTest', function () { * @tc.desc Get mode success is null */ it('get_mode_success_null', 0, function () { - let execComplete = false; brightness.getMode({ fail: (data, code) => { console.log("get_mode_success_null, data: " + data + ", code: " + code); expect().assertFail(); }, complete: () => { - execComplete = true; console.log("The device information is obtained successfully. Procedure"); } }); - expect(execComplete).assertTrue(); }); /** @@ -278,8 +251,6 @@ describe('appInfoTest', function () { * @tc.desc set mode success */ it('set_mode_success', 0, function () { - let execSucc = false; - let execComplete = false; let modeVal = 0; brightness.getMode({ success: (data) => { @@ -290,7 +261,6 @@ describe('appInfoTest', function () { brightness.setMode({ mode: modeVal ? 0 : 1, success: () => { - execSucc = true; console.log("set_mode_success success"); brightness.getMode({ success: (data) => { @@ -305,17 +275,13 @@ describe('appInfoTest', function () { expect().assertFail(); } else { console.log("set_mode_success not supported"); - execSucc = true; expect(isNotSupported(data)).assertTrue(); } }, complete: () => { - execComplete = true; console.log("The device information is obtained successfully. Procedure"); } }); - expect(execSucc).assertTrue(); - expect(execComplete).assertTrue(); brightness.setMode({ mode: modeVal }); }); @@ -326,7 +292,6 @@ describe('appInfoTest', function () { * @tc.desc set mode fail */ it('set_mode_fail', 0, function () { - let execComplete = false; brightness.setMode({ mode: "0", success: () => { @@ -338,11 +303,9 @@ describe('appInfoTest', function () { expect(data === SET_MODE_MSG).assertTrue(); }, complete: () => { - execComplete = true; console.log("The device information is obtained successfully. Procedure"); } }); - expect(execComplete).assertTrue(); }); /** @@ -351,25 +314,17 @@ describe('appInfoTest', function () { * @tc.desc set keep screen on true */ it('set_keep_screen_on_true', 0, async function () { - let execSucc = false; - let execComplete = false; let sleepTime = 35 * 1000; brightness.setKeepScreenOn({ keepScreenOn: true, - success: () => { - execSucc = true; - }, fail: (data, code) => { console.log("set_keep_screen_on, data: " + data + ", code: " + code); expect().assertFail(); }, complete: () => { - execComplete = true; console.log("The device information is obtained successfully. Procedure"); } }); - expect(execSucc).assertTrue(); - expect(execComplete).assertTrue(); await sleep(sleepTime); power.isScreenOn().then(screenOn => { @@ -386,14 +341,9 @@ describe('appInfoTest', function () { * @tc.desc set keep screen on false */ it('set_keep_screen_on_false', 0, async function () { - let execSucc = false; - let execComplete = false; let sleepTime = 35 * 1000; brightness.setKeepScreenOn({ keepScreenOn: false, - success: () => { - execSucc = true; - }, fail: (data, code) => { console.log("set_keep_screen_on_false, data: " + data + ", code: " + code); expect().assertFail(); @@ -403,8 +353,6 @@ describe('appInfoTest', function () { console.log("The device information is obtained successfully. Procedure"); } }); - expect(execSucc).assertTrue(); - expect(execComplete).assertTrue(); await sleep(sleepTime); power.isScreenOn().then(screenOn => { -- GitLab