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

Unified Diff: ui/aura_shell/shell_unittest.cc

Issue 8817018: Implement cycle window forward/backward by keyboard shortcuts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 'Move IsLocked to Shell' Created 9 years 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: ui/aura_shell/shell_unittest.cc
diff --git a/ui/aura_shell/shell_unittest.cc b/ui/aura_shell/shell_unittest.cc
index 1be14e77a3291ff9ad86105700ca321cc353cd67..8fd376ad0cb64de86ca381b223ae34aad3caffb2 100644
--- a/ui/aura_shell/shell_unittest.cc
+++ b/ui/aura_shell/shell_unittest.cc
@@ -203,5 +203,45 @@ TEST_F(ShellTest, CreateLockScreenModalWindow) {
widget->Close();
}
+TEST_F(ShellTest, IsScreenLocked) {
+ views::Widget::InitParams widget_params(
+ views::Widget::InitParams::TYPE_WINDOW);
+
+ // A normal window does not lock the screen.
+ views::Widget* widget = CreateTestWindow(widget_params);
+ widget->Show();
+ EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
+ widget->Hide();
+ EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
+
+ // A modal window with a normal window as parent does not locks the screen.
+ views::Widget* modal_widget = views::Widget::CreateWindowWithParent(
+ new ModalWindow(), widget->GetNativeView());
+ modal_widget->Show();
+ EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
+ modal_widget->Close();
+ EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
+ widget->Close();
+
+ // A lock screen window locks the screen.
+ views::Widget* lock_widget = CreateTestWindow(widget_params);
+ aura_shell::Shell::GetInstance()->GetContainer(
+ aura_shell::internal::kShellWindowId_LockScreenContainer)->
+ AddChild(lock_widget->GetNativeView());
+ lock_widget->Show();
+ EXPECT_TRUE(Shell::GetInstance()->IsScreenLocked());
+ lock_widget->Hide();
+ EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
+
+ // A modal window with a lock window as parent locks the screen.
+ views::Widget* lock_modal_widget = views::Widget::CreateWindowWithParent(
+ new ModalWindow(), lock_widget->GetNativeView());
+ lock_modal_widget->Show();
+ EXPECT_TRUE(Shell::GetInstance()->IsScreenLocked());
+ lock_modal_widget->Close();
+ EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
+ lock_widget->Close();
+}
+
} // namespace test
} // namespace aura_shell

Powered by Google App Engine
This is Rietveld 408576698