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_MOCK_DEVICE_H_ 18 #define SHILL_MOCK_DEVICE_H_ 19 20 #include <string> 21 #include <vector> 22 23 #include <base/memory/ref_counted.h> 24 #include <gmock/gmock.h> 25 26 #include "shill/device.h" 27 #include "shill/geolocation_info.h" 28 29 namespace shill { 30 31 class MockDevice : public Device { 32 public: 33 MockDevice(ControlInterface* control_interface, 34 EventDispatcher* dispatcher, 35 Metrics* metrics, 36 Manager* manager, 37 const std::string& link_name, 38 const std::string& address, 39 int interface_index); 40 ~MockDevice() override; 41 42 MOCK_METHOD0(Initialize, void()); 43 MOCK_METHOD2(Start, void(Error* error, 44 const EnabledStateChangedCallback& callback)); 45 MOCK_METHOD2(Stop, void(Error* error, 46 const EnabledStateChangedCallback& callback)); 47 MOCK_METHOD1(SetEnabled, void(bool)); 48 MOCK_METHOD3(SetEnabledPersistent, void(bool enable, 49 Error* error, 50 const ResultCallback& callback)); 51 MOCK_METHOD3(SetEnabledNonPersistent, void(bool enable, 52 Error* error, 53 const ResultCallback& callback)); 54 MOCK_METHOD3(Scan, void(Device::ScanType scan_type, Error* error, 55 const std::string& reason)); 56 MOCK_METHOD1(Load, bool(StoreInterface* storage)); 57 MOCK_METHOD1(Save, bool(StoreInterface* storage)); 58 MOCK_METHOD0(DisableIPv6, void()); 59 MOCK_METHOD0(EnableIPv6, void()); 60 MOCK_METHOD0(EnableIPv6Privacy, void()); 61 MOCK_METHOD1(SetLooseRouting, void(bool)); 62 MOCK_METHOD1(SetIsMultiHomed, void(bool is_multi_homed)); 63 MOCK_METHOD0(RestartPortalDetection, bool()); 64 MOCK_METHOD0(RequestPortalDetection, bool()); 65 MOCK_METHOD0(GetReceiveByteCount, uint64_t()); 66 MOCK_METHOD0(GetTransmitByteCount, uint64_t()); 67 MOCK_CONST_METHOD1(IsConnectedToService, bool(const ServiceRefPtr& service)); 68 MOCK_CONST_METHOD0(technology, Technology::Identifier()); 69 MOCK_METHOD1(OnBeforeSuspend, void(const ResultCallback& callback)); 70 MOCK_METHOD1(OnDarkResume, void(const ResultCallback& callback)); 71 MOCK_METHOD0(OnAfterResume, void()); 72 MOCK_METHOD0(OnConnectionUpdated, void()); 73 MOCK_METHOD0(OnIPv6AddressChanged, void()); 74 MOCK_CONST_METHOD0(GetGeolocationObjects, std::vector<GeolocationInfo>()); 75 MOCK_METHOD0(OnIPv6DnsServerAddressesChanged, void()); 76 MOCK_METHOD0(StartConnectivityTest, bool()); 77 MOCK_CONST_METHOD0(connection, const ConnectionRefPtr&()); 78 79 private: 80 DISALLOW_COPY_AND_ASSIGN(MockDevice); 81 }; 82 83 } // namespace shill 84 85 #endif // SHILL_MOCK_DEVICE_H_ 86