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

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: [EasyUnlock] Fix crash when the same user pod is refocused. Created 3 years, 8 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..4ac5bc410e41ef9f4f2d3d24de26cb222a7cba19 100644
--- a/components/proximity_auth/proximity_auth_system_unittest.cc
+++ b/components/proximity_auth/proximity_auth_system_unittest.cc
@@ -301,6 +301,22 @@ 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 indempotent. The screenlock UI may call
+ // focus on the same user multiple times.
+ // SetRemoteDeviceLifeCycle() is only expected to be called once.
+ FocusUser(kUser1);
+
+ EXPECT_CALL(*unlock_manager_, SetRemoteDeviceLifeCycle(nullptr))
Ryan Hansberry 2017/05/09 02:51:43 n00b question: I've generally been told that EXPEC
Tim Song 2017/05/10 18:11:16 Ah, this EXPECT_CALL is to catch the call when the
Ryan Hansberry 2017/05/15 15:48:05 Please update the comment "SetRemoteDeviceLifeCycl
Tim Song 2017/05/15 18:30:48 Done.
+ .Times(AtLeast(1));
+}
+
TEST_F(ProximityAuthSystemTest, RestartSystem_UnregisteredUserFocused) {
FocusUser(kUser2);

Powered by Google App Engine
This is Rietveld 408576698