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

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..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
sacomoto 2017/05/15 14:06:26 nit: s/indempotent/idempotent/.
Tim Song 2017/05/15 18:30:48 Done.
+ // focus on the same user multiple times.
+ // SetRemoteDeviceLifeCycle() is only expected to be called once.
+ FocusUser(kUser1);
+
+ 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