Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(920)

Unified Diff: components/proximity_auth/unlock_manager_impl_unittest.cc

Issue 2951223002: [EasyUnlock] Display a timeout state when the device isn't connected after a long time. (Closed)
Patch Set: fix test Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/proximity_auth/unlock_manager_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/proximity_auth/unlock_manager_impl_unittest.cc
diff --git a/components/proximity_auth/unlock_manager_impl_unittest.cc b/components/proximity_auth/unlock_manager_impl_unittest.cc
index 9dc836f9ae92a6629637d79d54799f037f2f3910..e9131f5072fa4e53fd9c610ad83557342f5a2638 100644
--- a/components/proximity_auth/unlock_manager_impl_unittest.cc
+++ b/components/proximity_auth/unlock_manager_impl_unittest.cc
@@ -312,6 +312,8 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
IsUnlockAllowed_SecureChannelNotEstablished) {
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
+ life_cycle_.set_connection(nullptr);
+ life_cycle_.set_messenger(nullptr);
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
life_cycle_.ChangeState(RemoteDeviceLifeCycle::State::AUTHENTICATING);
unlock_manager_->OnLifeCycleStateChanged();
@@ -426,6 +428,24 @@ TEST_F(ProximityAuthUnlockManagerImplTest, SetRemoteDeviceLifeCycle_WakingUp) {
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
}
+TEST_F(ProximityAuthUnlockManagerImplTest,
+ SetRemoteDeviceLifeCycle_TimesOutBeforeConnection) {
+ CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
+
+ life_cycle_.set_connection(nullptr);
+ life_cycle_.set_messenger(nullptr);
+ life_cycle_.ChangeState(RemoteDeviceLifeCycle::State::FINDING_CONNECTION);
+
+ EXPECT_CALL(proximity_auth_client_,
+ UpdateScreenlockState(ScreenlockState::BLUETOOTH_CONNECTING));
+ unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
+
+ EXPECT_CALL(proximity_auth_client_,
+ UpdateScreenlockState(ScreenlockState::NO_PHONE));
+ // Simulate timing out before a connection is established.
+ RunPendingTasks();
+}
+
TEST_F(ProximityAuthUnlockManagerImplTest,
SetRemoteDeviceLifeCycle_NullRemoteDeviceLifeCycle_NoProximityMonitor) {
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
@@ -593,15 +613,15 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest, OnScreenDidLock_SetsWakingUpState) {
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
- SimulateUserPresentState();
-
- unlock_manager_.get()->OnScreenDidUnlock(
- ScreenlockBridge::LockHandler::LOCK_SCREEN);
EXPECT_CALL(proximity_auth_client_,
UpdateScreenlockState(ScreenlockState::BLUETOOTH_CONNECTING));
life_cycle_.ChangeState(RemoteDeviceLifeCycle::State::FINDING_CONNECTION);
+ unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
+ unlock_manager_.get()->OnScreenDidLock(
+ ScreenlockBridge::LockHandler::LOCK_SCREEN);
+
unlock_manager_->OnLifeCycleStateChanged();
}
« no previous file with comments | « components/proximity_auth/unlock_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698