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

Unified Diff: ash/login/lock_screen_controller_unittest.cc

Issue 2903353003: Adding mojo calls for easy unlock service (Closed)
Patch Set: clean up and trybot 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: ash/login/lock_screen_controller_unittest.cc
diff --git a/ash/login/lock_screen_controller_unittest.cc b/ash/login/lock_screen_controller_unittest.cc
index cc3f8d45e43c2467b4a1d1703b27e42b957905d0..f774a927969fd933119f7e360db97f89714e78dc 100644
--- a/ash/login/lock_screen_controller_unittest.cc
+++ b/ash/login/lock_screen_controller_unittest.cc
@@ -29,13 +29,36 @@ class TestLockScreenClient : public mojom::LockScreenClient {
++autentication_requests_count_;
}
+ void AttemptUnlock(const AccountId& account_id) override {
+ ++attempt_unlock_count_;
+ }
+
+ void HardlockPod(const AccountId& account_id) override {
+ ++hardlock_pod_count_;
+ }
+
+ void RecordClickOnLockIcon(const AccountId& account_id) override {
+ ++record_click_on_lockicon_count_;
+ }
+
int authentication_requests_count() const {
return autentication_requests_count_;
}
+ int attempt_unlock_count() const { return attempt_unlock_count_; }
+
+ int hardlock_pod_count() const { return hardlock_pod_count_; }
+
+ int record_click_on_lockicon_count() const {
+ return record_click_on_lockicon_count_;
+ }
+
private:
mojo::Binding<ash::mojom::LockScreenClient> binding_;
int autentication_requests_count_ = 0;
+ int attempt_unlock_count_ = 0;
+ int hardlock_pod_count_ = 0;
+ int record_click_on_lockicon_count_ = 0;
DISALLOW_COPY_AND_ASSIGN(TestLockScreenClient);
};
@@ -58,4 +81,37 @@ TEST_F(LockScreenControllerTest, RequestAuthentication) {
EXPECT_EQ(1, lock_screen_client.authentication_requests_count());
}
+TEST_F(LockScreenControllerTest, RequestEasyUnlock) {
jdufault 2017/05/26 18:59:10 This will need to rebased to use the mock
xiaoyinh(OOO Sep 11-29) 2017/05/30 22:23:50 Done.
+ LockScreenController* lock_screen_controller =
+ Shell::Get()->lock_screen_controller();
+ TestLockScreenClient lock_screen_client;
+ lock_screen_controller->SetClient(
+ lock_screen_client.CreateInterfacePtrAndBind());
+ EXPECT_EQ(0, lock_screen_client.attempt_unlock_count());
+ EXPECT_EQ(0, lock_screen_client.hardlock_pod_count());
+ EXPECT_EQ(0, lock_screen_client.record_click_on_lockicon_count());
+
+ // Request attemp unlock.
+ AccountId id = AccountId::FromUserEmail("user1@test.com");
+ lock_screen_controller->AttemptUnlock(id);
+ base::RunLoop().RunUntilIdle();
+ EXPECT_EQ(1, lock_screen_client.attempt_unlock_count());
+ EXPECT_EQ(0, lock_screen_client.hardlock_pod_count());
+ EXPECT_EQ(0, lock_screen_client.record_click_on_lockicon_count());
+
+ // Request hard lock user pod.
+ lock_screen_controller->HardlockPod(id);
+ base::RunLoop().RunUntilIdle();
+ EXPECT_EQ(1, lock_screen_client.attempt_unlock_count());
+ EXPECT_EQ(1, lock_screen_client.hardlock_pod_count());
+ EXPECT_EQ(0, lock_screen_client.record_click_on_lockicon_count());
+
+ // Request record clicks on the lock icon in the user pod.
+ lock_screen_controller->RecordClickOnLockIcon(id);
+ base::RunLoop().RunUntilIdle();
+ EXPECT_EQ(1, lock_screen_client.attempt_unlock_count());
+ EXPECT_EQ(1, lock_screen_client.hardlock_pod_count());
+ EXPECT_EQ(1, lock_screen_client.record_click_on_lockicon_count());
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698