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

Side by Side 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: Rebase 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "ui/aura/test/aura_test_base.h" 6 #include "ui/aura/test/aura_test_base.h"
7 #include "ui/aura/window.h" 7 #include "ui/aura/window.h"
8 #include "ui/aura_shell/shell.h" 8 #include "ui/aura_shell/shell.h"
9 #include "ui/aura_shell/shell_window_ids.h" 9 #include "ui/aura_shell/shell_window_ids.h"
10 #include "ui/aura_shell/test/aura_shell_test_base.h" 10 #include "ui/aura_shell/test/aura_shell_test_base.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 aura::Window* modal_container = Shell::GetInstance()->GetContainer( 196 aura::Window* modal_container = Shell::GetInstance()->GetContainer(
197 aura_shell::internal::kShellWindowId_ModalContainer); 197 aura_shell::internal::kShellWindowId_ModalContainer);
198 EXPECT_EQ(modal_container, modal_widget->GetNativeWindow()->parent()); 198 EXPECT_EQ(modal_container, modal_widget->GetNativeWindow()->parent());
199 199
200 modal_widget->Close(); 200 modal_widget->Close();
201 lock_modal_widget->Close(); 201 lock_modal_widget->Close();
202 lock_widget->Close(); 202 lock_widget->Close();
203 widget->Close(); 203 widget->Close();
204 } 204 }
205 205
206 TEST_F(ShellTest, IsScreenLocked) {
207 views::Widget::InitParams widget_params(
208 views::Widget::InitParams::TYPE_WINDOW);
209
210 // A normal window does not lock the screen.
211 views::Widget* widget = CreateTestWindow(widget_params);
212 widget->Show();
213 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
214 widget->Hide();
215 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
216
217 // A modal window with a normal window as parent does not locks the screen.
218 views::Widget* modal_widget = views::Widget::CreateWindowWithParent(
219 new ModalWindow(), widget->GetNativeView());
220 modal_widget->Show();
221 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
222 modal_widget->Close();
223 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
224 widget->Close();
225
226 // A lock screen window locks the screen.
227 views::Widget* lock_widget = CreateTestWindow(widget_params);
228 aura_shell::Shell::GetInstance()->GetContainer(
229 aura_shell::internal::kShellWindowId_LockScreenContainer)->
230 AddChild(lock_widget->GetNativeView());
231 lock_widget->Show();
232 EXPECT_TRUE(Shell::GetInstance()->IsScreenLocked());
233 lock_widget->Hide();
234 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
235
236 // A modal window with a lock window as parent does not lock the screen. The
237 // screen is locked only when a lock windown is visible.
238 views::Widget* lock_modal_widget = views::Widget::CreateWindowWithParent(
239 new ModalWindow(), lock_widget->GetNativeView());
240 lock_modal_widget->Show();
241 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
242 lock_widget->Show();
243 EXPECT_TRUE(Shell::GetInstance()->IsScreenLocked());
244 lock_modal_widget->Close();
245 EXPECT_TRUE(Shell::GetInstance()->IsScreenLocked());
246 lock_widget->Close();
247 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
248 }
249
206 } // namespace test 250 } // namespace test
207 } // namespace aura_shell 251 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/shell_accelerator_controller_unittest.cc ('k') | ui/aura_shell/test/aura_shell_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698