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 |