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

Side by Side Diff: chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc

Issue 1356713004: Fix crash when locking screen while adding a user to an existing session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Proper fix Created 5 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/chromeos/login/lock/screen_locker.h" 5 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
6 6
7 #include "ash/wm/window_state.h" 7 #include "ash/wm/window_state.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" 12 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h"
13 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
13 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_window.h" 16 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 17 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
19 #include "chrome/test/base/in_process_browser_test.h" 20 #include "chrome/test/base/in_process_browser_test.h"
20 #include "chromeos/chromeos_switches.h" 21 #include "chromeos/chromeos_switches.h"
21 #include "chromeos/dbus/dbus_thread_manager.h" 22 #include "chromeos/dbus/dbus_thread_manager.h"
22 #include "chromeos/dbus/fake_session_manager_client.h" 23 #include "chromeos/dbus/fake_session_manager_client.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // Successful authentication clears the lock screen and tells the 167 // Successful authentication clears the lock screen and tells the
167 // SessionManager to announce this over DBus. 168 // SessionManager to announce this over DBus.
168 EXPECT_FALSE(tester->IsLocked()); 169 EXPECT_FALSE(tester->IsLocked());
169 EXPECT_EQ( 170 EXPECT_EQ(
170 1, 171 1,
171 fake_session_manager_client_->notify_lock_screen_shown_call_count()); 172 fake_session_manager_client_->notify_lock_screen_shown_call_count());
172 173
173 EXPECT_TRUE(VerifyLockScreenDismissed()); 174 EXPECT_TRUE(VerifyLockScreenDismissed());
174 } 175 }
175 176
177 // Makes sure Chrome doesn't crash if we lock the screen during an add-user
178 // flow. Regression test for crbug.com/467111.
179 IN_PROC_BROWSER_TEST_F(ScreenLockerTest, LockScreenWhileAddingUser) {
180 UserAddingScreen::Get()->Start();
181 content::RunAllPendingInMessageLoop();
182 ScreenLocker::HandleLockScreenRequest();
183 }
184
176 // Test how locking the screen affects an active fullscreen window. 185 // Test how locking the screen affects an active fullscreen window.
177 IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestFullscreenExit) { 186 IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestFullscreenExit) {
178 // 1) If the active browser window is in fullscreen and the fullscreen window 187 // 1) If the active browser window is in fullscreen and the fullscreen window
179 // does not have all the pixels (e.g. the shelf is auto hidden instead of 188 // does not have all the pixels (e.g. the shelf is auto hidden instead of
180 // hidden), locking the screen should not exit fullscreen. The shelf is 189 // hidden), locking the screen should not exit fullscreen. The shelf is
181 // auto hidden when in immersive fullscreen. 190 // auto hidden when in immersive fullscreen.
182 scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester()); 191 scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester());
183 BrowserWindow* browser_window = browser()->window(); 192 BrowserWindow* browser_window = browser()->window();
184 ash::wm::WindowState* window_state = ash::wm::GetWindowState( 193 ash::wm::WindowState* window_state = ash::wm::GetWindowState(
185 browser_window->GetNativeWindow()); 194 browser_window->GetNativeWindow());
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 EXPECT_EQ("", tester->GetPassword()); 311 EXPECT_EQ("", tester->GetPassword());
303 312
304 // Close the locker to match expectations. 313 // Close the locker to match expectations.
305 ScreenLocker::Hide(); 314 ScreenLocker::Hide();
306 content::RunAllPendingInMessageLoop(); 315 content::RunAllPendingInMessageLoop();
307 EXPECT_FALSE(tester->IsLocked()); 316 EXPECT_FALSE(tester->IsLocked());
308 EXPECT_TRUE(VerifyLockScreenDismissed()); 317 EXPECT_TRUE(VerifyLockScreenDismissed());
309 } 318 }
310 319
311 } // namespace chromeos 320 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698