OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chromeos/components/tether/tether_connector.h" | 5 #include "chromeos/components/tether/tether_connector.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chromeos/components/tether/connect_tethering_operation.h" | 9 #include "chromeos/components/tether/connect_tethering_operation.h" |
10 #include "chromeos/components/tether/device_id_tether_network_guid_map.h" | 10 #include "chromeos/components/tether/device_id_tether_network_guid_map.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 device_id); | 176 device_id); |
177 } | 177 } |
178 | 178 |
179 void SetUpTetherNetworks() { | 179 void SetUpTetherNetworks() { |
180 // Add a tether network corresponding to both of the test devices. These | 180 // Add a tether network corresponding to both of the test devices. These |
181 // networks are expected to be added already before TetherConnector receives | 181 // networks are expected to be added already before TetherConnector receives |
182 // its ConnectToNetwork() callback. | 182 // its ConnectToNetwork() callback. |
183 network_state_handler()->AddTetherNetworkState( | 183 network_state_handler()->AddTetherNetworkState( |
184 GetTetherNetworkGuid(test_devices_[0].GetDeviceId()), | 184 GetTetherNetworkGuid(test_devices_[0].GetDeviceId()), |
185 "TetherNetworkName1", "TetherNetworkCarrier1", | 185 "TetherNetworkName1", "TetherNetworkCarrier1", |
186 85 /* battery_percentage */, 75 /* signal_strength */); | 186 85 /* battery_percentage */, 75 /* signal_strength */, |
| 187 true /* has_connected_to_host */); |
187 network_state_handler()->AddTetherNetworkState( | 188 network_state_handler()->AddTetherNetworkState( |
188 GetTetherNetworkGuid(test_devices_[1].GetDeviceId()), | 189 GetTetherNetworkGuid(test_devices_[1].GetDeviceId()), |
189 "TetherNetworkName2", "TetherNetworkCarrier2", | 190 "TetherNetworkName2", "TetherNetworkCarrier2", |
190 90 /* battery_percentage */, 50 /* signal_strength */); | 191 90 /* battery_percentage */, 50 /* signal_strength */, |
| 192 true /* has_connected_to_host */); |
191 } | 193 } |
192 | 194 |
193 void SuccessfullyJoinWifiNetwork() { | 195 void SuccessfullyJoinWifiNetwork() { |
194 ConfigureService(CreateWifiConfigurationJsonString()); | 196 ConfigureService(CreateWifiConfigurationJsonString()); |
195 fake_wifi_hotspot_connector_->CallMostRecentCallback(kWifiNetworkGuid); | 197 fake_wifi_hotspot_connector_->CallMostRecentCallback(kWifiNetworkGuid); |
196 } | 198 } |
197 | 199 |
198 void VerifyTetherAndWifiNetworkAssociation( | 200 void VerifyTetherAndWifiNetworkAssociation( |
199 const std::string& tether_network_guid) { | 201 const std::string& tether_network_guid) { |
200 const NetworkState* tether_network_state = | 202 const NetworkState* tether_network_state = |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 EXPECT_EQ(test_devices_[1].GetDeviceId(), | 478 EXPECT_EQ(test_devices_[1].GetDeviceId(), |
477 fake_active_host_->GetActiveHostDeviceId()); | 479 fake_active_host_->GetActiveHostDeviceId()); |
478 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[1].GetDeviceId()), | 480 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[1].GetDeviceId()), |
479 fake_active_host_->GetTetherNetworkGuid()); | 481 fake_active_host_->GetTetherNetworkGuid()); |
480 EXPECT_TRUE(fake_active_host_->GetWifiNetworkGuid().empty()); | 482 EXPECT_TRUE(fake_active_host_->GetWifiNetworkGuid().empty()); |
481 } | 483 } |
482 | 484 |
483 } // namespace tether | 485 } // namespace tether |
484 | 486 |
485 } // namespace chromeos | 487 } // namespace chromeos |
OLD | NEW |