OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/wifi/fake_wifi_service.h" | 5 #include "components/wifi/fake_wifi_service.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
jdoerrie
2017/04/12 12:37:46
#include "base/values.h"
vabr (Chromium)
2017/04/12 12:55:03
Done.
| |
11 #include "components/onc/onc_constants.h" | 12 #include "components/onc/onc_constants.h" |
12 | 13 |
13 namespace wifi { | 14 namespace wifi { |
14 | 15 |
15 FakeWiFiService::FakeWiFiService() { | 16 FakeWiFiService::FakeWiFiService() { |
16 // Populate data expected by unit test. | 17 // Populate data expected by unit test. |
17 { | 18 { |
18 NetworkProperties network_properties; | 19 NetworkProperties network_properties; |
19 network_properties.connection_state = onc::connection_state::kConnected; | 20 network_properties.connection_state = onc::connection_state::kConnected; |
20 network_properties.guid = "stub_wifi1_guid"; | 21 network_properties.guid = "stub_wifi1_guid"; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 void FakeWiFiService::GetVisibleNetworks(const std::string& network_type, | 112 void FakeWiFiService::GetVisibleNetworks(const std::string& network_type, |
112 base::ListValue* network_list, | 113 base::ListValue* network_list, |
113 bool include_details) { | 114 bool include_details) { |
114 for (NetworkList::const_iterator it = networks_.begin(); | 115 for (NetworkList::const_iterator it = networks_.begin(); |
115 it != networks_.end(); | 116 it != networks_.end(); |
116 ++it) { | 117 ++it) { |
117 if (network_type.empty() || network_type == onc::network_type::kAllTypes || | 118 if (network_type.empty() || network_type == onc::network_type::kAllTypes || |
118 it->type == network_type) { | 119 it->type == network_type) { |
119 std::unique_ptr<base::DictionaryValue> network( | 120 std::unique_ptr<base::DictionaryValue> network( |
120 it->ToValue(!include_details)); | 121 it->ToValue(!include_details)); |
121 network_list->Append(network.release()); | 122 network_list->Append(std::move(network)); |
122 } | 123 } |
123 } | 124 } |
124 } | 125 } |
125 | 126 |
126 void FakeWiFiService::RequestNetworkScan() { | 127 void FakeWiFiService::RequestNetworkScan() { |
127 NotifyNetworkListChanged(networks_); | 128 NotifyNetworkListChanged(networks_); |
128 } | 129 } |
129 | 130 |
130 void FakeWiFiService::StartConnect(const std::string& network_guid, | 131 void FakeWiFiService::StartConnect(const std::string& network_guid, |
131 std::string* error) { | 132 std::string* error) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 FROM_HERE, base::Bind(network_list_changed_observer_, current_networks)); | 214 FROM_HERE, base::Bind(network_list_changed_observer_, current_networks)); |
214 } | 215 } |
215 | 216 |
216 void FakeWiFiService::NotifyNetworkChanged(const std::string& network_guid) { | 217 void FakeWiFiService::NotifyNetworkChanged(const std::string& network_guid) { |
217 WiFiService::NetworkGuidList changed_networks(1, network_guid); | 218 WiFiService::NetworkGuidList changed_networks(1, network_guid); |
218 task_runner_->PostTask( | 219 task_runner_->PostTask( |
219 FROM_HERE, base::Bind(networks_changed_observer_, changed_networks)); | 220 FROM_HERE, base::Bind(networks_changed_observer_, changed_networks)); |
220 } | 221 } |
221 | 222 |
222 } // namespace wifi | 223 } // namespace wifi |
OLD | NEW |