Chromium Code Reviews| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 EXPECT_EQ(ActiveHost::ActiveHostStatus::CONNECTING, | 351 EXPECT_EQ(ActiveHost::ActiveHostStatus::CONNECTING, |
| 352 fake_active_host_->GetActiveHostStatus()); | 352 fake_active_host_->GetActiveHostStatus()); |
| 353 | 353 |
| 354 // |fake_wifi_hotspot_connector_| should have received the SSID and password | 354 // |fake_wifi_hotspot_connector_| should have received the SSID and password |
| 355 // above. Verify this, then return the GUID corresponding to the connected | 355 // above. Verify this, then return the GUID corresponding to the connected |
| 356 // Wi-Fi network. | 356 // Wi-Fi network. |
| 357 EXPECT_EQ(kSsid, fake_wifi_hotspot_connector_->most_recent_ssid()); | 357 EXPECT_EQ(kSsid, fake_wifi_hotspot_connector_->most_recent_ssid()); |
| 358 EXPECT_EQ(kPassword, fake_wifi_hotspot_connector_->most_recent_password()); | 358 EXPECT_EQ(kPassword, fake_wifi_hotspot_connector_->most_recent_password()); |
| 359 SuccessfullyJoinWifiNetwork(); | 359 SuccessfullyJoinWifiNetwork(); |
| 360 | 360 |
| 361 // The active host should now be connected, and the tether and Wi-Fi networks | 361 // The active host should now be connected |
|
Ryan Hansberry
2017/04/27 16:32:27
Comments should end with periods (and in general s
lesliewatkins
2017/04/28 21:30:43
Done.
| |
| 362 // should be associated. | |
| 363 EXPECT_EQ(ActiveHost::ActiveHostStatus::CONNECTED, | 362 EXPECT_EQ(ActiveHost::ActiveHostStatus::CONNECTED, |
| 364 fake_active_host_->GetActiveHostStatus()); | 363 fake_active_host_->GetActiveHostStatus()); |
| 365 EXPECT_EQ(test_devices_[0].GetDeviceId(), | 364 EXPECT_EQ(test_devices_[0].GetDeviceId(), |
| 366 fake_active_host_->GetActiveHostDeviceId()); | 365 fake_active_host_->GetActiveHostDeviceId()); |
| 367 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[0].GetDeviceId()), | 366 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[0].GetDeviceId()), |
| 368 fake_active_host_->GetTetherNetworkGuid()); | 367 fake_active_host_->GetTetherNetworkGuid()); |
| 369 EXPECT_EQ(kWifiNetworkGuid, fake_active_host_->GetWifiNetworkGuid()); | 368 EXPECT_EQ(kWifiNetworkGuid, fake_active_host_->GetWifiNetworkGuid()); |
| 369 | |
| 370 VerifyTetherAndWifiNetworkAssociation( | 370 VerifyTetherAndWifiNetworkAssociation( |
|
Kyle Horimoto
2017/04/27 01:28:07
You forgot to remove the association code from Tet
lesliewatkins
2017/04/28 21:30:43
Done.
| |
| 371 GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); | 371 GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); |
| 372 EXPECT_EQ(kSuccessResult, GetResultAndReset()); | 372 EXPECT_EQ(kSuccessResult, GetResultAndReset()); |
| 373 } | 373 } |
| 374 | 374 |
| 375 TEST_F(TetherConnectorTest, | 375 TEST_F(TetherConnectorTest, |
| 376 TestNewConnectionAttemptDuringFetch_DifferentDevice) { | 376 TestNewConnectionAttemptDuringFetch_DifferentDevice) { |
| 377 CallTetherDelegate(GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); | 377 CallTetherDelegate(GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); |
| 378 | 378 |
| 379 // Instead of invoking the pending callbacks on |fake_tether_host_fetcher_|, | 379 // Instead of invoking the pending callbacks on |fake_tether_host_fetcher_|, |
| 380 // attempt another connection attempt, this time to another device. | 380 // attempt another connection attempt, this time to another device. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 EXPECT_EQ(test_devices_[1].GetDeviceId(), | 476 EXPECT_EQ(test_devices_[1].GetDeviceId(), |
| 477 fake_active_host_->GetActiveHostDeviceId()); | 477 fake_active_host_->GetActiveHostDeviceId()); |
| 478 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[1].GetDeviceId()), | 478 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[1].GetDeviceId()), |
| 479 fake_active_host_->GetTetherNetworkGuid()); | 479 fake_active_host_->GetTetherNetworkGuid()); |
| 480 EXPECT_TRUE(fake_active_host_->GetWifiNetworkGuid().empty()); | 480 EXPECT_TRUE(fake_active_host_->GetWifiNetworkGuid().empty()); |
| 481 } | 481 } |
| 482 | 482 |
| 483 } // namespace tether | 483 } // namespace tether |
| 484 | 484 |
| 485 } // namespace chromeos | 485 } // namespace chromeos |
| OLD | NEW |