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_SERVICE_H_
18 #define SHILL_WIFI_MOCK_WIFI_SERVICE_H_
19 
20 #include <string>
21 #include <vector>
22 
23 #include <gmock/gmock.h>
24 
25 #include "shill/wifi/wifi_service.h"
26 
27 namespace shill {
28 
29 class MockWiFiService : public WiFiService {
30  public:
31   MockWiFiService(ControlInterface* control_interface,
32                   EventDispatcher* dispatcher,
33                   Metrics* metrics,
34                   Manager* manager,
35                   WiFiProvider* provider,
36                   const std::vector<uint8_t>& ssid,
37                   const std::string& mode,
38                   const std::string& security,
39                   bool hidden_ssid);
40   ~MockWiFiService() override;
41 
42   MOCK_METHOD2(Configure, void(const KeyValueStore& args, Error* error));
43   MOCK_METHOD1(SetFailure, void(ConnectFailure failure));
44   MOCK_METHOD1(SetFailureSilent, void(ConnectFailure failure));
45   MOCK_METHOD1(SetState, void(ConnectState state));
46   MOCK_METHOD2(AddEAPCertification, bool(const std::string& name,
47                                          size_t depth));
48   MOCK_METHOD0(HasRecentConnectionIssues, bool());
49   MOCK_METHOD0(AddSuspectedCredentialFailure, bool());
50   MOCK_METHOD0(ResetSuspectedCredentialFailures, void());
51   MOCK_METHOD1(AddEndpoint,
52                void(const WiFiEndpointConstRefPtr& endpoint));
53   MOCK_METHOD1(RemoveEndpoint,
54                void(const WiFiEndpointConstRefPtr& endpoint));
55   MOCK_METHOD1(NotifyCurrentEndpoint,
56                void(const WiFiEndpointConstRefPtr& endpoint));
57   MOCK_METHOD1(NotifyEndpointUpdated,
58                void(const WiFiEndpointConstRefPtr& endpoint));
59   MOCK_METHOD3(DisconnectWithFailure,
60                void(ConnectFailure failure, Error* error, const char* reason));
61   MOCK_METHOD1(IsActive, bool(Error* error));
62   MOCK_CONST_METHOD0(IsConnected, bool());
63   MOCK_CONST_METHOD0(IsConnecting, bool());
64   MOCK_CONST_METHOD0(GetEndpointCount, int());
65   MOCK_CONST_METHOD0(HasEndpoints, bool());
66   MOCK_CONST_METHOD0(IsRemembered, bool());
67   MOCK_METHOD0(ResetWiFi, void());
68   MOCK_CONST_METHOD0(GetSupplicantConfigurationParameters, KeyValueStore());
69   MOCK_CONST_METHOD1(IsAutoConnectable, bool(const char** reason));
70   MOCK_CONST_METHOD0(HasStaticIPAddress, bool());
71 
72  private:
73   DISALLOW_COPY_AND_ASSIGN(MockWiFiService);
74 };
75 
76 }  // namespace shill
77 
78 #endif  // SHILL_WIFI_MOCK_WIFI_SERVICE_H_
79