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