• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-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 "net_factoryreset_callback_test.h"
17 
18 #include <iostream>
19 #include <gtest/gtest.h>
20 
21 #ifdef GTEST_API_
22 #define private public
23 #endif
24 
25 #include "net_factoryreset_callback.h"
26 
27 namespace OHOS {
28 namespace NetManagerStandard {
29 using namespace testing::ext;
30 
NetFactoryResetCallbackTest()31 NetFactoryResetCallbackTest::NetFactoryResetCallbackTest() {}
32 
~NetFactoryResetCallbackTest()33 NetFactoryResetCallbackTest::~NetFactoryResetCallbackTest() {}
34 
35 
OnNetFactoryReset()36 int32_t NetFactoryResetCallbackTest::OnNetFactoryReset()
37 {
38     std::cout << "NetFactoryResetCallbackTest::OnNetFactoryReset"<< std::endl;
39     return 0;
40 }
41 
42 class NetFactoryResetCallbackBranchTest : public testing::Test {
43 public:
44     static void SetUpTestCase();
45     static void TearDownTestCase();
46     void SetUp();
47     void TearDown();
48 };
49 
SetUpTestCase()50 void NetFactoryResetCallbackBranchTest::SetUpTestCase() {}
51 
TearDownTestCase()52 void NetFactoryResetCallbackBranchTest::TearDownTestCase() {}
53 
SetUp()54 void NetFactoryResetCallbackBranchTest::SetUp() {}
55 
TearDown()56 void NetFactoryResetCallbackBranchTest::TearDown() {}
57 
58 HWTEST_F(NetFactoryResetCallbackBranchTest, NetFactoryResetCallbackBranchTest001, TestSize.Level1)
59 {
60     NetFactoryResetCallback callback;
61     sptr<INetFactoryResetCallback> resetCallback = nullptr;
62     int32_t ret = callback.UnregisterNetFactoryResetCallbackAsync(resetCallback);
63     EXPECT_EQ(ret, NETMANAGER_ERR_PARAMETER_ERROR);
64 
65     ret = callback.UnregisterNetFactoryResetCallback(resetCallback);
66     EXPECT_EQ(ret, NETMANAGER_SUCCESS);
67 }
68 } // namespace NetManagerStandard
69 } // namespace OHOS
70