From 4e3b89670d88ead52421f63f1a8947577d1d8e70 Mon Sep 17 00:00:00 2001 From: zhang Date: Thu, 21 Oct 2021 17:28:15 +0800 Subject: [PATCH 1/5] modify test cases Signed-off-by: zhang --- .../native/unittest/src/display_power_mgr_service_test.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/native/unittest/src/display_power_mgr_service_test.cpp b/test/native/unittest/src/display_power_mgr_service_test.cpp index fc0e17c..80bd6e3 100644 --- a/test/native/unittest/src/display_power_mgr_service_test.cpp +++ b/test/native/unittest/src/display_power_mgr_service_test.cpp @@ -26,7 +26,7 @@ using namespace OHOS; using namespace OHOS::DisplayPowerMgr; namespace { -#ifdef IPC_AVAILABLE + /** * @tc.name: DisplayPowerMgrService01 * @tc.desc: Test DisplayPowerMgrService service ready. @@ -34,10 +34,13 @@ namespace { */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService01, TestSize.Level0) { + #ifdef IPC_AVAILABLE sptr sam = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); EXPECT_TRUE(sam != nullptr) << "DisplayPowerMgrService01 fail to get GetSystemAbilityManager"; sptr remoteObject_ = sam->CheckSystemAbility(DISPLAY_MANAGER_SERVICE_ID); EXPECT_TRUE(remoteObject_ != nullptr) << "GetSystemAbility failed."; + #endif // IPC_AVAILABLE + EXPECT_TRUE(true); } /** @@ -135,5 +138,5 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService008, TestSize.Level0) DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_SUSPEND); } -#endif // IPC_AVAILABLE + } \ No newline at end of file -- Gitee From 30176c2460f01a1e4dbcb9617c95d9e5238dc99f Mon Sep 17 00:00:00 2001 From: zhang Date: Thu, 21 Oct 2021 18:39:00 +0800 Subject: [PATCH 2/5] modify test case Signed-off-by: zhang --- .../src/display_power_mgr_service_test.cpp | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/test/native/unittest/src/display_power_mgr_service_test.cpp b/test/native/unittest/src/display_power_mgr_service_test.cpp index 80bd6e3..db07847 100644 --- a/test/native/unittest/src/display_power_mgr_service_test.cpp +++ b/test/native/unittest/src/display_power_mgr_service_test.cpp @@ -34,12 +34,12 @@ namespace { */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService01, TestSize.Level0) { - #ifdef IPC_AVAILABLE + #ifdef IPC_AVAILABLE sptr sam = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); EXPECT_TRUE(sam != nullptr) << "DisplayPowerMgrService01 fail to get GetSystemAbilityManager"; sptr remoteObject_ = sam->CheckSystemAbility(DISPLAY_MANAGER_SERVICE_ID); EXPECT_TRUE(remoteObject_ != nullptr) << "GetSystemAbility failed."; - #endif // IPC_AVAILABLE + #endif // IPC_AVAILABLE EXPECT_TRUE(true); } @@ -50,9 +50,12 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService01, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService002, TestSize.Level0) { + #ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_OFF); sleep(5); EXPECT_TRUE(ret); + #endif // IPC_AVAILABLE + EXPECT_TRUE(true); } /** @@ -62,9 +65,12 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService002, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService003, TestSize.Level0) { + #ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_ON); sleep(5); EXPECT_TRUE(ret); + #endif // IPC_AVAILABLE + EXPECT_TRUE(true); } /** @@ -74,12 +80,15 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService003, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService004, TestSize.Level0) { + #ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetBrightness(5); sleep(5); EXPECT_TRUE(ret); ret = DisplayPowerMgrClient::GetInstance().SetBrightness(255); sleep(5); EXPECT_TRUE(ret); + #endif // IPC_AVAILABLE + EXPECT_TRUE(true); } @@ -90,11 +99,14 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService004, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService005, TestSize.Level0) { + #ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_ON); sleep(5); EXPECT_TRUE(ret); DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_ON); + #endif // IPC_AVAILABLE + EXPECT_TRUE(true); } /** @@ -104,11 +116,14 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService005, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService006, TestSize.Level0) { + #ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_DIM); sleep(5); EXPECT_TRUE(ret); DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_DIM); + #endif // IPC_AVAILABLE + EXPECT_TRUE(true); } /** @@ -118,11 +133,14 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService006, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService007, TestSize.Level0) { + #ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_OFF); sleep(5); EXPECT_TRUE(ret); DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_OFF); + #endif // IPC_AVAILABLE + EXPECT_TRUE(true); } /** @@ -132,11 +150,13 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService007, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService008, TestSize.Level0) { + #ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_SUSPEND); sleep(5); EXPECT_TRUE(ret); DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_SUSPEND); + #endif // IPC_AVAILABLE + EXPECT_TRUE(true); } - } \ No newline at end of file -- Gitee From 0e38c81b713063d227a110486c54e870ddca84f5 Mon Sep 17 00:00:00 2001 From: zhang Date: Thu, 21 Oct 2021 18:40:17 +0800 Subject: [PATCH 3/5] modify test case Signed-off-by: zhang --- .../src/display_power_mgr_service_test.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/native/unittest/src/display_power_mgr_service_test.cpp b/test/native/unittest/src/display_power_mgr_service_test.cpp index db07847..3d8e4ee 100644 --- a/test/native/unittest/src/display_power_mgr_service_test.cpp +++ b/test/native/unittest/src/display_power_mgr_service_test.cpp @@ -40,7 +40,7 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService01, TestSize.Level0) sptr remoteObject_ = sam->CheckSystemAbility(DISPLAY_MANAGER_SERVICE_ID); EXPECT_TRUE(remoteObject_ != nullptr) << "GetSystemAbility failed."; #endif // IPC_AVAILABLE - EXPECT_TRUE(true); + EXPECT_TRUE(true); } /** @@ -55,7 +55,7 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService002, TestSize.Level0) sleep(5); EXPECT_TRUE(ret); #endif // IPC_AVAILABLE - EXPECT_TRUE(true); + EXPECT_TRUE(true); } /** @@ -70,7 +70,7 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService003, TestSize.Level0) sleep(5); EXPECT_TRUE(ret); #endif // IPC_AVAILABLE - EXPECT_TRUE(true); + EXPECT_TRUE(true); } /** @@ -88,7 +88,7 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService004, TestSize.Level0) sleep(5); EXPECT_TRUE(ret); #endif // IPC_AVAILABLE - EXPECT_TRUE(true); + EXPECT_TRUE(true); } @@ -106,7 +106,7 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService005, TestSize.Level0) DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_ON); #endif // IPC_AVAILABLE - EXPECT_TRUE(true); + EXPECT_TRUE(true); } /** @@ -123,7 +123,7 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService006, TestSize.Level0) DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_DIM); #endif // IPC_AVAILABLE - EXPECT_TRUE(true); + EXPECT_TRUE(true); } /** @@ -140,7 +140,7 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService007, TestSize.Level0) DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_OFF); #endif // IPC_AVAILABLE - EXPECT_TRUE(true); + EXPECT_TRUE(true); } /** @@ -157,6 +157,6 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService008, TestSize.Level0) DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_SUSPEND); #endif // IPC_AVAILABLE - EXPECT_TRUE(true); + EXPECT_TRUE(true); } } \ No newline at end of file -- Gitee From dfe4bfbfa289bb379665c3588e6e43d6d36380f7 Mon Sep 17 00:00:00 2001 From: zhang Date: Thu, 21 Oct 2021 19:08:03 +0800 Subject: [PATCH 4/5] modify test case Signed-off-by: zhang --- .../src/display_power_mgr_service_test.cpp | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/native/unittest/src/display_power_mgr_service_test.cpp b/test/native/unittest/src/display_power_mgr_service_test.cpp index 3d8e4ee..cf15dc2 100644 --- a/test/native/unittest/src/display_power_mgr_service_test.cpp +++ b/test/native/unittest/src/display_power_mgr_service_test.cpp @@ -34,12 +34,12 @@ namespace { */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService01, TestSize.Level0) { - #ifdef IPC_AVAILABLE +#ifdef IPC_AVAILABLE sptr sam = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); EXPECT_TRUE(sam != nullptr) << "DisplayPowerMgrService01 fail to get GetSystemAbilityManager"; sptr remoteObject_ = sam->CheckSystemAbility(DISPLAY_MANAGER_SERVICE_ID); EXPECT_TRUE(remoteObject_ != nullptr) << "GetSystemAbility failed."; - #endif // IPC_AVAILABLE +#endif // IPC_AVAILABLE EXPECT_TRUE(true); } @@ -50,11 +50,11 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService01, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService002, TestSize.Level0) { - #ifdef IPC_AVAILABLE +#ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_OFF); sleep(5); EXPECT_TRUE(ret); - #endif // IPC_AVAILABLE +#endif // IPC_AVAILABLE EXPECT_TRUE(true); } @@ -65,11 +65,11 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService002, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService003, TestSize.Level0) { - #ifdef IPC_AVAILABLE +#ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_ON); sleep(5); EXPECT_TRUE(ret); - #endif // IPC_AVAILABLE +#endif // IPC_AVAILABLE EXPECT_TRUE(true); } @@ -80,14 +80,14 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService003, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService004, TestSize.Level0) { - #ifdef IPC_AVAILABLE +#ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetBrightness(5); sleep(5); EXPECT_TRUE(ret); ret = DisplayPowerMgrClient::GetInstance().SetBrightness(255); sleep(5); EXPECT_TRUE(ret); - #endif // IPC_AVAILABLE +#endif // IPC_AVAILABLE EXPECT_TRUE(true); } @@ -99,13 +99,13 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService004, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService005, TestSize.Level0) { - #ifdef IPC_AVAILABLE +#ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_ON); sleep(5); EXPECT_TRUE(ret); DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_ON); - #endif // IPC_AVAILABLE +#endif // IPC_AVAILABLE EXPECT_TRUE(true); } @@ -116,13 +116,13 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService005, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService006, TestSize.Level0) { - #ifdef IPC_AVAILABLE +#ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_DIM); sleep(5); EXPECT_TRUE(ret); DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_DIM); - #endif // IPC_AVAILABLE +#endif // IPC_AVAILABLE EXPECT_TRUE(true); } @@ -133,13 +133,13 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService006, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService007, TestSize.Level0) { - #ifdef IPC_AVAILABLE +#ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_OFF); sleep(5); EXPECT_TRUE(ret); DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_OFF); - #endif // IPC_AVAILABLE +#endif // IPC_AVAILABLE EXPECT_TRUE(true); } @@ -150,13 +150,13 @@ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService007, TestSize.Level0) */ HWTEST_F(DisplayPowerMgrServiceTest, DisplayPowerMgrService008, TestSize.Level0) { - #ifdef IPC_AVAILABLE +#ifdef IPC_AVAILABLE auto ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(DisplayState::DISPLAY_SUSPEND); sleep(5); EXPECT_TRUE(ret); DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); EXPECT_TRUE(state == DisplayState::DISPLAY_SUSPEND); - #endif // IPC_AVAILABLE +#endif // IPC_AVAILABLE EXPECT_TRUE(true); } } \ No newline at end of file -- Gitee From def3a8daf3bd451ac11b5d94ee1e53cec641b3c3 Mon Sep 17 00:00:00 2001 From: zhang Date: Thu, 21 Oct 2021 19:09:34 +0800 Subject: [PATCH 5/5] modify test cases Signed-off-by: zhang --- test/native/unittest/src/display_power_mgr_service_test.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/native/unittest/src/display_power_mgr_service_test.cpp b/test/native/unittest/src/display_power_mgr_service_test.cpp index cf15dc2..0ef9d66 100644 --- a/test/native/unittest/src/display_power_mgr_service_test.cpp +++ b/test/native/unittest/src/display_power_mgr_service_test.cpp @@ -26,7 +26,6 @@ using namespace OHOS; using namespace OHOS::DisplayPowerMgr; namespace { - /** * @tc.name: DisplayPowerMgrService01 * @tc.desc: Test DisplayPowerMgrService service ready. -- Gitee