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

Side by Side Diff: ash/shell_unittest.cc

Issue 9181012: Don't activate a window if screen is locked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/ash_switches.h" 5 #include "ash/ash_switches.h"
6 #include "ash/shell.h" 6 #include "ash/shell.h"
7 #include "ash/shell_window_ids.h" 7 #include "ash/shell_window_ids.h"
8 #include "ash/test/aura_shell_test_base.h" 8 #include "ash/test/aura_shell_test_base.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 views::Widget* modal_widget = views::Widget::CreateWindowWithParent( 235 views::Widget* modal_widget = views::Widget::CreateWindowWithParent(
236 new ModalWindow(), widget->GetNativeView()); 236 new ModalWindow(), widget->GetNativeView());
237 modal_widget->Show(); 237 modal_widget->Show();
238 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked()); 238 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
239 modal_widget->Close(); 239 modal_widget->Close();
240 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked()); 240 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
241 widget->Close(); 241 widget->Close();
242 242
243 // A lock screen window locks the screen. 243 // A lock screen window locks the screen.
244 views::Widget* lock_widget = CreateTestWindow(widget_params); 244 views::Widget* lock_widget = CreateTestWindow(widget_params);
245 ash::Shell::GetInstance()->GetContainer( 245 lock_widget->GetNativeView()->set_stops_event_propagation(true);
246 ash::internal::kShellWindowId_LockScreenContainer)-> 246 lock_widget->GetNativeView()->SetParent(NULL);
247 AddChild(lock_widget->GetNativeView());
248 lock_widget->Show(); 247 lock_widget->Show();
249 EXPECT_TRUE(Shell::GetInstance()->IsScreenLocked()); 248 EXPECT_TRUE(Shell::GetInstance()->IsScreenLocked());
250 lock_widget->Hide(); 249 lock_widget->Hide();
251 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked()); 250 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
252 251
253 // A modal window with a lock window as parent does not lock the screen. The 252 // A modal window with a lock window as parent does not lock the screen. The
254 // screen is locked only when a lock windown is visible. 253 // screen is locked only when a lock windown is visible.
255 views::Widget* lock_modal_widget = views::Widget::CreateWindowWithParent( 254 views::Widget* lock_modal_widget = views::Widget::CreateWindowWithParent(
256 new ModalWindow(), lock_widget->GetNativeView()); 255 new ModalWindow(), lock_widget->GetNativeView());
257 lock_modal_widget->Show(); 256 lock_modal_widget->Show();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // Even for a large screen, the user can force compact mode. 294 // Even for a large screen, the user can force compact mode.
296 monitor_size.SetSize(1920, 1080); 295 monitor_size.SetSize(1920, 1080);
297 CommandLine command_line2(CommandLine::NO_PROGRAM); 296 CommandLine command_line2(CommandLine::NO_PROGRAM);
298 command_line2.AppendSwitchASCII(ash::switches::kAuraWindowMode, 297 command_line2.AppendSwitchASCII(ash::switches::kAuraWindowMode,
299 ash::switches::kAuraWindowModeCompact); 298 ash::switches::kAuraWindowModeCompact);
300 EXPECT_EQ(Shell::COMPACT_MODE, 299 EXPECT_EQ(Shell::COMPACT_MODE,
301 shell->ComputeWindowMode(monitor_size, &command_line2)); 300 shell->ComputeWindowMode(monitor_size, &command_line2));
302 } 301 }
303 302
304 } // namespace ash 303 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698