| OLD | NEW |
| 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" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // 1) If the active browser window is in fullscreen and the fullscreen window | 178 // 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 | 179 // 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 | 180 // hidden), locking the screen should not exit fullscreen. The shelf is |
| 181 // auto hidden when in immersive fullscreen. | 181 // auto hidden when in immersive fullscreen. |
| 182 scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester()); | 182 scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester()); |
| 183 BrowserWindow* browser_window = browser()->window(); | 183 BrowserWindow* browser_window = browser()->window(); |
| 184 ash::wm::WindowState* window_state = ash::wm::GetWindowState( | 184 ash::wm::WindowState* window_state = ash::wm::GetWindowState( |
| 185 browser_window->GetNativeWindow()); | 185 browser_window->GetNativeWindow()); |
| 186 { | 186 { |
| 187 Waiter waiter(browser()); | 187 Waiter waiter(browser()); |
| 188 browser()->fullscreen_controller()->ToggleBrowserFullscreenMode(); | 188 browser() |
| 189 ->exclusive_access_manager() |
| 190 ->fullscreen_controller() |
| 191 ->ToggleBrowserFullscreenMode(); |
| 189 waiter.Wait(false /* not locked */, true /* full screen */); | 192 waiter.Wait(false /* not locked */, true /* full screen */); |
| 190 EXPECT_TRUE(browser_window->IsFullscreen()); | 193 EXPECT_TRUE(browser_window->IsFullscreen()); |
| 191 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen()); | 194 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen()); |
| 192 EXPECT_FALSE(tester->IsLocked()); | 195 EXPECT_FALSE(tester->IsLocked()); |
| 193 } | 196 } |
| 194 { | 197 { |
| 195 Waiter waiter(browser()); | 198 Waiter waiter(browser()); |
| 196 ScreenLocker::Show(); | 199 ScreenLocker::Show(); |
| 197 tester->EmulateWindowManagerReady(); | 200 tester->EmulateWindowManagerReady(); |
| 198 waiter.Wait(true /* locked */, true /* full screen */); | 201 waiter.Wait(true /* locked */, true /* full screen */); |
| 199 EXPECT_TRUE(browser_window->IsFullscreen()); | 202 EXPECT_TRUE(browser_window->IsFullscreen()); |
| 200 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen()); | 203 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen()); |
| 201 EXPECT_TRUE(tester->IsLocked()); | 204 EXPECT_TRUE(tester->IsLocked()); |
| 202 } | 205 } |
| 203 UserContext user_context(chromeos::login::kStubUser); | 206 UserContext user_context(chromeos::login::kStubUser); |
| 204 user_context.SetKey(Key("pass")); | 207 user_context.SetKey(Key("pass")); |
| 205 tester->InjectMockAuthenticator(user_context); | 208 tester->InjectMockAuthenticator(user_context); |
| 206 tester->EnterPassword("pass"); | 209 tester->EnterPassword("pass"); |
| 207 content::RunAllPendingInMessageLoop(); | 210 content::RunAllPendingInMessageLoop(); |
| 208 EXPECT_FALSE(tester->IsLocked()); | 211 EXPECT_FALSE(tester->IsLocked()); |
| 209 { | 212 { |
| 210 Waiter waiter(browser()); | 213 Waiter waiter(browser()); |
| 211 browser()->fullscreen_controller()->ToggleBrowserFullscreenMode(); | 214 browser() |
| 215 ->exclusive_access_manager() |
| 216 ->fullscreen_controller() |
| 217 ->ToggleBrowserFullscreenMode(); |
| 212 waiter.Wait(false /* not locked */, false /* fullscreen */); | 218 waiter.Wait(false /* not locked */, false /* fullscreen */); |
| 213 EXPECT_FALSE(browser_window->IsFullscreen()); | 219 EXPECT_FALSE(browser_window->IsFullscreen()); |
| 214 } | 220 } |
| 215 | 221 |
| 216 // 2) If the active browser window is in fullscreen and the fullscreen window | 222 // 2) If the active browser window is in fullscreen and the fullscreen window |
| 217 // has all of the pixels, locking the screen should exit fullscreen. The | 223 // has all of the pixels, locking the screen should exit fullscreen. The |
| 218 // fullscreen window has all of the pixels when in tab fullscreen. | 224 // fullscreen window has all of the pixels when in tab fullscreen. |
| 219 { | 225 { |
| 220 Waiter waiter(browser()); | 226 Waiter waiter(browser()); |
| 221 content::WebContents* web_contents = | 227 content::WebContents* web_contents = |
| 222 browser()->tab_strip_model()->GetActiveWebContents(); | 228 browser()->tab_strip_model()->GetActiveWebContents(); |
| 223 browser()->fullscreen_controller()->EnterFullscreenModeForTab( | 229 browser() |
| 224 web_contents, GURL()); | 230 ->exclusive_access_manager() |
| 231 ->fullscreen_controller() |
| 232 ->EnterFullscreenModeForTab(web_contents, GURL()); |
| 225 waiter.Wait(false /* not locked */, true /* fullscreen */); | 233 waiter.Wait(false /* not locked */, true /* fullscreen */); |
| 226 EXPECT_TRUE(browser_window->IsFullscreen()); | 234 EXPECT_TRUE(browser_window->IsFullscreen()); |
| 227 EXPECT_TRUE(window_state->hide_shelf_when_fullscreen()); | 235 EXPECT_TRUE(window_state->hide_shelf_when_fullscreen()); |
| 228 EXPECT_FALSE(tester->IsLocked()); | 236 EXPECT_FALSE(tester->IsLocked()); |
| 229 } | 237 } |
| 230 { | 238 { |
| 231 Waiter waiter(browser()); | 239 Waiter waiter(browser()); |
| 232 ScreenLocker::Show(); | 240 ScreenLocker::Show(); |
| 233 tester->EmulateWindowManagerReady(); | 241 tester->EmulateWindowManagerReady(); |
| 234 waiter.Wait(true /* locked */, false /* full screen */); | 242 waiter.Wait(true /* locked */, false /* full screen */); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 EXPECT_EQ("", tester->GetPassword()); | 302 EXPECT_EQ("", tester->GetPassword()); |
| 295 | 303 |
| 296 // Close the locker to match expectations. | 304 // Close the locker to match expectations. |
| 297 ScreenLocker::Hide(); | 305 ScreenLocker::Hide(); |
| 298 content::RunAllPendingInMessageLoop(); | 306 content::RunAllPendingInMessageLoop(); |
| 299 EXPECT_FALSE(tester->IsLocked()); | 307 EXPECT_FALSE(tester->IsLocked()); |
| 300 EXPECT_TRUE(VerifyLockScreenDismissed()); | 308 EXPECT_TRUE(VerifyLockScreenDismissed()); |
| 301 } | 309 } |
| 302 | 310 |
| 303 } // namespace chromeos | 311 } // namespace chromeos |
| OLD | NEW |