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 <gtest/gtest.h>
17
18#include "permission.h"
19
20#include <accesstoken_kit.h>
21#include <bundle_constants.h>
22#include <ipc_skeleton.h>
23#include <bundle_mgr_proxy.h>
24#include <bundle_mgr_interface.h>
25#include <system_ability_definition.h>
26#include <iservice_registry.h>
27#include <tokenid_kit.h>
28
29#include "window_manager_hilog.h"
30
31using namespace testing;
32using namespace testing::ext;
33
34namespace OHOS {
35namespace Rosen {
36class PermissionTest : public testing::Test {
37public:
38    static void SetUpTestCase();
39    static void TearDownTestCase();
40    void SetUp() override;
41    void TearDown() override;
42};
43
44void PermissionTest::SetUpTestCase()
45{
46}
47
48void PermissionTest::TearDownTestCase()
49{
50}
51
52void PermissionTest::SetUp()
53{
54}
55
56void PermissionTest::TearDown()
57{
58}
59
60namespace {
61/**
62 * @tc.name: IsSystemServiceCalling
63 * @tc.desc: test fuction : IsSystemServiceCalling
64 * @tc.type: FUNC
65 */
66HWTEST_F(PermissionTest, IsSystemServiceCalling, Function | SmallTest | Level2)
67{
68    bool result = Permission::IsSystemServiceCalling(true, true);
69    ASSERT_EQ(true, result);
70}
71/**
72 * @tc.name: IsSystemCallingOrStartByHdcd
73 * @tc.desc: test fuction : IsSystemCallingOrStartByHdcd
74 * @tc.type: FUNC
75 */
76HWTEST_F(PermissionTest, IsSystemCallingOrStartByHdcd, Function | SmallTest | Level2)
77{
78    bool result1 = Permission::IsSystemCallingOrStartByHdcd(false);
79    ASSERT_EQ(true, result1);
80    bool result2 = Permission::IsSystemCallingOrStartByHdcd(true);
81    ASSERT_EQ(true, result2);
82}
83/**
84 * @tc.name: IsStartByInputMethod
85 * @tc.desc: test fuction : IsStartByInputMethod
86 * @tc.type: FUNC
87 */
88HWTEST_F(PermissionTest, IsStartByInputMethod, Function | SmallTest | Level2)
89{
90    bool result = Permission::IsStartByInputMethod();
91    ASSERT_EQ(false, result);
92}
93/**
94 * @tc.name: CheckIsCallingBundleName
95 * @tc.desc: test fuction : CheckIsCallingBundleName
96 * @tc.type: FUNC
97 */
98HWTEST_F(PermissionTest, CheckIsCallingBundleName, Function | SmallTest | Level2)
99{
100    bool result = Permission::CheckIsCallingBundleName("err");
101    ASSERT_EQ(false, result);
102}
103}
104}
105}