OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
8 #include "chrome/browser/fullscreen.h" | 8 #include "chrome/browser/fullscreen.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 browser() | 57 browser() |
58 ->tab_strip_model() | 58 ->tab_strip_model() |
59 ->GetActiveWebContents() | 59 ->GetActiveWebContents() |
60 ->GetRenderViewHost() | 60 ->GetRenderViewHost() |
61 ->GetWidget() | 61 ->GetWidget() |
62 ->GetView() | 62 ->GetView() |
63 ->IsMouseLocked()); | 63 ->IsMouseLocked()); |
64 return browser()->IsMouseLocked(); | 64 return browser()->IsMouseLocked(); |
65 } | 65 } |
66 | 66 |
67 void TestFullscreenMouseLockContentSettings(); | |
68 | |
69 private: | 67 private: |
70 void ToggleTabFullscreen_Internal(bool enter_fullscreen, | 68 void ToggleTabFullscreen_Internal(bool enter_fullscreen, |
71 bool retry_until_success); | 69 bool retry_until_success); |
72 }; | 70 }; |
73 | 71 |
74 // Allow the test harness to pick the non-simplified fullscreen UI, which | 72 // Allow the test harness to pick the non-simplified fullscreen UI, which |
75 // prompts with an interactive dialog rather than just notifying the user how to | 73 // prompts with an interactive dialog rather than just notifying the user how to |
76 // exit fullscreen. TODO(tapted): Remove this when "simplified" is the only way. | 74 // exit fullscreen. TODO(tapted): Remove this when "simplified" is the only way. |
77 enum TestType { | 75 enum TestType { |
78 TEST_TYPE_START, | 76 TEST_TYPE_START, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 ASSERT_EQ(browser()->window()->IsFullscreen(), !enter_fullscreen); | 128 ASSERT_EQ(browser()->window()->IsFullscreen(), !enter_fullscreen); |
131 FullscreenNotificationObserver fullscreen_observer; | 129 FullscreenNotificationObserver fullscreen_observer; |
132 | 130 |
133 chrome::ToggleFullscreenMode(browser()); | 131 chrome::ToggleFullscreenMode(browser()); |
134 | 132 |
135 fullscreen_observer.Wait(); | 133 fullscreen_observer.Wait(); |
136 ASSERT_EQ(browser()->window()->IsFullscreen(), enter_fullscreen); | 134 ASSERT_EQ(browser()->window()->IsFullscreen(), enter_fullscreen); |
137 ASSERT_EQ(IsFullscreenForBrowser(), enter_fullscreen); | 135 ASSERT_EQ(IsFullscreenForBrowser(), enter_fullscreen); |
138 } | 136 } |
139 | 137 |
140 // Helper method to be called by multiple tests. | |
141 // Tests Fullscreen and Mouse Lock with varying content settings ALLOW & BLOCK. | |
142 void | |
143 FullscreenControllerInteractiveTest::TestFullscreenMouseLockContentSettings() { | |
144 GURL url = embedded_test_server()->GetURL("/simple.html"); | |
145 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); | |
146 | |
147 // Validate that going fullscreen for a URL defaults to asking permision. | |
148 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
149 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); | |
150 ASSERT_TRUE(IsFullscreenPermissionRequested()); | |
151 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(false)); | |
152 | |
153 // Add content setting to ALLOW fullscreen. | |
154 HostContentSettingsMap* settings_map = | |
155 HostContentSettingsMapFactory::GetForProfile(browser()->profile()); | |
156 settings_map->SetContentSettingDefaultScope( | |
157 url, url, CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string(), | |
158 CONTENT_SETTING_ALLOW); | |
159 | |
160 // Now, fullscreen should not prompt for permission. | |
161 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
162 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); | |
163 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
164 | |
165 // Leaving tab in fullscreen, now test mouse lock ALLOW: | |
166 | |
167 // Validate that mouse lock defaults to asking permision. | |
168 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
169 RequestToLockMouse(true, false); | |
170 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
171 LostMouseLock(); | |
172 | |
173 // Add content setting to ALLOW mouse lock. | |
174 settings_map->SetContentSettingDefaultScope( | |
175 url, GURL(), CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string(), | |
176 CONTENT_SETTING_ALLOW); | |
177 | |
178 // Now, mouse lock should not prompt for permission. | |
179 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
180 RequestToLockMouse(true, false); | |
181 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
182 LostMouseLock(); | |
183 | |
184 // Leaving tab in fullscreen, now test mouse lock BLOCK: | |
185 | |
186 // Add content setting to BLOCK mouse lock. | |
187 settings_map->SetContentSettingDefaultScope( | |
188 url, GURL(), CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string(), | |
189 CONTENT_SETTING_BLOCK); | |
190 | |
191 // Now, mouse lock should not be pending. | |
192 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
193 RequestToLockMouse(true, false); | |
194 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
195 } | |
196 | |
197 void FullscreenControllerInteractiveTest::ToggleTabFullscreen_Internal( | 138 void FullscreenControllerInteractiveTest::ToggleTabFullscreen_Internal( |
198 bool enter_fullscreen, bool retry_until_success) { | 139 bool enter_fullscreen, bool retry_until_success) { |
199 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 140 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
200 do { | 141 do { |
201 FullscreenNotificationObserver fullscreen_observer; | 142 FullscreenNotificationObserver fullscreen_observer; |
202 if (enter_fullscreen) | 143 if (enter_fullscreen) |
203 browser()->EnterFullscreenModeForTab(tab, GURL()); | 144 browser()->EnterFullscreenModeForTab(tab, GURL()); |
204 else | 145 else |
205 browser()->ExitFullscreenModeForTab(tab); | 146 browser()->ExitFullscreenModeForTab(tab); |
206 fullscreen_observer.Wait(); | 147 fullscreen_observer.Wait(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 181 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
241 DISABLED_TestTabExitsItselfFromFullscreen) { | 182 DISABLED_TestTabExitsItselfFromFullscreen) { |
242 ASSERT_TRUE(embedded_test_server()->Start()); | 183 ASSERT_TRUE(embedded_test_server()->Start()); |
243 | 184 |
244 AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); | 185 AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); |
245 | 186 |
246 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); | 187 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); |
247 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(false)); | 188 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(false)); |
248 } | 189 } |
249 | 190 |
250 // Tests entering fullscreen and then requesting mouse lock results in | |
251 // buttons for the user, and that after confirming the buttons are dismissed. | |
252 // Test is flaky: http://crbug.com/146006 | |
253 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | |
254 DISABLED_TestFullscreenBubbleMouseLockState) { | |
255 ASSERT_TRUE(embedded_test_server()->Start()); | |
256 | |
257 AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); | |
258 AddTabAtIndex(1, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); | |
259 | |
260 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); | |
261 | |
262 // Request mouse lock and verify the bubble is waiting for user confirmation. | |
263 RequestToLockMouse(true, false); | |
264 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
265 | |
266 // Accept mouse lock and verify bubble no longer shows confirmation buttons. | |
267 AcceptCurrentFullscreenOrMouseLockRequest(); | |
268 ASSERT_FALSE(IsFullscreenBubbleDisplayingButtons()); | |
269 } | |
270 | |
271 // Tests fullscreen and Mouse Lock with varying content settings ALLOW & BLOCK. | |
272 // http://crbug.com/146006 | |
273 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | |
274 DISABLED_FullscreenMouseLockContentSettings) { | |
275 TestFullscreenMouseLockContentSettings(); | |
276 } | |
277 | |
278 // Tests fullscreen and Mouse Lock with varying content settings ALLOW & BLOCK, | |
279 // but with the browser initiated in fullscreen mode first. | |
280 // Test is flaky: http://crbug.com/103912, http://crbug.com/146006 | |
281 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | |
282 DISABLED_BrowserFullscreenMouseLockContentSettings) { | |
283 // Enter browser fullscreen first. | |
284 ASSERT_NO_FATAL_FAILURE(ToggleBrowserFullscreen(true)); | |
285 TestFullscreenMouseLockContentSettings(); | |
286 ASSERT_NO_FATAL_FAILURE(ToggleBrowserFullscreen(false)); | |
287 } | |
288 | |
289 // Tests Fullscreen entered in Browser, then Tab mode, then exited via Browser. | 191 // Tests Fullscreen entered in Browser, then Tab mode, then exited via Browser. |
290 // Test is flaky: http://crbug.com/146006 | 192 // Test is flaky: http://crbug.com/146006 |
291 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 193 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
292 DISABLED_BrowserFullscreenExit) { | 194 DISABLED_BrowserFullscreenExit) { |
293 // Enter browser fullscreen. | 195 // Enter browser fullscreen. |
294 ASSERT_NO_FATAL_FAILURE(ToggleBrowserFullscreen(true)); | 196 ASSERT_NO_FATAL_FAILURE(ToggleBrowserFullscreen(true)); |
295 | 197 |
296 // Enter tab fullscreen. | 198 // Enter tab fullscreen. |
297 AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); | 199 AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); |
298 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); | 200 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); |
(...skipping 22 matching lines...) Expand all Loading... |
321 // Tests fullscreen entered without permision prompt for file:// urls. | 223 // Tests fullscreen entered without permision prompt for file:// urls. |
322 // Test is flaky: http://crbug.com/146006 | 224 // Test is flaky: http://crbug.com/146006 |
323 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 225 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
324 DISABLED_FullscreenFileURL) { | 226 DISABLED_FullscreenFileURL) { |
325 ui_test_utils::NavigateToURL( | 227 ui_test_utils::NavigateToURL( |
326 browser(), ui_test_utils::GetTestUrl( | 228 browser(), ui_test_utils::GetTestUrl( |
327 base::FilePath(base::FilePath::kCurrentDirectory), | 229 base::FilePath(base::FilePath::kCurrentDirectory), |
328 base::FilePath(kSimpleFile))); | 230 base::FilePath(kSimpleFile))); |
329 | 231 |
330 // Validate that going fullscreen for a file does not ask permision. | 232 // Validate that going fullscreen for a file does not ask permision. |
331 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
332 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); | 233 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); |
333 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
334 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(false)); | 234 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(false)); |
335 } | 235 } |
336 | 236 |
337 // Tests fullscreen is exited on page navigation. | 237 // Tests fullscreen is exited on page navigation. |
338 // Test is flaky: http://crbug.com/146006 | 238 // Test is flaky: http://crbug.com/146006 |
339 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 239 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
340 DISABLED_TestTabExitsFullscreenOnNavigation) { | 240 DISABLED_TestTabExitsFullscreenOnNavigation) { |
341 ASSERT_TRUE(embedded_test_server()->Start()); | 241 ASSERT_TRUE(embedded_test_server()->Start()); |
342 | 242 |
343 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 243 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 349 |
450 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 350 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
451 | 351 |
452 // Request to lock the mouse. | 352 // Request to lock the mouse. |
453 { | 353 { |
454 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 354 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
455 browser(), ui::VKEY_1, false, false, false, false, | 355 browser(), ui::VKEY_1, false, false, false, false, |
456 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 356 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
457 content::NotificationService::AllSources())); | 357 content::NotificationService::AllSources())); |
458 } | 358 } |
459 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
460 | |
461 // In simplified mode, the mouse will automatically lock, so we can skip | |
462 // testing the permission requested and manually accepting. | |
463 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | |
464 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
465 | |
466 // Escape, no prompts should remain. | |
467 SendEscapeToFullscreenController(); | |
468 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
469 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
470 | |
471 // Request to lock the mouse. | |
472 { | |
473 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | |
474 browser(), ui::VKEY_1, false, false, false, false, | |
475 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | |
476 content::NotificationService::AllSources())); | |
477 } | |
478 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
479 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
480 | |
481 // Accept mouse lock, confirm it and that there is no prompt. | |
482 AcceptCurrentFullscreenOrMouseLockRequest(); | |
483 } | |
484 | 359 |
485 ASSERT_TRUE(IsMouseLocked()); | 360 ASSERT_TRUE(IsMouseLocked()); |
486 ASSERT_FALSE(IsWindowFullscreenForTabOrPending()); | 361 ASSERT_FALSE(IsWindowFullscreenForTabOrPending()); |
487 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
488 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
489 | 362 |
490 // Escape, confirm we are out of mouse lock with no prompts. | 363 // Escape, confirm we are out of mouse lock with no prompts. |
491 SendEscapeToFullscreenController(); | 364 SendEscapeToFullscreenController(); |
492 ASSERT_FALSE(IsMouseLocked()); | 365 ASSERT_FALSE(IsMouseLocked()); |
493 ASSERT_FALSE(IsWindowFullscreenForTabOrPending()); | 366 ASSERT_FALSE(IsWindowFullscreenForTabOrPending()); |
494 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
495 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
496 } | 367 } |
497 | 368 |
498 // Tests mouse lock and fullscreen modes can be escaped with ESC key. | 369 // Tests mouse lock and fullscreen modes can be escaped with ESC key. |
499 // Test is flaky: http://crbug.com/146006 | 370 // Test is flaky: http://crbug.com/146006 |
500 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 371 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
501 DISABLED_EscapingMouseLockAndFullscreen) { | 372 DISABLED_EscapingMouseLockAndFullscreen) { |
502 ASSERT_TRUE(embedded_test_server()->Start()); | 373 ASSERT_TRUE(embedded_test_server()->Start()); |
503 ui_test_utils::NavigateToURL( | 374 ui_test_utils::NavigateToURL( |
504 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); | 375 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); |
505 | 376 |
506 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 377 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
507 | 378 |
508 // Request to lock the mouse and enter fullscreen. | 379 // Request to lock the mouse and enter fullscreen. |
509 { | 380 { |
510 FullscreenNotificationObserver fullscreen_observer; | 381 FullscreenNotificationObserver fullscreen_observer; |
511 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 382 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
512 browser(), ui::VKEY_B, false, true, false, false, | 383 browser(), ui::VKEY_B, false, true, false, false, |
513 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 384 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
514 content::NotificationService::AllSources())); | 385 content::NotificationService::AllSources())); |
515 fullscreen_observer.Wait(); | 386 fullscreen_observer.Wait(); |
516 } | 387 } |
517 ASSERT_TRUE(IsFullscreenPermissionRequested()); | |
518 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
519 | 388 |
520 // Escape, no prompts should remain. | 389 // Escape, no prompts should remain. |
521 { | 390 { |
522 FullscreenNotificationObserver fullscreen_observer; | 391 FullscreenNotificationObserver fullscreen_observer; |
523 SendEscapeToFullscreenController(); | 392 SendEscapeToFullscreenController(); |
524 fullscreen_observer.Wait(); | 393 fullscreen_observer.Wait(); |
525 } | 394 } |
526 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
527 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
528 | |
529 // Request to lock the mouse and enter fullscreen. | |
530 { | |
531 FullscreenNotificationObserver fullscreen_observer; | |
532 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | |
533 browser(), ui::VKEY_B, false, true, false, false, | |
534 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | |
535 content::NotificationService::AllSources())); | |
536 fullscreen_observer.Wait(); | |
537 } | |
538 ASSERT_TRUE(IsFullscreenPermissionRequested()); | |
539 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
540 | |
541 // Accept both, confirm mouse lock and fullscreen and no prompts. | |
542 AcceptCurrentFullscreenOrMouseLockRequest(); | |
543 ASSERT_TRUE(IsMouseLocked()); | |
544 ASSERT_TRUE(IsWindowFullscreenForTabOrPending()); | |
545 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
546 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
547 | |
548 // Escape, confirm we are out of mouse lock and fullscreen with no prompts. | |
549 { | |
550 FullscreenNotificationObserver fullscreen_observer; | |
551 SendEscapeToFullscreenController(); | |
552 fullscreen_observer.Wait(); | |
553 } | |
554 ASSERT_FALSE(IsMouseLocked()); | 395 ASSERT_FALSE(IsMouseLocked()); |
555 ASSERT_FALSE(IsWindowFullscreenForTabOrPending()); | 396 ASSERT_FALSE(IsWindowFullscreenForTabOrPending()); |
556 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
557 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
558 } | 397 } |
559 | 398 |
560 // Tests mouse lock then fullscreen. | 399 // Tests mouse lock then fullscreen. |
561 // Test is flaky: http://crbug.com/146006 | 400 // Test is flaky: http://crbug.com/146006 |
562 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 401 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
563 DISABLED_MouseLockThenFullscreen) { | 402 DISABLED_MouseLockThenFullscreen) { |
564 ASSERT_TRUE(embedded_test_server()->Start()); | 403 ASSERT_TRUE(embedded_test_server()->Start()); |
565 ui_test_utils::NavigateToURL( | 404 ui_test_utils::NavigateToURL( |
566 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); | 405 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); |
567 | 406 |
568 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 407 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
569 | 408 |
570 // Lock the mouse without a user gesture, expect no response. | 409 // Lock the mouse without a user gesture, expect no response. |
571 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 410 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
572 browser(), ui::VKEY_D, false, false, false, false, | 411 browser(), ui::VKEY_D, false, false, false, false, |
573 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 412 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
574 content::NotificationService::AllSources())); | 413 content::NotificationService::AllSources())); |
575 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 414 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
576 ASSERT_FALSE(IsMouseLocked()); | 415 ASSERT_FALSE(IsMouseLocked()); |
577 | 416 |
578 // Lock the mouse with a user gesture. | 417 // Lock the mouse with a user gesture. |
579 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 418 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
580 browser(), ui::VKEY_1, false, false, false, false, | 419 browser(), ui::VKEY_1, false, false, false, false, |
581 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 420 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
582 content::NotificationService::AllSources())); | 421 content::NotificationService::AllSources())); |
583 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 422 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
584 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 423 ASSERT_TRUE(IsMouseLocked()); |
585 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
586 ASSERT_FALSE(IsMouseLocked()); | |
587 | 424 |
588 // Accept mouse lock. | 425 // Enter fullscreen mode, mouse should remain locked. |
589 AcceptCurrentFullscreenOrMouseLockRequest(); | |
590 ASSERT_TRUE(IsMouseLocked()); | |
591 ASSERT_FALSE(IsFullscreenBubbleDisplayingButtons()); | |
592 | |
593 // Enter fullscreen mode, mouse lock should be dropped to present buttons. | |
594 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); | 426 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); |
595 ASSERT_TRUE(IsFullscreenPermissionRequested()); | |
596 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
597 ASSERT_FALSE(IsMouseLocked()); | |
598 | |
599 // Request mouse lock also, expect fullscreen and mouse lock buttons. | |
600 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | |
601 browser(), ui::VKEY_1, false, false, false, false, | |
602 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | |
603 content::NotificationService::AllSources())); | |
604 ASSERT_TRUE(IsFullscreenPermissionRequested()); | |
605 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
606 ASSERT_FALSE(IsMouseLocked()); | |
607 | |
608 // Accept fullscreen and mouse lock. | |
609 AcceptCurrentFullscreenOrMouseLockRequest(); | |
610 ASSERT_TRUE(IsMouseLocked()); | 427 ASSERT_TRUE(IsMouseLocked()); |
611 ASSERT_TRUE(IsWindowFullscreenForTabOrPending()); | 428 ASSERT_TRUE(IsWindowFullscreenForTabOrPending()); |
612 ASSERT_FALSE(IsFullscreenBubbleDisplayingButtons()); | |
613 } | 429 } |
614 | 430 |
615 // Times out sometimes on Linux. http://crbug.com/135115 | 431 // Times out sometimes on Linux. http://crbug.com/135115 |
616 // Mac: http://crbug.com/103912 | 432 // Mac: http://crbug.com/103912 |
617 // Windows: Failing flakily on try jobs also. | 433 // Windows: Failing flakily on try jobs also. |
618 // Tests mouse lock then fullscreen in same request. | 434 // Tests mouse lock then fullscreen in same request. |
619 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 435 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
620 DISABLED_MouseLockAndFullscreen) { | 436 DISABLED_MouseLockAndFullscreen) { |
621 ASSERT_TRUE(embedded_test_server()->Start()); | 437 ASSERT_TRUE(embedded_test_server()->Start()); |
622 ui_test_utils::NavigateToURL( | 438 ui_test_utils::NavigateToURL( |
623 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); | 439 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); |
624 | 440 |
625 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 441 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
626 | 442 |
627 // Request to lock the mouse and enter fullscreen. | 443 // Request to lock the mouse and enter fullscreen. |
628 { | 444 { |
629 FullscreenNotificationObserver fullscreen_observer; | 445 FullscreenNotificationObserver fullscreen_observer; |
630 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 446 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
631 browser(), ui::VKEY_B, false, true, false, false, | 447 browser(), ui::VKEY_B, false, true, false, false, |
632 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 448 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
633 content::NotificationService::AllSources())); | 449 content::NotificationService::AllSources())); |
634 fullscreen_observer.Wait(); | 450 fullscreen_observer.Wait(); |
635 } | 451 } |
636 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 452 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
637 ASSERT_TRUE(IsFullscreenPermissionRequested()); | |
638 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
639 ASSERT_FALSE(IsMouseLocked()); | |
640 ASSERT_TRUE(IsWindowFullscreenForTabOrPending()); | |
641 | |
642 // Deny both first, to make sure we can. | |
643 { | |
644 FullscreenNotificationObserver fullscreen_observer; | |
645 DenyCurrentFullscreenOrMouseLockRequest(); | |
646 fullscreen_observer.Wait(); | |
647 } | |
648 ASSERT_FALSE(IsMouseLocked()); | |
649 ASSERT_FALSE(IsWindowFullscreenForTabOrPending()); | |
650 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
651 | |
652 // Request to lock the mouse and enter fullscreen. | |
653 { | |
654 FullscreenNotificationObserver fullscreen_observer; | |
655 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | |
656 browser(), ui::VKEY_B, false, true, false, false, | |
657 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | |
658 content::NotificationService::AllSources())); | |
659 fullscreen_observer.Wait(); | |
660 } | |
661 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | |
662 ASSERT_TRUE(IsFullscreenPermissionRequested()); | |
663 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
664 ASSERT_FALSE(IsMouseLocked()); | |
665 ASSERT_TRUE(IsWindowFullscreenForTabOrPending()); | |
666 | |
667 // Accept both, confirm they are enabled and there is no prompt. | |
668 AcceptCurrentFullscreenOrMouseLockRequest(); | |
669 ASSERT_TRUE(IsMouseLocked()); | 453 ASSERT_TRUE(IsMouseLocked()); |
670 ASSERT_TRUE(IsWindowFullscreenForTabOrPending()); | 454 ASSERT_TRUE(IsWindowFullscreenForTabOrPending()); |
671 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
672 } | 455 } |
673 | 456 |
674 // Tests mouse lock and fullscreen for the privileged fullscreen case (e.g., | 457 // Tests mouse lock and fullscreen for the privileged fullscreen case (e.g., |
675 // embedded flash fullscreen, since the Flash plugin handles user permissions | 458 // embedded flash fullscreen, since the Flash plugin handles user permissions |
676 // requests itself). | 459 // requests itself). |
677 // Test is flaky: http://crbug.com/146006 | 460 // Test is flaky: http://crbug.com/146006 |
678 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 461 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
679 DISABLED_PrivilegedMouseLockAndFullscreen) { | 462 DISABLED_PrivilegedMouseLockAndFullscreen) { |
680 ASSERT_TRUE(embedded_test_server()->Start()); | 463 ASSERT_TRUE(embedded_test_server()->Start()); |
681 ui_test_utils::NavigateToURL( | 464 ui_test_utils::NavigateToURL( |
682 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); | 465 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); |
683 | 466 |
684 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 467 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
685 | 468 |
686 SetPrivilegedFullscreen(true); | 469 SetPrivilegedFullscreen(true); |
687 | 470 |
688 // Request to lock the mouse and enter fullscreen. | 471 // Request to lock the mouse and enter fullscreen. |
689 FullscreenNotificationObserver fullscreen_observer; | 472 FullscreenNotificationObserver fullscreen_observer; |
690 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 473 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
691 browser(), ui::VKEY_B, false, true, false, false, | 474 browser(), ui::VKEY_B, false, true, false, false, |
692 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 475 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
693 content::NotificationService::AllSources())); | 476 content::NotificationService::AllSources())); |
694 fullscreen_observer.Wait(); | 477 fullscreen_observer.Wait(); |
695 | 478 |
696 // Confirm they are enabled and there is no prompt. | 479 // Confirm they are enabled and there is no prompt. |
697 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 480 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
698 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
699 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
700 ASSERT_TRUE(IsMouseLocked()); | 481 ASSERT_TRUE(IsMouseLocked()); |
701 ASSERT_TRUE(IsWindowFullscreenForTabOrPending()); | 482 ASSERT_TRUE(IsWindowFullscreenForTabOrPending()); |
702 } | 483 } |
703 | 484 |
704 // Flaky on Windows, Linux, CrOS: http://crbug.com/159000 | 485 // Flaky on Windows, Linux, CrOS: http://crbug.com/159000 |
705 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) | 486 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) |
706 #define MAYBE_MouseLockSilentAfterTargetUnlock \ | 487 #define MAYBE_MouseLockSilentAfterTargetUnlock \ |
707 DISABLED_MouseLockSilentAfterTargetUnlock | 488 DISABLED_MouseLockSilentAfterTargetUnlock |
708 #else | 489 #else |
709 #define MAYBE_MouseLockSilentAfterTargetUnlock MouseLockSilentAfterTargetUnlock | 490 #define MAYBE_MouseLockSilentAfterTargetUnlock MouseLockSilentAfterTargetUnlock |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 ui_test_utils::NavigateToURL( | 580 ui_test_utils::NavigateToURL( |
800 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); | 581 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); |
801 | 582 |
802 // Lock the mouse with a user gesture. | 583 // Lock the mouse with a user gesture. |
803 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 584 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
804 browser(), ui::VKEY_1, false, false, false, false, | 585 browser(), ui::VKEY_1, false, false, false, false, |
805 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 586 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
806 content::NotificationService::AllSources())); | 587 content::NotificationService::AllSources())); |
807 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 588 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
808 | 589 |
809 // In simplified mode, the mouse will automatically lock, so we can skip | |
810 // testing the permission requested and manually accepting. | |
811 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | |
812 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
813 ASSERT_FALSE(IsMouseLocked()); | |
814 | |
815 // Accept mouse lock. | |
816 AcceptCurrentFullscreenOrMouseLockRequest(); | |
817 } | |
818 | |
819 ASSERT_TRUE(IsMouseLocked()); | 590 ASSERT_TRUE(IsMouseLocked()); |
820 | 591 |
821 ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab")); | 592 ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab")); |
822 | 593 |
823 ASSERT_FALSE(IsMouseLocked()); | 594 ASSERT_FALSE(IsMouseLocked()); |
824 } | 595 } |
825 | 596 |
826 // Tests mouse lock is exited when navigating back. | 597 // Tests mouse lock is exited when navigating back. |
827 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 598 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
828 MAYBE_TestTabExitsMouseLockOnGoBack) { | 599 MAYBE_TestTabExitsMouseLockOnGoBack) { |
829 ASSERT_TRUE(embedded_test_server()->Start()); | 600 ASSERT_TRUE(embedded_test_server()->Start()); |
830 | 601 |
831 // Navigate twice to provide a place to go back to. | 602 // Navigate twice to provide a place to go back to. |
832 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 603 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
833 ui_test_utils::NavigateToURL( | 604 ui_test_utils::NavigateToURL( |
834 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); | 605 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); |
835 | 606 |
836 // Lock the mouse with a user gesture. | 607 // Lock the mouse with a user gesture. |
837 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 608 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
838 browser(), ui::VKEY_1, false, false, false, false, | 609 browser(), ui::VKEY_1, false, false, false, false, |
839 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 610 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
840 content::NotificationService::AllSources())); | 611 content::NotificationService::AllSources())); |
841 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 612 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
842 | 613 |
843 // In simplified mode, the mouse will automatically lock, so we can skip | |
844 // testing the permission requested and manually accepting. | |
845 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | |
846 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
847 ASSERT_FALSE(IsMouseLocked()); | |
848 | |
849 // Accept mouse lock. | |
850 AcceptCurrentFullscreenOrMouseLockRequest(); | |
851 } | |
852 | |
853 ASSERT_TRUE(IsMouseLocked()); | 614 ASSERT_TRUE(IsMouseLocked()); |
854 | 615 |
855 GoBack(); | 616 GoBack(); |
856 | 617 |
857 ASSERT_FALSE(IsMouseLocked()); | 618 ASSERT_FALSE(IsMouseLocked()); |
858 } | 619 } |
859 | 620 |
860 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) | 621 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) |
861 // TODO(erg): linux_aura bringup: http://crbug.com/163931 | 622 // TODO(erg): linux_aura bringup: http://crbug.com/163931 |
862 #define MAYBE_TestTabDoesntExitMouseLockOnSubFrameNavigation \ | 623 #define MAYBE_TestTabDoesntExitMouseLockOnSubFrameNavigation \ |
(...skipping 15 matching lines...) Expand all Loading... |
878 // Navigate to test page. | 639 // Navigate to test page. |
879 ui_test_utils::NavigateToURL(browser(), url); | 640 ui_test_utils::NavigateToURL(browser(), url); |
880 | 641 |
881 // Lock the mouse with a user gesture. | 642 // Lock the mouse with a user gesture. |
882 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 643 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
883 browser(), ui::VKEY_1, false, false, false, false, | 644 browser(), ui::VKEY_1, false, false, false, false, |
884 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 645 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
885 content::NotificationService::AllSources())); | 646 content::NotificationService::AllSources())); |
886 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 647 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
887 | 648 |
888 // In simplified mode, the mouse will automatically lock, so we can skip | |
889 // testing the permission requested and manually accepting. | |
890 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | |
891 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
892 ASSERT_FALSE(IsMouseLocked()); | |
893 | |
894 // Accept mouse lock. | |
895 AcceptCurrentFullscreenOrMouseLockRequest(); | |
896 } | |
897 | |
898 ASSERT_TRUE(IsMouseLocked()); | 649 ASSERT_TRUE(IsMouseLocked()); |
899 | 650 |
900 // Navigate to url with fragment. Mouse lock should persist. | 651 // Navigate to url with fragment. Mouse lock should persist. |
901 ui_test_utils::NavigateToURL(browser(), url_with_fragment); | 652 ui_test_utils::NavigateToURL(browser(), url_with_fragment); |
902 ASSERT_TRUE(IsMouseLocked()); | 653 ASSERT_TRUE(IsMouseLocked()); |
903 } | 654 } |
904 | 655 |
905 // Tests Mouse Lock and Fullscreen are exited upon reload. | 656 // Tests Mouse Lock and Fullscreen are exited upon reload. |
906 // http://crbug.com/137486 | 657 // http://crbug.com/137486 |
907 // mac: http://crbug.com/103912 | 658 // mac: http://crbug.com/103912 |
908 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 659 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
909 DISABLED_ReloadExitsMouseLockAndFullscreen) { | 660 DISABLED_ReloadExitsMouseLockAndFullscreen) { |
910 ASSERT_TRUE(embedded_test_server()->Start()); | 661 ASSERT_TRUE(embedded_test_server()->Start()); |
911 ui_test_utils::NavigateToURL( | 662 ui_test_utils::NavigateToURL( |
912 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); | 663 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); |
913 | 664 |
914 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
915 | |
916 // Request mouse lock. | 665 // Request mouse lock. |
917 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 666 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
918 browser(), ui::VKEY_1, false, false, false, false, | 667 browser(), ui::VKEY_1, false, false, false, false, |
919 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 668 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
920 content::NotificationService::AllSources())); | 669 content::NotificationService::AllSources())); |
921 ASSERT_TRUE(IsMouseLockPermissionRequested()); | 670 |
| 671 ASSERT_TRUE(IsMouseLocked()); |
| 672 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
922 | 673 |
923 // Reload. Mouse lock request should be cleared. | 674 // Reload. Mouse lock request should be cleared. |
924 { | 675 { |
925 MouseLockNotificationObserver mouselock_observer; | 676 MouseLockNotificationObserver mouselock_observer; |
926 Reload(); | 677 Reload(); |
927 mouselock_observer.Wait(); | 678 mouselock_observer.Wait(); |
928 ASSERT_FALSE(IsMouseLockPermissionRequested()); | |
929 } | |
930 | |
931 // Request mouse lock. | |
932 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | |
933 browser(), ui::VKEY_1, false, false, false, false, | |
934 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | |
935 content::NotificationService::AllSources())); | |
936 ASSERT_TRUE(IsMouseLockPermissionRequested()); | |
937 | |
938 // Accept mouse lock. | |
939 AcceptCurrentFullscreenOrMouseLockRequest(); | |
940 ASSERT_TRUE(IsMouseLocked()); | |
941 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | |
942 | |
943 // Reload. Mouse should be unlocked. | |
944 { | |
945 MouseLockNotificationObserver mouselock_observer; | |
946 Reload(); | |
947 mouselock_observer.Wait(); | |
948 ASSERT_FALSE(IsMouseLocked()); | |
949 } | 679 } |
950 | 680 |
951 // Request to lock the mouse and enter fullscreen. | 681 // Request to lock the mouse and enter fullscreen. |
952 { | 682 { |
953 FullscreenNotificationObserver fullscreen_observer; | 683 FullscreenNotificationObserver fullscreen_observer; |
954 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 684 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
955 browser(), ui::VKEY_B, false, true, false, false, | 685 browser(), ui::VKEY_B, false, true, false, false, |
956 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 686 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
957 content::NotificationService::AllSources())); | 687 content::NotificationService::AllSources())); |
958 fullscreen_observer.Wait(); | 688 fullscreen_observer.Wait(); |
(...skipping 13 matching lines...) Expand all Loading... |
972 } | 702 } |
973 | 703 |
974 // Tests ToggleFullscreenModeForTab always causes window to change. | 704 // Tests ToggleFullscreenModeForTab always causes window to change. |
975 // Test is flaky: http://crbug.com/146006 | 705 // Test is flaky: http://crbug.com/146006 |
976 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 706 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
977 DISABLED_ToggleFullscreenModeForTab) { | 707 DISABLED_ToggleFullscreenModeForTab) { |
978 // Most fullscreen tests run sharded in fullscreen_controller_browsertest.cc | 708 // Most fullscreen tests run sharded in fullscreen_controller_browsertest.cc |
979 // but flakiness required a while loop in | 709 // but flakiness required a while loop in |
980 // FullscreenControllerTest::ToggleTabFullscreen. This test verifies that | 710 // FullscreenControllerTest::ToggleTabFullscreen. This test verifies that |
981 // when running serially there is no flakiness. | 711 // when running serially there is no flakiness. |
982 // This test reproduces the same flow as | |
983 // TestFullscreenMouseLockContentSettings. | |
984 // http://crbug.com/133831 | |
985 | 712 |
986 GURL url = embedded_test_server()->GetURL("/simple.html"); | 713 GURL url = embedded_test_server()->GetURL("/simple.html"); |
987 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); | 714 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); |
988 | 715 |
989 // Validate that going fullscreen for a URL defaults to asking permision. | 716 // Validate that going fullscreen for a URL defaults to asking permision. |
990 ASSERT_FALSE(IsFullscreenPermissionRequested()); | |
991 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); | 717 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); |
992 ASSERT_TRUE(IsFullscreenPermissionRequested()); | 718 ASSERT_TRUE(IsWindowFullscreenForTabOrPending()); |
993 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); | 719 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); |
| 720 ASSERT_FALSE(IsWindowFullscreenForTabOrPending()); |
994 } | 721 } |
995 | 722 |
996 INSTANTIATE_TEST_CASE_P( | 723 INSTANTIATE_TEST_CASE_P( |
997 ParamaterizedFullscreenControllerInteractiveTestInstance, | 724 ParamaterizedFullscreenControllerInteractiveTestInstance, |
998 ParamaterizedFullscreenControllerInteractiveTest, | 725 ParamaterizedFullscreenControllerInteractiveTest, |
999 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); | 726 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); |
OLD | NEW |