• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2012 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef SHILL_WIFI_MOCK_WIFI_H_
18 #define SHILL_WIFI_MOCK_WIFI_H_
19 
20 #include <map>
21 #include <string>
22 
23 #include <base/memory/ref_counted.h>
24 #include <gmock/gmock.h>
25 
26 #include "shill/key_value_store.h"
27 #include "shill/refptr_types.h"
28 #include "shill/wifi/wifi.h"
29 #include "shill/wifi/wifi_endpoint.h"
30 #include "shill/wifi/wifi_service.h"
31 
32 namespace shill {
33 
34 class ControlInterface;
35 class Error;
36 class EventDispatcher;
37 
38 class MockWiFi : public WiFi {
39  public:
40   MockWiFi(ControlInterface* control_interface,
41            EventDispatcher* dispatcher,
42            Metrics* metrics,
43            Manager* manager,
44            const std::string& link_name,
45            const std::string& address,
46            int interface_index);
47   ~MockWiFi() override;
48 
49   MOCK_METHOD2(Start, void(Error* error,
50                            const EnabledStateChangedCallback& callback));
51   MOCK_METHOD2(Stop, void(Error* error,
52                           const EnabledStateChangedCallback& callback));
53   MOCK_METHOD3(Scan, void(ScanType scan_type, Error* error,
54                           const std::string& reason));
55   MOCK_METHOD1(DisconnectFromIfActive, void(WiFiService* service));
56   MOCK_METHOD1(DisconnectFrom, void(WiFiService* service));
57   MOCK_METHOD1(ClearCachedCredentials, void(const WiFiService* service));
58   MOCK_METHOD1(ConnectTo, void(WiFiService* service));
59   MOCK_CONST_METHOD0(IsIdle, bool());
60   MOCK_METHOD1(NotifyEndpointChanged,
61                void(const WiFiEndpointConstRefPtr& endpoint));
62   MOCK_METHOD1(DestroyIPConfigLease, void(const std::string&));
63   MOCK_CONST_METHOD0(IsConnectedViaTether, bool());
64 
65  private:
66   DISALLOW_COPY_AND_ASSIGN(MockWiFi);
67 };
68 
69 }  // namespace shill
70 
71 #endif  // SHILL_WIFI_MOCK_WIFI_H_
72