| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "components/onc/onc_constants.h" | 10 #include "components/onc/onc_constants.h" |
| 11 | 11 |
| 12 namespace wifi { | 12 namespace wifi { |
| 13 | 13 |
| 14 FakeWiFiService::FakeWiFiService() { | 14 FakeWiFiService::FakeWiFiService() { |
| 15 // Populate data expected by unit test. | 15 // Populate data expected by unit test. |
| 16 { | 16 { |
| 17 WiFiService::NetworkProperties network_properties; | 17 WiFiService::NetworkProperties network_properties; |
| 18 network_properties.connection_state = onc::connection_state::kConnected; | 18 network_properties.connection_state = onc::connection_state::kConnected; |
| 19 network_properties.guid = "stub_wifi1"; | 19 network_properties.guid = "stub_wifi1"; |
| 20 network_properties.name = "wifi1"; | 20 network_properties.name = "wifi1"; |
| 21 network_properties.type = onc::network_type::kWiFi; | 21 network_properties.type = onc::network_type::kWiFi; |
| 22 network_properties.frequency = 0; | 22 network_properties.frequency = 0; |
| 23 network_properties.ssid = "wifi1"; | 23 network_properties.ssid = "wifi1"; |
| 24 network_properties.security = onc::wifi::kWEP_PSK; | 24 network_properties.security = onc::wifi::kWEP_PSK; |
| 25 network_properties.signal_strength = 40; | 25 network_properties.signal_strength = 40; |
| 26 network_properties.json_extra = | 26 network_properties.json_extra = |
| 27 "{" | 27 "{" |
| 28 " \"MacAddress\": \"00:11:22:AA:BB:CC\"," |
| 28 " \"IPConfigs\": [{" | 29 " \"IPConfigs\": [{" |
| 29 " \"Gateway\": \"0.0.0.1\"," | 30 " \"Gateway\": \"0.0.0.1\"," |
| 30 " \"IPAddress\": \"0.0.0.0\"," | 31 " \"IPAddress\": \"0.0.0.0\"," |
| 31 " \"RoutingPrefix\": 0," | 32 " \"RoutingPrefix\": 0," |
| 32 " \"Type\": \"IPv4\"" | 33 " \"Type\": \"IPv4\"" |
| 33 " }]," | 34 " }]," |
| 34 " \"WiFi\": {" | 35 " \"WiFi\": {" |
| 35 " \"Frequency\": 2400," | 36 " \"Frequency\": 2400," |
| 36 " \"FrequencyList\": [2400]" | 37 " \"FrequencyList\": [2400]" |
| 37 " }" | 38 " }" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 FROM_HERE, base::Bind(network_list_changed_observer_, current_networks)); | 226 FROM_HERE, base::Bind(network_list_changed_observer_, current_networks)); |
| 226 } | 227 } |
| 227 | 228 |
| 228 void FakeWiFiService::NotifyNetworkChanged(const std::string& network_guid) { | 229 void FakeWiFiService::NotifyNetworkChanged(const std::string& network_guid) { |
| 229 WiFiService::NetworkGuidList changed_networks(1, network_guid); | 230 WiFiService::NetworkGuidList changed_networks(1, network_guid); |
| 230 message_loop_proxy_->PostTask( | 231 message_loop_proxy_->PostTask( |
| 231 FROM_HERE, base::Bind(networks_changed_observer_, changed_networks)); | 232 FROM_HERE, base::Bind(networks_changed_observer_, changed_networks)); |
| 232 } | 233 } |
| 233 | 234 |
| 234 } // namespace wifi | 235 } // namespace wifi |
| OLD | NEW |