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

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

Issue 836933005: Refactor fullscreen_controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build break Created 5 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
« no previous file with comments | « no previous file | chrome/browser/ui/browser.h » ('j') | chrome/browser/ui/browser.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // 1) If the active browser window is in fullscreen and the fullscreen window 179 // 1) If the active browser window is in fullscreen and the fullscreen window
180 // does not have all the pixels (e.g. the shelf is auto hidden instead of 180 // does not have all the pixels (e.g. the shelf is auto hidden instead of
181 // hidden), locking the screen should not exit fullscreen. The shelf is 181 // hidden), locking the screen should not exit fullscreen. The shelf is
182 // auto hidden when in immersive fullscreen. 182 // auto hidden when in immersive fullscreen.
183 scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester()); 183 scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester());
184 BrowserWindow* browser_window = browser()->window(); 184 BrowserWindow* browser_window = browser()->window();
185 ash::wm::WindowState* window_state = ash::wm::GetWindowState( 185 ash::wm::WindowState* window_state = ash::wm::GetWindowState(
186 browser_window->GetNativeWindow()); 186 browser_window->GetNativeWindow());
187 { 187 {
188 Waiter waiter(browser()); 188 Waiter waiter(browser());
189 browser()->fullscreen_controller()->ToggleBrowserFullscreenMode(); 189 browser()
190 ->GetExclusiveAccessManager()
191 ->GetFullscreenController()
192 ->ToggleBrowserFullscreenMode();
190 waiter.Wait(false /* not locked */, true /* full screen */); 193 waiter.Wait(false /* not locked */, true /* full screen */);
191 EXPECT_TRUE(browser_window->IsFullscreen()); 194 EXPECT_TRUE(browser_window->IsFullscreen());
192 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen()); 195 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen());
193 EXPECT_FALSE(tester->IsLocked()); 196 EXPECT_FALSE(tester->IsLocked());
194 } 197 }
195 { 198 {
196 Waiter waiter(browser()); 199 Waiter waiter(browser());
197 ScreenLocker::Show(); 200 ScreenLocker::Show();
198 tester->EmulateWindowManagerReady(); 201 tester->EmulateWindowManagerReady();
199 waiter.Wait(true /* locked */, true /* full screen */); 202 waiter.Wait(true /* locked */, true /* full screen */);
200 EXPECT_TRUE(browser_window->IsFullscreen()); 203 EXPECT_TRUE(browser_window->IsFullscreen());
201 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen()); 204 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen());
202 EXPECT_TRUE(tester->IsLocked()); 205 EXPECT_TRUE(tester->IsLocked());
203 } 206 }
204 UserContext user_context(chromeos::login::kStubUser); 207 UserContext user_context(chromeos::login::kStubUser);
205 user_context.SetKey(Key("pass")); 208 user_context.SetKey(Key("pass"));
206 tester->InjectMockAuthenticator(user_context); 209 tester->InjectMockAuthenticator(user_context);
207 tester->EnterPassword("pass"); 210 tester->EnterPassword("pass");
208 content::RunAllPendingInMessageLoop(); 211 content::RunAllPendingInMessageLoop();
209 EXPECT_FALSE(tester->IsLocked()); 212 EXPECT_FALSE(tester->IsLocked());
210 { 213 {
211 Waiter waiter(browser()); 214 Waiter waiter(browser());
212 browser()->fullscreen_controller()->ToggleBrowserFullscreenMode(); 215 browser()
216 ->GetExclusiveAccessManager()
217 ->GetFullscreenController()
218 ->ToggleBrowserFullscreenMode();
213 waiter.Wait(false /* not locked */, false /* fullscreen */); 219 waiter.Wait(false /* not locked */, false /* fullscreen */);
214 EXPECT_FALSE(browser_window->IsFullscreen()); 220 EXPECT_FALSE(browser_window->IsFullscreen());
215 } 221 }
216 222
217 // 2) If the active browser window is in fullscreen and the fullscreen window 223 // 2) If the active browser window is in fullscreen and the fullscreen window
218 // has all of the pixels, locking the screen should exit fullscreen. The 224 // has all of the pixels, locking the screen should exit fullscreen. The
219 // fullscreen window has all of the pixels when in tab fullscreen. 225 // fullscreen window has all of the pixels when in tab fullscreen.
220 { 226 {
221 Waiter waiter(browser()); 227 Waiter waiter(browser());
222 content::WebContents* web_contents = 228 content::WebContents* web_contents =
223 browser()->tab_strip_model()->GetActiveWebContents(); 229 browser()->tab_strip_model()->GetActiveWebContents();
224 browser()->fullscreen_controller()->ToggleFullscreenModeForTab( 230 browser()
225 web_contents, true); 231 ->GetExclusiveAccessManager()
232 ->GetFullscreenController()
233 ->ToggleFullscreenModeForTab(web_contents, true);
226 waiter.Wait(false /* not locked */, true /* fullscreen */); 234 waiter.Wait(false /* not locked */, true /* fullscreen */);
227 EXPECT_TRUE(browser_window->IsFullscreen()); 235 EXPECT_TRUE(browser_window->IsFullscreen());
228 EXPECT_TRUE(window_state->hide_shelf_when_fullscreen()); 236 EXPECT_TRUE(window_state->hide_shelf_when_fullscreen());
229 EXPECT_FALSE(tester->IsLocked()); 237 EXPECT_FALSE(tester->IsLocked());
230 } 238 }
231 { 239 {
232 Waiter waiter(browser()); 240 Waiter waiter(browser());
233 ScreenLocker::Show(); 241 ScreenLocker::Show();
234 tester->EmulateWindowManagerReady(); 242 tester->EmulateWindowManagerReady();
235 waiter.Wait(true /* locked */, false /* full screen */); 243 waiter.Wait(true /* locked */, false /* full screen */);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 EXPECT_EQ("", tester->GetPassword()); 303 EXPECT_EQ("", tester->GetPassword());
296 304
297 // Close the locker to match expectations. 305 // Close the locker to match expectations.
298 ScreenLocker::Hide(); 306 ScreenLocker::Hide();
299 content::RunAllPendingInMessageLoop(); 307 content::RunAllPendingInMessageLoop();
300 EXPECT_FALSE(tester->IsLocked()); 308 EXPECT_FALSE(tester->IsLocked());
301 EXPECT_TRUE(VerifyLockScreenDismissed()); 309 EXPECT_TRUE(VerifyLockScreenDismissed());
302 } 310 }
303 311
304 } // namespace chromeos 312 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser.h » ('j') | chrome/browser/ui/browser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698