1 /*
2 * Copyright (C) 2025 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 "thread_handler_impl_test.h"
17
18 #include "thread_handler_impl.h"
19
20 #include <cstdint>
21 #include <functional>
22 #include <future>
23 #include <memory>
24
25 #include "nocopyable.h"
26 #include "thread_handler_manager.h"
27
28 #include "iam_logger.h"
29
30 #define LOG_TAG "USER_AUTH_SA"
31
32 namespace OHOS {
33 namespace UserIam {
34 namespace UserAuth {
35 using namespace testing;
36 using namespace testing::ext;
37
SetUpTestCase()38 void ThreadHandlerImplTest::SetUpTestCase()
39 {
40 }
41
TearDownTestCase()42 void ThreadHandlerImplTest::TearDownTestCase()
43 {
44 }
45
SetUp()46 void ThreadHandlerImplTest::SetUp()
47 {
48 }
49
TearDown()50 void ThreadHandlerImplTest::TearDown()
51 {
52 }
53
54 HWTEST_F(ThreadHandlerImplTest, PostTaskTest001, TestSize.Level3)
55 {
56 std::string name = "";
57 ThreadHandlerImpl impl(name, false);
__anon1f0b9c240102() 58 EXPECT_NO_THROW(impl.PostTask([]() {}));
59 }
60
61 HWTEST_F(ThreadHandlerImplTest, PostTaskTest002, TestSize.Level3)
62 {
63 std::string name = "";
64 ThreadHandlerImpl impl(name, true);
__anon1f0b9c240202() 65 EXPECT_NO_THROW(impl.PostTask([]() {}));
66 }
67
68 HWTEST_F(ThreadHandlerImplTest, EnsureTaskTest001, TestSize.Level3)
69 {
70 std::string name = "";
71 ThreadHandlerImpl impl(name, true);
__anon1f0b9c240302() 72 EXPECT_NO_THROW(impl.EnsureTask([]() {}));
73 }
74
75 HWTEST_F(ThreadHandlerImplTest, SuspendTest001, TestSize.Level3)
76 {
77 std::string name = "";
78 ThreadHandlerImpl impl(name, true);
79 EXPECT_NO_THROW(impl.Suspend());
80 }
81
82 HWTEST_F(ThreadHandlerImplTest, SuspendTest002, TestSize.Level3)
83 {
84 std::string name = "";
85 ThreadHandlerImpl impl(name, false);
86 EXPECT_NO_THROW(impl.Suspend());
87 }
88
89 } // namespace UserAuth
90 } // namespace UserIam
91 } // namespace OHOS
92