| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 #include "chrome/browser/fullscreen.h" | 6 #include "chrome/browser/fullscreen.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 ASSERT_FALSE(IsMouseLockPermissionRequested()); | 149 ASSERT_FALSE(IsMouseLockPermissionRequested()); |
| 150 RequestToLockMouse(true, false); | 150 RequestToLockMouse(true, false); |
| 151 ASSERT_FALSE(IsMouseLockPermissionRequested()); | 151 ASSERT_FALSE(IsMouseLockPermissionRequested()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void FullscreenControllerInteractiveTest::ToggleTabFullscreen_Internal( | 154 void FullscreenControllerInteractiveTest::ToggleTabFullscreen_Internal( |
| 155 bool enter_fullscreen, bool retry_until_success) { | 155 bool enter_fullscreen, bool retry_until_success) { |
| 156 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 156 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 157 do { | 157 do { |
| 158 FullscreenNotificationObserver fullscreen_observer; | 158 FullscreenNotificationObserver fullscreen_observer; |
| 159 browser()->ToggleFullscreenModeForTab(tab, enter_fullscreen); | 159 if (enter_fullscreen) |
| 160 browser()->EnterFullscreenModeForTab(tab, GURL()); |
| 161 else |
| 162 browser()->ExitFullscreenModeForTab(tab); |
| 160 fullscreen_observer.Wait(); | 163 fullscreen_observer.Wait(); |
| 161 // Repeat ToggleFullscreenModeForTab until the correct state is entered. | 164 // Repeat ToggleFullscreenModeForTab until the correct state is entered. |
| 162 // This addresses flakiness on test bots running many fullscreen | 165 // This addresses flakiness on test bots running many fullscreen |
| 163 // tests in parallel. | 166 // tests in parallel. |
| 164 } while (retry_until_success && | 167 } while (retry_until_success && |
| 165 !IsFullscreenForBrowser() && | 168 !IsFullscreenForBrowser() && |
| 166 browser()->window()->IsFullscreen() != enter_fullscreen); | 169 browser()->window()->IsFullscreen() != enter_fullscreen); |
| 167 ASSERT_EQ(IsWindowFullscreenForTabOrPending(), enter_fullscreen); | 170 ASSERT_EQ(IsWindowFullscreenForTabOrPending(), enter_fullscreen); |
| 168 if (!IsFullscreenForBrowser()) | 171 if (!IsFullscreenForBrowser()) |
| 169 ASSERT_EQ(browser()->window()->IsFullscreen(), enter_fullscreen); | 172 ASSERT_EQ(browser()->window()->IsFullscreen(), enter_fullscreen); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 ASSERT_TRUE(test_server()->Start()); | 363 ASSERT_TRUE(test_server()->Start()); |
| 361 | 364 |
| 362 AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); | 365 AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); |
| 363 | 366 |
| 364 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 367 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 365 | 368 |
| 366 { | 369 { |
| 367 FullscreenNotificationObserver fullscreen_observer; | 370 FullscreenNotificationObserver fullscreen_observer; |
| 368 EXPECT_FALSE(browser()->window()->IsFullscreen()); | 371 EXPECT_FALSE(browser()->window()->IsFullscreen()); |
| 369 EXPECT_FALSE(browser()->window()->IsFullscreenWithToolbar()); | 372 EXPECT_FALSE(browser()->window()->IsFullscreenWithToolbar()); |
| 370 browser()->ToggleFullscreenModeForTab(tab, true); | 373 browser()->EnterFullscreenModeForTab(tab, GURL()); |
| 371 fullscreen_observer.Wait(); | 374 fullscreen_observer.Wait(); |
| 372 EXPECT_TRUE(browser()->window()->IsFullscreen()); | 375 EXPECT_TRUE(browser()->window()->IsFullscreen()); |
| 373 EXPECT_FALSE(browser()->window()->IsFullscreenWithToolbar()); | 376 EXPECT_FALSE(browser()->window()->IsFullscreenWithToolbar()); |
| 374 } | 377 } |
| 375 | 378 |
| 376 { | 379 { |
| 377 FullscreenNotificationObserver fullscreen_observer; | 380 FullscreenNotificationObserver fullscreen_observer; |
| 378 chrome::ToggleFullscreenMode(browser()); | 381 chrome::ToggleFullscreenMode(browser()); |
| 379 fullscreen_observer.Wait(); | 382 fullscreen_observer.Wait(); |
| 380 EXPECT_FALSE(browser()->window()->IsFullscreen()); | 383 EXPECT_FALSE(browser()->window()->IsFullscreen()); |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 | 919 |
| 917 GURL url = test_server()->GetURL("simple.html"); | 920 GURL url = test_server()->GetURL("simple.html"); |
| 918 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); | 921 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); |
| 919 | 922 |
| 920 // Validate that going fullscreen for a URL defaults to asking permision. | 923 // Validate that going fullscreen for a URL defaults to asking permision. |
| 921 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 924 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
| 922 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); | 925 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); |
| 923 ASSERT_TRUE(IsFullscreenPermissionRequested()); | 926 ASSERT_TRUE(IsFullscreenPermissionRequested()); |
| 924 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); | 927 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); |
| 925 } | 928 } |
| OLD | NEW |