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_logger.h" 17 #include "dhcp_result_store_manager.h" 18 19 DEFINE_DHCPLOG_DHCP_LABEL("DhcpResultStoreManagerTest"); 20 21 using namespace testing::ext; 22 23 namespace OHOS { 24 class DhcpResultStoreManagerTest : public testing::Test { 25 public: SetUpTestCase()26 static void SetUpTestCase() 27 {} TearDownTestCase()28 static void TearDownTestCase() 29 {} SetUp()30 virtual void SetUp() 31 {} TearDown()32 virtual void TearDown() 33 {} 34 }; 35 /** 36 * @tc.name: SaveIpInfoInLocalFile_SUCCESS 37 * @tc.desc: SaveIpInfoInLocalFile 38 * @tc.type: FUNC 39 * @tc.require: issue 40 */ 41 HWTEST_F(DhcpResultStoreManagerTest, SaveIpInfoInLocalFile_SUCCESS, TestSize.Level1) 42 { 43 DHCP_LOGE("enter SaveIpInfoInLocalFile_SUCCESS"); 44 IpInfoCached ipInfoCached; 45 ipInfoCached.bssid = "12:34:56:48:78:56"; 46 ipInfoCached.absoluteLeasetime = 1; 47 DHCP::DhcpResultStoreManager::GetInstance().SaveIpInfoInLocalFile(ipInfoCached); 48 } 49 /** 50 * @tc.name: GetCachedDhcpResult_SUCCESS 51 * @tc.desc: GetCachedDhcpResult 52 * @tc.type: FUNC 53 * @tc.require: issue 54 */ 55 HWTEST_F(DhcpResultStoreManagerTest, GetCachedDhcpResult_SUCCESS, TestSize.Level1) 56 { 57 DHCP_LOGE("enter GetCachedDhcpResult_SUCCESS"); 58 std::string targetBssid = "12:34:56:48:78:56"; 59 IpInfoCached ipInfo; 60 DHCP::DhcpResultStoreManager::GetInstance().GetCachedIp(targetBssid, ipInfo); 61 } 62 } // namespace OHOS