1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_MOCK_WIFI_MANAGER_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_MOCK_WIFI_MANAGER_H_
8 #include "base/observer_list.h"
9 #include "chrome/browser/local_discovery/wifi/wifi_manager.h"
10 #include "testing/gmock/include/gmock/gmock.h"
12 namespace local_discovery
{
16 class MockWifiManager
: public WifiManager
{
21 MOCK_METHOD0(Start
, void());
23 virtual void GetSSIDList(const SSIDListCallback
& callback
) OVERRIDE
;
25 MOCK_METHOD0(GetSSIDListInternal
, void());
27 void CallSSIDListCallback(const std::vector
<NetworkProperties
>& networks
);
29 MOCK_METHOD0(RequestScan
, void());
31 virtual void ConfigureAndConnectNetwork(
32 const std::string
& ssid
,
33 const WifiCredentials
& credentials
,
34 const SuccessCallback
& callback
) OVERRIDE
;
36 MOCK_METHOD2(ConfigureAndConnectNetworkInternal
,
37 void(const std::string
& ssid
, const std::string
& password
));
39 void CallConfigureAndConnectNetworkCallback(bool success
);
41 virtual void ConnectToNetworkByID(const std::string
& internal_id
,
42 const SuccessCallback
& callback
) OVERRIDE
;
44 MOCK_METHOD1(ConnectToNetworkByIDInternal
,
45 void(const std::string
& internal_id
));
47 void CallConnectToNetworkByIDCallback(bool success
);
49 virtual void RequestNetworkCredentials(
50 const std::string
& internal_id
,
51 const CredentialsCallback
& callback
) OVERRIDE
;
53 MOCK_METHOD1(RequestNetworkCredentialsInternal
,
54 void(const std::string
& internal_id
));
56 void CallRequestNetworkCredentialsCallback(bool success
,
57 const std::string
& ssid
,
58 const std::string
& password
);
60 void AddNetworkListObserver(NetworkListObserver
* observer
);
62 void RemoveNetworkListObserver(NetworkListObserver
* observer
);
64 void CallNetworkListObservers(const std::vector
<NetworkProperties
>& ssids
);
67 SSIDListCallback ssid_list_callback_
;
68 SuccessCallback configure_and_connect_network_callback_
;
69 SuccessCallback connect_by_id_callback_
;
70 CredentialsCallback credentials_callback_
;
71 ObserverList
<NetworkListObserver
> network_observers_
;
73 base::WeakPtrFactory
<MockWifiManager
> weak_factory_
;
76 class MockWifiManagerFactory
: public WifiManagerFactory
{
78 MockWifiManagerFactory();
79 virtual ~MockWifiManagerFactory();
81 virtual scoped_ptr
<WifiManager
> CreateWifiManager() OVERRIDE
;
83 MockWifiManager
* GetLastCreatedWifiManager();
85 MOCK_METHOD0(WifiManagerCreated
, void());
88 MockWifiManager
* last_created_manager_
;
93 } // namespace local_discovery
95 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_MOCK_WIFI_MANAGER_H_