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 #include <gtest/gtest.h>
16 #include "dhcp_permission_utils.h"
17 #include "dhcp_logger.h"
18
19 DEFINE_DHCPLOG_DHCP_LABEL("DhcpPermissionUtilsTest");
20 using namespace testing::ext;
21 using namespace OHOS::DHCP;
22
23 namespace OHOS {
24 constexpr uint64_t SLEEP_TIME = 2;
25 constexpr int TIMER_TYPE = 1;
26 class DhcpPermissionUtilsTest : public testing::Test {
27 public:
SetUpTestCase()28 static void SetUpTestCase()
29 {}
TearDownTestCase()30 static void TearDownTestCase()
31 {}
SetUp()32 virtual void SetUp()
33 {}
TearDown()34 virtual void TearDown()
35 {}
36 };
37
HWTEST_F(DhcpPermissionUtilsTest, VerifyIsNativeProcessTest, TestSize.Level1)38 HWTEST_F(DhcpPermissionUtilsTest, VerifyIsNativeProcessTest, TestSize.Level1)
39 {
40 DHCP_LOGI("VerifyIsNativeProcessTest enter!");
41 EXPECT_FALSE(DhcpPermissionUtils::VerifyIsNativeProcess());
42 }
43
HWTEST_F(DhcpPermissionUtilsTest, VerifyDhcpNetworkPermissionTest, TestSize.Level1)44 HWTEST_F(DhcpPermissionUtilsTest, VerifyDhcpNetworkPermissionTest, TestSize.Level1)
45 {
46 DHCP_LOGI("VerifyDhcpNetworkPermissionTest enter!");
47 EXPECT_TRUE(DhcpPermissionUtils::VerifyDhcpNetworkPermission("ohos.permission.NETWORK_DHCP"));
48 }
49 }