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

Unified Diff: components/proximity_auth/proximity_auth_system_unittest.cc

Issue 2861913002: [EasyUnlock] Fix crash when the same user pod is refocused. (Closed)
Patch Set: fixes Created 3 years, 7 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
Index: components/proximity_auth/proximity_auth_system_unittest.cc
diff --git a/components/proximity_auth/proximity_auth_system_unittest.cc b/components/proximity_auth/proximity_auth_system_unittest.cc
index 2d878b1ec506882f3d2f26d21f7b821402846377..26247a2c8d8ea81e8b7b3a3629ebbe6fff529ee1 100644
--- a/components/proximity_auth/proximity_auth_system_unittest.cc
+++ b/components/proximity_auth/proximity_auth_system_unittest.cc
@@ -301,6 +301,23 @@ TEST_F(ProximityAuthSystemTest, ToggleFocus_RegisteredAndUnregisteredUsers) {
.Times(AtLeast(1));
}
+TEST_F(ProximityAuthSystemTest, ToggleFocus_SameUserRefocused) {
+ RemoteDeviceLifeCycle* life_cycle = nullptr;
+ EXPECT_CALL(*unlock_manager_, SetRemoteDeviceLifeCycle(_))
+ .WillOnce(SaveArg<0>(&life_cycle));
+ FocusUser(kUser1);
+ EXPECT_EQ(kUser1, life_cycle->GetRemoteDevice().user_id);
+
+ // Focusing the user again should be idempotent. The screenlock UI may call
+ // focus on the same user multiple times.
+ // SetRemoteDeviceLifeCycle() is only expected to be called once.
+ FocusUser(kUser1);
+
+ // The RemoteDeviceLifeCycle should be nulled upon destruction.
+ EXPECT_CALL(*unlock_manager_, SetRemoteDeviceLifeCycle(nullptr))
+ .Times(AtLeast(1));
+}
+
TEST_F(ProximityAuthSystemTest, RestartSystem_UnregisteredUserFocused) {
FocusUser(kUser2);
« no previous file with comments | « components/proximity_auth/proximity_auth_system.cc ('k') | components/proximity_auth/proximity_monitor_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698