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 "authorize_helper.h"
19 #include "mmi_log.h"
20
21 #undef MMI_LOG_TAG
22 #define MMI_LOG_TAG "AuthorizeHelperTest"
23
24 namespace OHOS {
25 namespace MMI {
26 namespace {
27 using namespace testing::ext;
28 } // namespace
29
30 class AuthorizeHelperTest : public testing::Test {
31 public:
SetUpTestCase(void)32 static void SetUpTestCase(void) {}
TearDownTestCase(void)33 static void TearDownTestCase(void) {}
SetUp()34 void SetUp() {}
TearDown()35 void TearDown() {}
36 };
37
AuthorizeExitFunTest(int32_t)38 void AuthorizeExitFunTest(int32_t) {}
39
40 /**
41 * @tc.name: AuthorizeHelperTest_OnClientDeath
42 * @tc.desc: Test OnClientDeath
43 * @tc.type: FUNC
44 * @tc.require:
45 */
46 HWTEST_F(AuthorizeHelperTest, ClientDeathHandlerTest_OnClientDeath, TestSize.Level1)
47 {
48 CALL_TEST_DEBUG;
49 AuthorizeHelper authorizeHelper;
50 int32_t pid = 10;
51 authorizeHelper.pid_ = 11;
52 EXPECT_NO_FATAL_FAILURE(authorizeHelper.OnClientDeath(pid));
53 pid = 11;
54 EXPECT_NO_FATAL_FAILURE(authorizeHelper.OnClientDeath(pid));
55 }
56
57 /**
58 * @tc.name: AuthorizeHelperTest_AuthorizeProcessExit
59 * @tc.desc: Test AuthorizeProcessExit
60 * @tc.type: FUNC
61 * @tc.require:
62 */
63 HWTEST_F(AuthorizeHelperTest, AuthorizeHelperTest_AuthorizeProcessExit, TestSize.Level1)
64 {
65 CALL_TEST_DEBUG;
66 AuthorizeHelper authorizeHelper;
67 authorizeHelper.exitCallback_ = AuthorizeExitFunTest;
68 EXPECT_NO_FATAL_FAILURE(authorizeHelper.AuthorizeProcessExit());
69 }
70
71 /**
72 * @tc.name: AuthorizeHelperTest_AuthorizeProcessExit_001
73 * @tc.desc: Test AuthorizeProcessExit
74 * @tc.type: FUNC
75 * @tc.require:
76 */
77 HWTEST_F(AuthorizeHelperTest, AuthorizeHelperTest_AuthorizeProcessExit_001, TestSize.Level1)
78 {
79 CALL_TEST_DEBUG;
80 AuthorizeHelper authorizeHelper;
81 EXPECT_NO_FATAL_FAILURE(authorizeHelper.AuthorizeProcessExit());
82 }
83 } // namespace MMI
84 } // namespace OHOS