1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <gtest/gtest.h> 17 18 #include "unlock_screen_manager.h" 19 #include "ability_manager_service.h" 20 #include "screenlock_manager.h" 21 22 using namespace testing; 23 using namespace testing::ext; 24 25 namespace OHOS { 26 namespace AbilityRuntime { 27 28 class UnlockScreenTest : public testing::Test { 29 public: 30 static void SetUpTestCase(void); 31 static void TearDownTestCase(void); 32 void SetUp(); 33 void TearDown(); 34 }; 35 SetUpTestCase(void)36void UnlockScreenTest::SetUpTestCase(void) 37 {} TearDownTestCase(void)38void UnlockScreenTest::TearDownTestCase(void) 39 {} SetUp()40void UnlockScreenTest::SetUp() 41 {} TearDown()42void UnlockScreenTest::TearDown() 43 {} 44 45 /* 46 * Feature: UnlockScreenTest 47 * Function: UnlockScreen 48 * SubFunction: NA 49 * FunctionPoints:UnlockScreenTest UnlockScreen 50 * EnvConditions: NA 51 * CaseDescription: Verify UnlockScreen 52 */ 53 HWTEST_F(UnlockScreenTest, UnlockScreen_001, TestSize.Level1) 54 { 55 bool isScreenLocked = OHOS::ScreenLock::ScreenLockManager::GetInstance()->IsScreenLocked(); 56 bool ret = UnlockScreenManager::GetInstance().UnlockScreen(); 57 if (isScreenLocked) { 58 EXPECT_EQ(ret, false); 59 } else { 60 EXPECT_EQ(ret, true); 61 } 62 } 63 } // namespace AbilityRuntime 64 } // namespace OHOS