blob: dff6fb8957eb8711037409615e0bd0d1c8ad0d3d [file] [log] [blame]
Thieu Le3426c8f2012-01-11 17:35:11 -08001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Chris Masone626719f2011-08-18 16:58:48 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Wade Guthrie60a37062013-04-02 11:39:09 -07005#ifndef SHILL_MOCK_MANAGER_H_
6#define SHILL_MOCK_MANAGER_H_
Chris Masone626719f2011-08-18 16:58:48 -07007
Alex Vakulenko8a532292014-06-16 17:18:44 -07008#include <string>
Paul Stewart1ce231c2015-06-12 19:44:22 -07009#include <vector>
Alex Vakulenko8a532292014-06-16 17:18:44 -070010
Ben Chancc67c522014-09-03 07:19:18 -070011#include <base/macros.h>
Chris Masone626719f2011-08-18 16:58:48 -070012#include <gmock/gmock.h>
13
14#include "shill/manager.h"
15
16namespace shill {
17
Chris Masone626719f2011-08-18 16:58:48 -070018class MockManager : public Manager {
19 public:
Paul Stewart1e006c62015-06-16 12:29:06 -070020 MockManager(ControlInterface* control_interface,
21 EventDispatcher* dispatcher,
22 Metrics* metrics,
23 GLib* glib);
Ben Chan5ea763b2014-08-13 11:07:54 -070024 ~MockManager() override;
Chris Masone626719f2011-08-18 16:58:48 -070025
Paul Stewart1e006c62015-06-16 12:29:06 -070026 MOCK_METHOD0(device_info, DeviceInfo*());
27 MOCK_METHOD0(modem_info, ModemInfo*());
Peter Qiu1a72f542015-04-14 16:31:36 -070028#if !defined(DISABLE_WIRED_8021X)
Paul Stewart1e006c62015-06-16 12:29:06 -070029 MOCK_CONST_METHOD0(ethernet_eap_provider, EthernetEapProvider*());
Peter Qiu1a72f542015-04-14 16:31:36 -070030#endif // DISABLE_WIRED_8021X
Paul Stewart1e006c62015-06-16 12:29:06 -070031 MOCK_METHOD0(wimax_provider, WiMaxProvider*());
32 MOCK_METHOD0(mutable_store, PropertyStore*());
33 MOCK_CONST_METHOD0(store, const PropertyStore&());
34 MOCK_CONST_METHOD0(run_path, const base::FilePath&());
Thieu Lefb46caf2012-03-08 11:57:15 -080035 MOCK_METHOD0(Start, void());
Thieu Le6c1e3bb2013-02-06 15:20:35 -080036 MOCK_METHOD0(Stop, void());
Paul Stewart1e006c62015-06-16 12:29:06 -070037 MOCK_METHOD3(SetProfileForService, void(const ServiceRefPtr& to_set,
38 const std::string& profile,
39 Error* error));
40 MOCK_METHOD1(RegisterDevice, void(const DeviceRefPtr& to_manage));
41 MOCK_METHOD1(DeregisterDevice, void(const DeviceRefPtr& to_forget));
42 MOCK_METHOD1(HasService, bool(const ServiceRefPtr& to_manage));
43 MOCK_METHOD1(RegisterService, void(const ServiceRefPtr& to_manage));
44 MOCK_METHOD1(UpdateService, void(const ServiceRefPtr& to_update));
45 MOCK_METHOD1(DeregisterService, void(const ServiceRefPtr& to_forget));
Darin Petkova5e07ef2012-07-09 14:27:57 +020046 MOCK_METHOD1(RegisterDefaultServiceCallback,
Paul Stewart1e006c62015-06-16 12:29:06 -070047 int(const ServiceCallback& callback));
Darin Petkova5e07ef2012-07-09 14:27:57 +020048 MOCK_METHOD1(DeregisterDefaultServiceCallback, void(int tag));
Paul Stewart1e006c62015-06-16 12:29:06 -070049 MOCK_METHOD1(UpdateDevice, void(const DeviceRefPtr& to_update));
Wade Guthrie60a37062013-04-02 11:39:09 -070050 MOCK_METHOD0(UpdateWiFiProvider, void());
Paul Stewart7de7e022013-08-28 09:42:50 -070051 MOCK_METHOD1(OnDeviceGeolocationInfoUpdated,
Paul Stewart1e006c62015-06-16 12:29:06 -070052 void(const DeviceRefPtr& device));
53 MOCK_METHOD1(RecheckPortalOnService, void(const ServiceRefPtr& service));
Paul Stewart75225512012-01-26 22:51:33 -080054 MOCK_METHOD2(HandleProfileEntryDeletion,
Paul Stewart1e006c62015-06-16 12:29:06 -070055 bool(const ProfileRefPtr& profile,
56 const std::string& entry_name));
Paul Stewarte2bad7c2012-03-14 08:55:33 -070057 MOCK_CONST_METHOD0(GetDefaultService, ServiceRefPtr());
Peter Qiu18213652015-04-21 16:01:51 -070058 MOCK_METHOD3(GetServiceWithStorageIdentifier,
Paul Stewart1e006c62015-06-16 12:29:06 -070059 ServiceRefPtr(const ProfileRefPtr& profile,
60 const std::string& entry_name,
61 Error* error));
Peter Qiu18213652015-04-21 16:01:51 -070062 MOCK_METHOD3(CreateTemporaryServiceFromProfile,
Paul Stewart1e006c62015-06-16 12:29:06 -070063 ServiceRefPtr(const ProfileRefPtr& profile,
64 const std::string& entry_name,
65 Error* error));
Peter Qiu700de642014-07-14 16:31:30 -070066 MOCK_CONST_METHOD0(IsConnected, bool());
Eric Shienbrood9a245532012-03-07 14:20:39 -050067 MOCK_METHOD0(UpdateEnabledTechnologies, void());
Paul Stewart20088d82012-02-16 06:58:55 -080068 MOCK_METHOD1(IsPortalDetectionEnabled, bool(Technology::Identifier tech));
Paul Stewart10ccbb32012-04-26 15:59:30 -070069 MOCK_CONST_METHOD1(IsServiceEphemeral,
Paul Stewart1e006c62015-06-16 12:29:06 -070070 bool(const ServiceConstRefPtr& service));
Paul Stewart22ce7652014-10-15 21:26:44 -070071 MOCK_CONST_METHOD2(IsProfileBefore,
Paul Stewart1e006c62015-06-16 12:29:06 -070072 bool(const ProfileRefPtr& a,
73 const ProfileRefPtr& b));
Paul Stewart3c504012013-01-17 17:49:58 -080074 MOCK_CONST_METHOD1(IsTechnologyConnected,
75 bool(Technology::Identifier tech));
Paul Stewart036dba02012-08-07 12:34:41 -070076 MOCK_CONST_METHOD1(IsTechnologyLinkMonitorEnabled,
77 bool(Technology::Identifier tech));
Ben Chan8e6b8ef2014-07-14 21:50:18 -070078 MOCK_CONST_METHOD1(IsTechnologyAutoConnectDisabled,
79 bool(Technology::Identifier tech));
Paul Stewart1e006c62015-06-16 12:29:06 -070080 MOCK_CONST_METHOD1(IsDefaultProfile, bool(const StoreInterface* storage));
Wade Guthrie68d41092013-04-02 12:56:02 -070081 MOCK_METHOD3(RequestScan, void(Device::ScanType request_origin,
Paul Stewart1e006c62015-06-16 12:29:06 -070082 const std::string& technology, Error* error));
83 MOCK_CONST_METHOD0(GetPortalCheckURL, const std::string&());
Paul Stewartc681fa02012-03-02 19:40:04 -080084 MOCK_CONST_METHOD0(GetPortalCheckInterval, int());
Samuel Tan2d36a6e2015-02-18 17:12:59 -080085 MOCK_METHOD0(IsSuspending, bool());
Peter Qiua900f4a2015-03-19 09:36:40 -070086 MOCK_CONST_METHOD1(GetEnabledDeviceWithTechnology,
Paul Stewart208a97e2015-05-13 09:11:12 -070087 DeviceRefPtr(Technology::Identifier technology));
Peter Qiua900f4a2015-03-19 09:36:40 -070088 MOCK_CONST_METHOD1(GetEnabledDeviceByLinkName,
Paul Stewart1e006c62015-06-16 12:29:06 -070089 DeviceRefPtr(const std::string& link_name));
Garret Kelly782cdce2015-04-01 16:39:16 -040090 MOCK_CONST_METHOD0(GetMinimumMTU, int());
Paul Stewart208a97e2015-05-13 09:11:12 -070091 MOCK_CONST_METHOD1(ShouldAcceptHostnameFrom,
Paul Stewart1e006c62015-06-16 12:29:06 -070092 bool(const std::string& device_name));
Peter Qiud48fa0c2015-06-10 12:20:48 -070093 MOCK_CONST_METHOD1(IsDHCPv6EnabledForDevice,
Paul Stewart1e006c62015-06-16 12:29:06 -070094 bool(const std::string& device_name));
95 MOCK_METHOD1(AddDeviceToBlackList, void(const std::string& device_name));
Paul Stewart1ce231c2015-06-12 19:44:22 -070096 MOCK_METHOD1(SetDHCPv6EnabledDevices,
Paul Stewart1e006c62015-06-16 12:29:06 -070097 void(const std::vector<std::string>& device_list));
Paul Stewart1ce231c2015-06-12 19:44:22 -070098 MOCK_METHOD2(SetTechnologyOrder,
Paul Stewart1e006c62015-06-16 12:29:06 -070099 void(const std::string& order, Error* error));
Paul Stewart1ce231c2015-06-12 19:44:22 -0700100 MOCK_METHOD1(SetIgnoreUnknownEthernet, void(bool ignore));
Paul Stewart1e006c62015-06-16 12:29:06 -0700101 MOCK_METHOD1(SetStartupPortalList, void(const std::string& portal_list));
Paul Stewart1ce231c2015-06-12 19:44:22 -0700102 MOCK_METHOD0(SetPassiveMode, void());
103 MOCK_METHOD1(SetPrependDNSServers,
Paul Stewart1e006c62015-06-16 12:29:06 -0700104 void(const std::string& prepend_dns_servers));
Paul Stewart1ce231c2015-06-12 19:44:22 -0700105 MOCK_METHOD1(SetMinimumMTU, void(const int mtu));
Paul Stewart1e006c62015-06-16 12:29:06 -0700106 MOCK_METHOD1(SetAcceptHostnameFrom, void(const std::string& hostname_from));
Paul Stewart1ce231c2015-06-12 19:44:22 -0700107 MOCK_CONST_METHOD0(ignore_unknown_ethernet, bool());
108 MOCK_CONST_METHOD1(FilterPrependDNSServersByFamily,
109 std::vector<std::string>(IPAddress::Family family));
Chris Masone626719f2011-08-18 16:58:48 -0700110
Paul Stewartd4f26482014-04-25 19:12:03 -0700111 // Getter and setter for a mocked device info instance.
Paul Stewart1e006c62015-06-16 12:29:06 -0700112 DeviceInfo* mock_device_info() { return mock_device_info_; }
113 void set_mock_device_info(DeviceInfo* mock_device_info) {
Paul Stewartd4f26482014-04-25 19:12:03 -0700114 mock_device_info_ = mock_device_info;
115 }
116
Chris Masone626719f2011-08-18 16:58:48 -0700117 private:
Paul Stewart1e006c62015-06-16 12:29:06 -0700118 DeviceInfo* mock_device_info_;
Paul Stewartd4f26482014-04-25 19:12:03 -0700119
Chris Masone626719f2011-08-18 16:58:48 -0700120 DISALLOW_COPY_AND_ASSIGN(MockManager);
121};
122
123} // namespace shill
124
Wade Guthrie60a37062013-04-02 11:39:09 -0700125#endif // SHILL_MOCK_MANAGER_H_