1 /* 2 * Copyright (C) 2022 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 <cstdint> 17 #include <list> 18 #include <string> 19 #include <sys/time.h> 20 21 #include "sclock_log.h" 22 #include "screenlock_common.h" 23 #include "securec.h" 24 #include "strongauthmanager.h" 25 #include "commeventsubscriber.h" 26 #include "screenlock_strongauth_test.h" 27 28 29 namespace OHOS { 30 namespace ScreenLock { 31 using namespace testing::ext; 32 SetUpTestCase()33void ScreenLockStrongAuthTest::SetUpTestCase() 34 { 35 } 36 TearDownTestCase()37void ScreenLockStrongAuthTest::TearDownTestCase() 38 { 39 } 40 SetUp()41void ScreenLockStrongAuthTest::SetUp() 42 { 43 } 44 TearDown()45void ScreenLockStrongAuthTest::TearDown() 46 { 47 } 48 49 /** 50 * @tc.name: ScreenLockStrongAuthTest001 51 * @tc.desc: ScreenLockStrongAuthTest RmvAll. 52 * @tc.type: FUNC 53 * @tc.require: 54 * @tc.author: 55 */ 56 HWTEST_F(ScreenLockStrongAuthTest, ScreenLockStrongAuthTest001, TestSize.Level0) 57 { 58 SCLOCK_HILOGD("ScreenLockStrongAuthTest"); 59 auto authmanager = DelayedSingleton<StrongAuthManger>::GetInstance(); 60 if (authmanager == nullptr) { 61 SCLOCK_HILOGE("authmanager is nullptr!"); 62 return; 63 } 64 65 int32_t userId = 100; 66 authmanager->RegistUserAuthSuccessEventListener(); 67 authmanager->StartStrongAuthTimer(userId); 68 authmanager->GetTimerId(userId); 69 authmanager->ResetStrongAuthTimer(userId); 70 authmanager->DestroyStrongAuthTimer(userId); 71 authmanager->DestroyAllStrongAuthTimer(); 72 authmanager->UnRegistUserAuthSuccessEventListener(); 73 74 Singleton<CommeventMgr>::GetInstance().SubscribeEvent(); 75 Singleton<CommeventMgr>::GetInstance().UnSubscribeEvent(); 76 return; 77 } 78 79 80 } // namespace ScreenLock 81 } // namespace OHOS 82