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_CONNECTION_H_ 18 #define SHILL_MOCK_CONNECTION_H_ 19 20 #include <string> 21 #include <vector> 22 23 #include <base/macros.h> 24 #include <gmock/gmock.h> 25 26 #include "shill/connection.h" 27 28 namespace shill { 29 30 class MockConnection : public Connection { 31 public: 32 explicit MockConnection(const DeviceInfo* device_info); 33 ~MockConnection() override; 34 35 MOCK_METHOD1(UpdateFromIPConfig, void(const IPConfigRefPtr& config)); 36 MOCK_CONST_METHOD0(GetLowerConnection, ConnectionRefPtr()); 37 MOCK_CONST_METHOD0(is_default, bool()); 38 MOCK_METHOD1(SetIsDefault, void(bool is_default)); 39 MOCK_CONST_METHOD0(ipconfig_rpc_identifier, const std::string&()); 40 MOCK_METHOD0(RequestRouting, void()); 41 MOCK_METHOD0(ReleaseRouting, void()); 42 MOCK_CONST_METHOD0(interface_name, const std::string&()); 43 MOCK_CONST_METHOD0(dns_servers, const std::vector<std::string>&()); 44 MOCK_METHOD1(RequestHostRoute, bool(const IPAddress& destination)); 45 MOCK_METHOD2(PinPendingRoutes, 46 bool(int interface_index, RoutingTableEntry entry)); 47 MOCK_CONST_METHOD0(local, const IPAddress&()); 48 MOCK_CONST_METHOD0(gateway, const IPAddress&()); 49 MOCK_CONST_METHOD0(technology, Technology::Identifier()); 50 MOCK_METHOD0(CreateGatewayRoute, bool()); 51 MOCK_METHOD0(GetCarrierConnection, ConnectionRefPtr()); 52 MOCK_CONST_METHOD0(tethering, std::string&()); 53 MOCK_METHOD1(UpdateDNSServers, 54 void(const std::vector<std::string>& dns_servers)); 55 MOCK_METHOD0(IsIPv6, bool()); 56 MOCK_CONST_METHOD0(GetSubnetName, std::string()); 57 58 private: 59 DISALLOW_COPY_AND_ASSIGN(MockConnection); 60 }; 61 62 } // namespace shill 63 64 #endif // SHILL_MOCK_CONNECTION_H_ 65