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" |
| 11 #include "chromeos/components/tether/fake_active_host.h" | 11 #include "chromeos/components/tether/fake_active_host.h" |
| 12 #include "chromeos/components/tether/fake_ble_connection_manager.h" | 12 #include "chromeos/components/tether/fake_ble_connection_manager.h" |
| 13 #include "chromeos/components/tether/fake_host_scan_cache.h" | 13 #include "chromeos/components/tether/fake_host_scan_cache.h" |
| 14 #include "chromeos/components/tether/fake_notification_presenter.h" | 14 #include "chromeos/components/tether/fake_notification_presenter.h" |
| 15 #include "chromeos/components/tether/fake_tether_host_fetcher.h" | 15 #include "chromeos/components/tether/fake_tether_host_fetcher.h" |
| 16 #include "chromeos/components/tether/fake_wifi_hotspot_connector.h" | 16 #include "chromeos/components/tether/fake_wifi_hotspot_connector.h" |
| 17 #include "chromeos/components/tether/mock_host_connection_metrics_logger.h" | |
| 17 #include "chromeos/components/tether/mock_tether_host_response_recorder.h" | 18 #include "chromeos/components/tether/mock_tether_host_response_recorder.h" |
| 18 #include "chromeos/components/tether/tether_connector.h" | 19 #include "chromeos/components/tether/tether_connector.h" |
| 19 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
| 20 #include "chromeos/network/network_connection_handler.h" | 21 #include "chromeos/network/network_connection_handler.h" |
| 21 #include "chromeos/network/network_state.h" | 22 #include "chromeos/network/network_state.h" |
| 22 #include "chromeos/network/network_state_handler.h" | 23 #include "chromeos/network/network_state_handler.h" |
| 23 #include "chromeos/network/network_state_test.h" | 24 #include "chromeos/network/network_state_test.h" |
| 24 #include "components/cryptauth/remote_device.h" | 25 #include "components/cryptauth/remote_device.h" |
| 25 #include "components/cryptauth/remote_device_test_util.h" | 26 #include "components/cryptauth/remote_device_test_util.h" |
| 26 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 fake_tether_host_fetcher_ = base::MakeUnique<FakeTetherHostFetcher>( | 140 fake_tether_host_fetcher_ = base::MakeUnique<FakeTetherHostFetcher>( |
| 140 test_devices_, false /* synchronously_reply_with_results */); | 141 test_devices_, false /* synchronously_reply_with_results */); |
| 141 fake_ble_connection_manager_ = base::MakeUnique<FakeBleConnectionManager>(); | 142 fake_ble_connection_manager_ = base::MakeUnique<FakeBleConnectionManager>(); |
| 142 mock_tether_host_response_recorder_ = | 143 mock_tether_host_response_recorder_ = |
| 143 base::MakeUnique<MockTetherHostResponseRecorder>(); | 144 base::MakeUnique<MockTetherHostResponseRecorder>(); |
| 144 device_id_tether_network_guid_map_ = | 145 device_id_tether_network_guid_map_ = |
| 145 base::MakeUnique<DeviceIdTetherNetworkGuidMap>(); | 146 base::MakeUnique<DeviceIdTetherNetworkGuidMap>(); |
| 146 fake_host_scan_cache_ = base::MakeUnique<FakeHostScanCache>(); | 147 fake_host_scan_cache_ = base::MakeUnique<FakeHostScanCache>(); |
| 147 fake_notification_presenter_ = | 148 fake_notification_presenter_ = |
| 148 base::MakeUnique<FakeNotificationPresenter>(); | 149 base::MakeUnique<FakeNotificationPresenter>(); |
| 150 mock_host_connection_metrics_logger_ = | |
| 151 base::MakeUnique<MockHostConnectionMetricsLogger>(); | |
| 149 | 152 |
| 150 result_.clear(); | 153 result_.clear(); |
| 151 | 154 |
| 152 tether_connector_ = base::WrapUnique(new TetherConnector( | 155 tether_connector_ = base::WrapUnique(new TetherConnector( |
| 153 network_state_handler(), fake_wifi_hotspot_connector_.get(), | 156 network_state_handler(), fake_wifi_hotspot_connector_.get(), |
| 154 fake_active_host_.get(), fake_tether_host_fetcher_.get(), | 157 fake_active_host_.get(), fake_tether_host_fetcher_.get(), |
| 155 fake_ble_connection_manager_.get(), | 158 fake_ble_connection_manager_.get(), |
| 156 mock_tether_host_response_recorder_.get(), | 159 mock_tether_host_response_recorder_.get(), |
| 157 device_id_tether_network_guid_map_.get(), fake_host_scan_cache_.get(), | 160 device_id_tether_network_guid_map_.get(), fake_host_scan_cache_.get(), |
| 158 fake_notification_presenter_.get())); | 161 fake_notification_presenter_.get(), |
| 162 mock_host_connection_metrics_logger_.get())); | |
| 159 | 163 |
| 160 SetUpTetherNetworks(); | 164 SetUpTetherNetworks(); |
| 161 } | 165 } |
| 162 | 166 |
| 163 void TearDown() override { | 167 void TearDown() override { |
| 164 // Must delete |fake_wifi_hotspot_connector_| before NetworkStateHandler is | 168 // Must delete |fake_wifi_hotspot_connector_| before NetworkStateHandler is |
| 165 // destroyed to ensure that NetworkStateHandler has zero observers by the | 169 // destroyed to ensure that NetworkStateHandler has zero observers by the |
| 166 // time it reaches its destructor. | 170 // time it reaches its destructor. |
| 167 fake_wifi_hotspot_connector_.reset(); | 171 fake_wifi_hotspot_connector_.reset(); |
| 168 | 172 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 std::unique_ptr<FakeActiveHost> fake_active_host_; | 243 std::unique_ptr<FakeActiveHost> fake_active_host_; |
| 240 std::unique_ptr<FakeTetherHostFetcher> fake_tether_host_fetcher_; | 244 std::unique_ptr<FakeTetherHostFetcher> fake_tether_host_fetcher_; |
| 241 std::unique_ptr<FakeBleConnectionManager> fake_ble_connection_manager_; | 245 std::unique_ptr<FakeBleConnectionManager> fake_ble_connection_manager_; |
| 242 std::unique_ptr<MockTetherHostResponseRecorder> | 246 std::unique_ptr<MockTetherHostResponseRecorder> |
| 243 mock_tether_host_response_recorder_; | 247 mock_tether_host_response_recorder_; |
| 244 // TODO(hansberry): Use a fake for this when a real mapping scheme is created. | 248 // TODO(hansberry): Use a fake for this when a real mapping scheme is created. |
| 245 std::unique_ptr<DeviceIdTetherNetworkGuidMap> | 249 std::unique_ptr<DeviceIdTetherNetworkGuidMap> |
| 246 device_id_tether_network_guid_map_; | 250 device_id_tether_network_guid_map_; |
| 247 std::unique_ptr<FakeHostScanCache> fake_host_scan_cache_; | 251 std::unique_ptr<FakeHostScanCache> fake_host_scan_cache_; |
| 248 std::unique_ptr<FakeNotificationPresenter> fake_notification_presenter_; | 252 std::unique_ptr<FakeNotificationPresenter> fake_notification_presenter_; |
| 253 std::unique_ptr<MockHostConnectionMetricsLogger> | |
|
Kyle Horimoto
2017/07/05 21:49:13
Please make this a std::unique_ptr<StrictMock<Mock
Ryan Hansberry
2017/07/07 02:33:16
Done.
| |
| 254 mock_host_connection_metrics_logger_; | |
| 249 | 255 |
| 250 std::string result_; | 256 std::string result_; |
| 251 | 257 |
| 252 std::unique_ptr<TetherConnector> tether_connector_; | 258 std::unique_ptr<TetherConnector> tether_connector_; |
| 253 | 259 |
| 254 private: | 260 private: |
| 255 DISALLOW_COPY_AND_ASSIGN(TetherConnectorTest); | 261 DISALLOW_COPY_AND_ASSIGN(TetherConnectorTest); |
| 256 }; | 262 }; |
| 257 | 263 |
| 258 TEST_F(TetherConnectorTest, TestCannotFetchDevice) { | 264 TEST_F(TetherConnectorTest, TestCannotFetchDevice) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 tether_connector_->CancelConnectionAttempt( | 302 tether_connector_->CancelConnectionAttempt( |
| 297 GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); | 303 GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); |
| 298 | 304 |
| 299 EXPECT_EQ(ActiveHost::ActiveHostStatus::DISCONNECTED, | 305 EXPECT_EQ(ActiveHost::ActiveHostStatus::DISCONNECTED, |
| 300 fake_active_host_->GetActiveHostStatus()); | 306 fake_active_host_->GetActiveHostStatus()); |
| 301 EXPECT_EQ(NetworkConnectionHandler::kErrorConnectCanceled, | 307 EXPECT_EQ(NetworkConnectionHandler::kErrorConnectCanceled, |
| 302 GetResultAndReset()); | 308 GetResultAndReset()); |
| 303 } | 309 } |
| 304 | 310 |
| 305 TEST_F(TetherConnectorTest, TestConnectTetheringOperationFails) { | 311 TEST_F(TetherConnectorTest, TestConnectTetheringOperationFails) { |
| 312 EXPECT_CALL(*mock_host_connection_metrics_logger_, | |
| 313 RecordConnectionToHostResult( | |
| 314 HostConnectionMetricsLogger::ConnectionToHostResult:: | |
| 315 CONNECTION_RESULT_FAILURE_UNKNOWN_ERROR)); | |
| 316 | |
| 306 CallConnect(GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); | 317 CallConnect(GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); |
| 307 EXPECT_EQ(ActiveHost::ActiveHostStatus::CONNECTING, | 318 EXPECT_EQ(ActiveHost::ActiveHostStatus::CONNECTING, |
| 308 fake_active_host_->GetActiveHostStatus()); | 319 fake_active_host_->GetActiveHostStatus()); |
| 309 EXPECT_EQ(test_devices_[0].GetDeviceId(), | 320 EXPECT_EQ(test_devices_[0].GetDeviceId(), |
| 310 fake_active_host_->GetActiveHostDeviceId()); | 321 fake_active_host_->GetActiveHostDeviceId()); |
| 311 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[0].GetDeviceId()), | 322 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[0].GetDeviceId()), |
| 312 fake_active_host_->GetTetherNetworkGuid()); | 323 fake_active_host_->GetTetherNetworkGuid()); |
| 313 EXPECT_TRUE(fake_active_host_->GetWifiNetworkGuid().empty()); | 324 EXPECT_TRUE(fake_active_host_->GetWifiNetworkGuid().empty()); |
| 314 | 325 |
| 315 fake_tether_host_fetcher_->InvokePendingCallbacks(); | 326 fake_tether_host_fetcher_->InvokePendingCallbacks(); |
| 316 | 327 |
| 317 // Simulate a failed connection attempt (either the host cannot provide | 328 // Simulate a failed connection attempt (either the host cannot provide |
| 318 // tethering at this time or a timeout occurs). | 329 // tethering at this time or a timeout occurs). |
| 319 EXPECT_EQ(1u, fake_operation_factory_->created_operations().size()); | 330 EXPECT_EQ(1u, fake_operation_factory_->created_operations().size()); |
| 320 EXPECT_FALSE( | 331 EXPECT_FALSE( |
| 321 fake_operation_factory_->created_operations()[0]->setup_required()); | 332 fake_operation_factory_->created_operations()[0]->setup_required()); |
| 322 fake_operation_factory_->created_operations()[0]->SendFailedResponse( | 333 fake_operation_factory_->created_operations()[0]->SendFailedResponse( |
| 323 ConnectTetheringResponse_ResponseCode:: | 334 ConnectTetheringResponse_ResponseCode:: |
| 324 ConnectTetheringResponse_ResponseCode_UNKNOWN_ERROR); | 335 ConnectTetheringResponse_ResponseCode_UNKNOWN_ERROR); |
| 325 | 336 |
| 326 // The failure should have resulted in the host being disconnected. | 337 // The failure should have resulted in the host being disconnected. |
| 327 EXPECT_EQ(ActiveHost::ActiveHostStatus::DISCONNECTED, | 338 EXPECT_EQ(ActiveHost::ActiveHostStatus::DISCONNECTED, |
| 328 fake_active_host_->GetActiveHostStatus()); | 339 fake_active_host_->GetActiveHostStatus()); |
| 329 EXPECT_EQ(NetworkConnectionHandler::kErrorConnectFailed, GetResultAndReset()); | 340 EXPECT_EQ(NetworkConnectionHandler::kErrorConnectFailed, GetResultAndReset()); |
| 330 } | 341 } |
| 331 | 342 |
| 332 TEST_F(TetherConnectorTest, TestConnectTetheringOperationFails_SetupRequired) { | 343 TEST_F(TetherConnectorTest, TestConnectTetheringOperationFails_SetupRequired) { |
| 344 EXPECT_CALL(*mock_host_connection_metrics_logger_, | |
| 345 RecordConnectionToHostResult( | |
| 346 HostConnectionMetricsLogger::ConnectionToHostResult:: | |
| 347 CONNECTION_RESULT_FAILURE_UNKNOWN_ERROR)); | |
| 348 | |
| 333 EXPECT_FALSE( | 349 EXPECT_FALSE( |
| 334 fake_notification_presenter_->is_setup_required_notification_shown()); | 350 fake_notification_presenter_->is_setup_required_notification_shown()); |
| 335 | 351 |
| 336 CallConnect(GetTetherNetworkGuid(test_devices_[1].GetDeviceId())); | 352 CallConnect(GetTetherNetworkGuid(test_devices_[1].GetDeviceId())); |
| 337 | 353 |
| 338 EXPECT_TRUE( | 354 EXPECT_TRUE( |
| 339 fake_notification_presenter_->is_setup_required_notification_shown()); | 355 fake_notification_presenter_->is_setup_required_notification_shown()); |
| 340 | 356 |
| 341 fake_tether_host_fetcher_->InvokePendingCallbacks(); | 357 fake_tether_host_fetcher_->InvokePendingCallbacks(); |
| 342 | 358 |
| 343 EXPECT_TRUE( | 359 EXPECT_TRUE( |
| 344 fake_notification_presenter_->is_setup_required_notification_shown()); | 360 fake_notification_presenter_->is_setup_required_notification_shown()); |
| 345 EXPECT_TRUE( | 361 EXPECT_TRUE( |
| 346 fake_operation_factory_->created_operations()[0]->setup_required()); | 362 fake_operation_factory_->created_operations()[0]->setup_required()); |
| 347 | 363 |
| 348 fake_operation_factory_->created_operations()[0]->SendFailedResponse( | 364 fake_operation_factory_->created_operations()[0]->SendFailedResponse( |
| 349 ConnectTetheringResponse_ResponseCode:: | 365 ConnectTetheringResponse_ResponseCode:: |
| 350 ConnectTetheringResponse_ResponseCode_UNKNOWN_ERROR); | 366 ConnectTetheringResponse_ResponseCode_UNKNOWN_ERROR); |
| 351 | 367 |
| 352 EXPECT_FALSE( | 368 EXPECT_FALSE( |
| 353 fake_notification_presenter_->is_setup_required_notification_shown()); | 369 fake_notification_presenter_->is_setup_required_notification_shown()); |
| 354 | 370 |
| 355 EXPECT_EQ(NetworkConnectionHandler::kErrorConnectFailed, GetResultAndReset()); | 371 EXPECT_EQ(NetworkConnectionHandler::kErrorConnectFailed, GetResultAndReset()); |
| 356 } | 372 } |
| 357 | 373 |
| 374 TEST_F(TetherConnectorTest, TestProvisioningFailureOnHost) { | |
|
Kyle Horimoto
2017/07/05 21:49:13
This seems like TestConnectTetheringOperationFails
Ryan Hansberry
2017/07/07 02:33:16
Good suggestion. Done.
| |
| 375 EXPECT_CALL(*mock_host_connection_metrics_logger_, | |
| 376 RecordConnectionToHostResult( | |
| 377 HostConnectionMetricsLogger::ConnectionToHostResult:: | |
| 378 CONNECTION_RESULT_PROVISIONING_FAILED)); | |
| 379 | |
| 380 CallConnect(GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); | |
| 381 | |
| 382 fake_tether_host_fetcher_->InvokePendingCallbacks(); | |
| 383 | |
| 384 fake_operation_factory_->created_operations()[0]->SendFailedResponse( | |
| 385 ConnectTetheringResponse_ResponseCode:: | |
| 386 ConnectTetheringResponse_ResponseCode_PROVISIONING_FAILED); | |
| 387 | |
| 388 EXPECT_EQ(NetworkConnectionHandler::kErrorConnectFailed, GetResultAndReset()); | |
| 389 } | |
| 390 | |
| 391 TEST_F(TetherConnectorTest, TestTetheringTimeoutOnHost) { | |
| 392 EXPECT_CALL( | |
| 393 *mock_host_connection_metrics_logger_, | |
| 394 RecordConnectionToHostResult( | |
| 395 HostConnectionMetricsLogger::ConnectionToHostResult:: | |
| 396 CONNECTION_RESULT_FAILURE_TETHERING_TIMED_OUT_FIRST_TIME_SETUP_WAS _NOT_REQUIRED)); | |
| 397 | |
| 398 CallConnect(GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); | |
| 399 | |
| 400 fake_tether_host_fetcher_->InvokePendingCallbacks(); | |
| 401 | |
| 402 EXPECT_FALSE( | |
| 403 fake_notification_presenter_->is_setup_required_notification_shown()); | |
| 404 EXPECT_FALSE( | |
| 405 fake_operation_factory_->created_operations()[0]->setup_required()); | |
| 406 | |
| 407 fake_operation_factory_->created_operations()[0]->SendFailedResponse( | |
| 408 ConnectTetheringResponse_ResponseCode:: | |
| 409 ConnectTetheringResponse_ResponseCode_TETHERING_TIMEOUT); | |
| 410 | |
| 411 EXPECT_EQ(NetworkConnectionHandler::kErrorConnectFailed, GetResultAndReset()); | |
| 412 } | |
| 413 | |
| 414 TEST_F(TetherConnectorTest, TestTetheringTimeoutOnHost_SetupRequired) { | |
|
Kyle Horimoto
2017/07/05 21:49:13
Likewise, this seems like the same thing as TestCo
Ryan Hansberry
2017/07/07 02:33:16
Done.
| |
| 415 EXPECT_CALL( | |
| 416 *mock_host_connection_metrics_logger_, | |
| 417 RecordConnectionToHostResult( | |
| 418 HostConnectionMetricsLogger::ConnectionToHostResult:: | |
| 419 CONNECTION_RESULT_FAILURE_TETHERING_TIMED_OUT_FIRST_TIME_SETUP_WAS _REQUIRED)); | |
| 420 | |
| 421 EXPECT_FALSE( | |
| 422 fake_notification_presenter_->is_setup_required_notification_shown()); | |
| 423 | |
| 424 CallConnect(GetTetherNetworkGuid(test_devices_[1].GetDeviceId())); | |
| 425 | |
| 426 EXPECT_TRUE( | |
| 427 fake_notification_presenter_->is_setup_required_notification_shown()); | |
| 428 | |
| 429 fake_tether_host_fetcher_->InvokePendingCallbacks(); | |
| 430 | |
| 431 EXPECT_TRUE( | |
| 432 fake_notification_presenter_->is_setup_required_notification_shown()); | |
| 433 EXPECT_TRUE( | |
| 434 fake_operation_factory_->created_operations()[0]->setup_required()); | |
| 435 | |
| 436 fake_operation_factory_->created_operations()[0]->SendFailedResponse( | |
| 437 ConnectTetheringResponse_ResponseCode:: | |
| 438 ConnectTetheringResponse_ResponseCode_TETHERING_TIMEOUT); | |
| 439 | |
| 440 EXPECT_FALSE( | |
| 441 fake_notification_presenter_->is_setup_required_notification_shown()); | |
| 442 | |
| 443 EXPECT_EQ(NetworkConnectionHandler::kErrorConnectFailed, GetResultAndReset()); | |
| 444 } | |
| 445 | |
| 358 TEST_F(TetherConnectorTest, TestConnectingToWifiFails) { | 446 TEST_F(TetherConnectorTest, TestConnectingToWifiFails) { |
| 359 CallConnect(GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); | 447 CallConnect(GetTetherNetworkGuid(test_devices_[0].GetDeviceId())); |
| 360 EXPECT_EQ(ActiveHost::ActiveHostStatus::CONNECTING, | 448 EXPECT_EQ(ActiveHost::ActiveHostStatus::CONNECTING, |
| 361 fake_active_host_->GetActiveHostStatus()); | 449 fake_active_host_->GetActiveHostStatus()); |
| 362 EXPECT_EQ(test_devices_[0].GetDeviceId(), | 450 EXPECT_EQ(test_devices_[0].GetDeviceId(), |
| 363 fake_active_host_->GetActiveHostDeviceId()); | 451 fake_active_host_->GetActiveHostDeviceId()); |
| 364 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[0].GetDeviceId()), | 452 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[0].GetDeviceId()), |
| 365 fake_active_host_->GetTetherNetworkGuid()); | 453 fake_active_host_->GetTetherNetworkGuid()); |
| 366 EXPECT_TRUE(fake_active_host_->GetWifiNetworkGuid().empty()); | 454 EXPECT_TRUE(fake_active_host_->GetWifiNetworkGuid().empty()); |
| 367 | 455 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 EXPECT_EQ(test_devices_[0].GetDeviceId(), | 547 EXPECT_EQ(test_devices_[0].GetDeviceId(), |
| 460 fake_active_host_->GetActiveHostDeviceId()); | 548 fake_active_host_->GetActiveHostDeviceId()); |
| 461 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[0].GetDeviceId()), | 549 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[0].GetDeviceId()), |
| 462 fake_active_host_->GetTetherNetworkGuid()); | 550 fake_active_host_->GetTetherNetworkGuid()); |
| 463 EXPECT_EQ(kWifiNetworkGuid, fake_active_host_->GetWifiNetworkGuid()); | 551 EXPECT_EQ(kWifiNetworkGuid, fake_active_host_->GetWifiNetworkGuid()); |
| 464 | 552 |
| 465 EXPECT_EQ(kSuccessResult, GetResultAndReset()); | 553 EXPECT_EQ(kSuccessResult, GetResultAndReset()); |
| 466 } | 554 } |
| 467 | 555 |
| 468 TEST_F(TetherConnectorTest, TestSuccessfulConnection_SetupRequired) { | 556 TEST_F(TetherConnectorTest, TestSuccessfulConnection_SetupRequired) { |
| 557 EXPECT_CALL(*mock_host_connection_metrics_logger_, | |
| 558 RecordConnectionToHostResult( | |
| 559 HostConnectionMetricsLogger::ConnectionToHostResult:: | |
| 560 CONNECTION_RESULT_SUCCESS)); | |
| 561 | |
| 469 EXPECT_FALSE( | 562 EXPECT_FALSE( |
| 470 fake_notification_presenter_->is_setup_required_notification_shown()); | 563 fake_notification_presenter_->is_setup_required_notification_shown()); |
| 471 | 564 |
| 472 CallConnect(GetTetherNetworkGuid(test_devices_[1].GetDeviceId())); | 565 CallConnect(GetTetherNetworkGuid(test_devices_[1].GetDeviceId())); |
| 473 | 566 |
| 474 EXPECT_TRUE( | 567 EXPECT_TRUE( |
| 475 fake_notification_presenter_->is_setup_required_notification_shown()); | 568 fake_notification_presenter_->is_setup_required_notification_shown()); |
| 476 | 569 |
| 477 fake_tether_host_fetcher_->InvokePendingCallbacks(); | 570 fake_tether_host_fetcher_->InvokePendingCallbacks(); |
| 478 | 571 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 605 EXPECT_EQ(test_devices_[1].GetDeviceId(), | 698 EXPECT_EQ(test_devices_[1].GetDeviceId(), |
| 606 fake_active_host_->GetActiveHostDeviceId()); | 699 fake_active_host_->GetActiveHostDeviceId()); |
| 607 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[1].GetDeviceId()), | 700 EXPECT_EQ(GetTetherNetworkGuid(test_devices_[1].GetDeviceId()), |
| 608 fake_active_host_->GetTetherNetworkGuid()); | 701 fake_active_host_->GetTetherNetworkGuid()); |
| 609 EXPECT_TRUE(fake_active_host_->GetWifiNetworkGuid().empty()); | 702 EXPECT_TRUE(fake_active_host_->GetWifiNetworkGuid().empty()); |
| 610 } | 703 } |
| 611 | 704 |
| 612 } // namespace tether | 705 } // namespace tether |
| 613 | 706 |
| 614 } // namespace chromeos | 707 } // namespace chromeos |
| OLD | NEW |