| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/proximity_auth/unlock_manager_impl.h" | 5 #include "components/proximity_auth/unlock_manager_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK); | 512 CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK); |
| 513 unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_); | 513 unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_); |
| 514 | 514 |
| 515 EXPECT_CALL(proximity_auth_client_, | 515 EXPECT_CALL(proximity_auth_client_, |
| 516 UpdateScreenlockState(ScreenlockState::BLUETOOTH_CONNECTING)); | 516 UpdateScreenlockState(ScreenlockState::BLUETOOTH_CONNECTING)); |
| 517 life_cycle_.ChangeState(RemoteDeviceLifeCycle::State::FINDING_CONNECTION); | 517 life_cycle_.ChangeState(RemoteDeviceLifeCycle::State::FINDING_CONNECTION); |
| 518 unlock_manager_->OnLifeCycleStateChanged(); | 518 unlock_manager_->OnLifeCycleStateChanged(); |
| 519 } | 519 } |
| 520 | 520 |
| 521 TEST_F(ProximityAuthUnlockManagerImplTest, | 521 TEST_F(ProximityAuthUnlockManagerImplTest, |
| 522 OnLifeCycleStateChanged_FindingConnection_BluetoothAdapterOff) { |
| 523 CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK); |
| 524 unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_); |
| 525 |
| 526 EXPECT_CALL(proximity_auth_client_, |
| 527 UpdateScreenlockState(ScreenlockState::NO_BLUETOOTH)); |
| 528 ON_CALL(*bluetooth_adapter_, IsPowered()).WillByDefault(Return(false)); |
| 529 life_cycle_.ChangeState(RemoteDeviceLifeCycle::State::FINDING_CONNECTION); |
| 530 unlock_manager_->OnLifeCycleStateChanged(); |
| 531 } |
| 532 |
| 533 TEST_F(ProximityAuthUnlockManagerImplTest, |
| 522 OnLifeCycleStateChanged_Authenticating_UpdatesScreenlockState) { | 534 OnLifeCycleStateChanged_Authenticating_UpdatesScreenlockState) { |
| 523 CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK); | 535 CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK); |
| 524 unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_); | 536 unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_); |
| 525 | 537 |
| 526 EXPECT_CALL(proximity_auth_client_, | 538 EXPECT_CALL(proximity_auth_client_, |
| 527 UpdateScreenlockState(ScreenlockState::BLUETOOTH_CONNECTING)); | 539 UpdateScreenlockState(ScreenlockState::BLUETOOTH_CONNECTING)); |
| 528 life_cycle_.ChangeState(RemoteDeviceLifeCycle::State::AUTHENTICATING); | 540 life_cycle_.ChangeState(RemoteDeviceLifeCycle::State::AUTHENTICATING); |
| 529 unlock_manager_->OnLifeCycleStateChanged(); | 541 unlock_manager_->OnLifeCycleStateChanged(); |
| 530 } | 542 } |
| 531 | 543 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 })); | 844 })); |
| 833 | 845 |
| 834 EXPECT_CALL(messenger_, RequestDecryption(kChallenge)); | 846 EXPECT_CALL(messenger_, RequestDecryption(kChallenge)); |
| 835 unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); | 847 unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); |
| 836 | 848 |
| 837 EXPECT_CALL(proximity_auth_client_, FinalizeSignin(std::string())); | 849 EXPECT_CALL(proximity_auth_client_, FinalizeSignin(std::string())); |
| 838 unlock_manager_->OnDecryptResponse(std::string()); | 850 unlock_manager_->OnDecryptResponse(std::string()); |
| 839 } | 851 } |
| 840 | 852 |
| 841 } // namespace proximity_auth | 853 } // namespace proximity_auth |
| OLD | NEW |