Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / local_discovery / wifi / mock_wifi_manager.cc
blob56aace63fbf7e4593ac6beddb5b68a732ee2a095
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 #include "chrome/browser/local_discovery/wifi/mock_wifi_manager.h"
7 namespace local_discovery {
9 namespace wifi {
11 MockWifiManager::MockWifiManager() : weak_factory_(this) {
14 MockWifiManager::~MockWifiManager() {
17 void MockWifiManager::GetSSIDList(const SSIDListCallback& callback) {
18 ssid_list_callback_ = callback;
19 GetSSIDListInternal();
22 void MockWifiManager::CallSSIDListCallback(
23 const std::vector<NetworkProperties>& networks) {
24 ssid_list_callback_.Run(networks);
27 void MockWifiManager::ConfigureAndConnectNetwork(
28 const std::string& ssid,
29 const WifiCredentials& credentials,
30 const SuccessCallback& callback) {
31 configure_and_connect_network_callback_ = callback;
32 ConfigureAndConnectNetworkInternal(ssid, credentials.psk);
35 void MockWifiManager::CallConfigureAndConnectNetworkCallback(bool success) {
36 configure_and_connect_network_callback_.Run(success);
39 void MockWifiManager::ConnectToNetworkByID(const std::string& internal_id,
40 const SuccessCallback& callback) {
41 connect_by_id_callback_ = callback;
42 ConnectToNetworkByIDInternal(internal_id);
45 void MockWifiManager::CallConnectToNetworkByIDCallback(bool success) {
46 connect_by_id_callback_.Run(success);
49 void MockWifiManager::RequestNetworkCredentials(
50 const std::string& internal_id,
51 const CredentialsCallback& callback) {
52 credentials_callback_ = callback;
53 RequestNetworkCredentialsInternal(internal_id);
56 void MockWifiManager::CallRequestNetworkCredentialsCallback(
57 bool success,
58 const std::string& ssid,
59 const std::string& password) {
60 credentials_callback_.Run(success, ssid, password);
63 void MockWifiManager::CallNetworkListObservers(
64 const std::vector<NetworkProperties>& ssids) {
65 FOR_EACH_OBSERVER(
66 NetworkListObserver, network_observers_, OnNetworkListChanged(ssids));
69 void MockWifiManager::AddNetworkListObserver(NetworkListObserver* observer) {
70 network_observers_.AddObserver(observer);
73 void MockWifiManager::RemoveNetworkListObserver(NetworkListObserver* observer) {
74 network_observers_.RemoveObserver(observer);
77 MockWifiManagerFactory::MockWifiManagerFactory() {
78 WifiManager::SetFactory(this);
81 MockWifiManagerFactory::~MockWifiManagerFactory() {
82 WifiManager::SetFactory(NULL);
85 scoped_ptr<WifiManager> MockWifiManagerFactory::CreateWifiManager() {
86 last_created_manager_ = new MockWifiManager();
88 WifiManagerCreated();
90 return scoped_ptr<WifiManager>(last_created_manager_);
93 MockWifiManager* MockWifiManagerFactory::GetLastCreatedWifiManager() {
94 return last_created_manager_;
97 } // namespace wifi
99 } // namespace local_discovery