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

Unified Diff: chrome/browser/chromeos/login/screen_locker_browsertest.cc

Issue 2854055: Send UnlockCompleted signal even if screen lock is already present. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: browsertest fix Created 10 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 | « chrome/browser/chromeos/login/screen_locker.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/screen_locker_browsertest.cc
diff --git a/chrome/browser/chromeos/login/screen_locker_browsertest.cc b/chrome/browser/chromeos/login/screen_locker_browsertest.cc
index 48a8ff8f925149694f2aa83ddcfb1a7571056796..98fa7d80eb67f7e772bbc164fce64f24dd0bf49d 100644
--- a/chrome/browser/chromeos/login/screen_locker_browsertest.cc
+++ b/chrome/browser/chromeos/login/screen_locker_browsertest.cc
@@ -32,6 +32,12 @@ class ScreenLockerTest : public CrosInProcessBrowserTest {
// Test the no password mode with different unlock scheme given by
// |unlock| function.
void TestNoPassword(void (unlock)(views::Widget*)) {
+ EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenUnlockRequested())
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenLockCompleted())
+ .Times(1)
+ .RetiresOnSaturation();
UserManager::Get()->OffTheRecordUserLoggedIn();
ScreenLocker::Show();
scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester());
@@ -59,12 +65,6 @@ class ScreenLockerTest : public CrosInProcessBrowserTest {
EXPECT_CALL(*mock_screen_lock_library_, AddObserver(testing::_))
.Times(1)
.RetiresOnSaturation();
- EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenLockCompleted())
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenUnlockRequested())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenUnlockCompleted())
.Times(1)
.RetiresOnSaturation();
@@ -87,6 +87,12 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestBasic) {
.Times(1)
.WillRepeatedly((testing::Return(0)))
.RetiresOnSaturation();
+ EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenUnlockRequested())
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenLockCompleted())
+ .Times(1)
+ .RetiresOnSaturation();
UserManager::Get()->UserLoggedIn("user");
ScreenLocker::Show();
scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester());
@@ -136,4 +142,27 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestNoPasswordWithKeyPress) {
TestNoPassword(KeyPress);
}
+IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestShowTwice) {
+ EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenLockCompleted())
+ .Times(2)
+ .RetiresOnSaturation();
+
+ UserManager::Get()->UserLoggedIn("user");
+ ScreenLocker::Show();
+ scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester());
+ tester->EmulateWindowManagerReady();
+ ui_test_utils::WaitForNotification(
+ NotificationType::SCREEN_LOCK_STATE_CHANGED);
+ EXPECT_TRUE(tester->IsOpen());
+
+ // Calling Show again simply send LockCompleted signal.
+ ScreenLocker::Show();
+ EXPECT_TRUE(tester->IsOpen());
+
+ // Close the locker to match expectations.
+ ScreenLocker::Hide();
+ ui_test_utils::RunAllPendingInMessageLoop();
+ EXPECT_FALSE(tester->IsOpen());
+}
+
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/screen_locker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698