1 /* 2 * Copyright (c) 2022-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 #ifdef GTEST_API_ 19 #define private public 20 #define protected public 21 #endif 22 #include "common_notify_callback_test.h" 23 #include "dhcp_controller.h" 24 #include "notify_callback_stub.h" 25 26 namespace OHOS { 27 namespace nmd { 28 namespace { 29 using namespace testing::ext; 30 using namespace NetsysNative; 31 } // namespace 32 33 class DhcpControllerTest : public testing::Test { 34 public: 35 static void SetUpTestCase(); 36 static void TearDownTestCase(); 37 void SetUp(); 38 void TearDown(); 39 static inline auto instance_ = std::make_shared<DhcpController>(); 40 }; 41 SetUpTestCase()42void DhcpControllerTest::SetUpTestCase() {} 43 TearDownTestCase()44void DhcpControllerTest::TearDownTestCase() {} 45 SetUp()46void DhcpControllerTest::SetUp() {} 47 TearDown()48void DhcpControllerTest::TearDown() {} 49 50 HWTEST_F(DhcpControllerTest, RegisterNotifyCallbackTest001, TestSize.Level1) 51 { 52 sptr<INotifyCallback> callback = new (std::nothrow) NotifyCallbackTest(); 53 auto ret = instance_->RegisterNotifyCallback(callback); 54 ASSERT_EQ(ret, 0); 55 } 56 } // namespace nmd 57 } // namespace OHOS 58