| 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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 #include "chrome/browser/ui/browser_window.h" | 6 #include "chrome/browser/ui/browser_window.h" |
| 7 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h" | 7 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h" |
| 8 #include "content/public/browser/render_view_host.h" | 8 #include "content/public/browser/render_view_host.h" |
| 9 #include "content/public/browser/render_widget_host_view.h" | 9 #include "content/public/browser/render_widget_host_view.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 MAYBE_EscapingMouseLockAndFullscreen) { | 89 MAYBE_EscapingMouseLockAndFullscreen) { |
| 90 ASSERT_TRUE(test_server()->Start()); | 90 ASSERT_TRUE(test_server()->Start()); |
| 91 ui_test_utils::NavigateToURL(browser(), | 91 ui_test_utils::NavigateToURL(browser(), |
| 92 test_server()->GetURL(kFullscreenMouseLockHTML)); | 92 test_server()->GetURL(kFullscreenMouseLockHTML)); |
| 93 | 93 |
| 94 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 94 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
| 95 | 95 |
| 96 // Request to lock the mouse and enter fullscreen. | 96 // Request to lock the mouse and enter fullscreen. |
| 97 { | 97 { |
| 98 FullscreenNotificationObserver fullscreen_observer; | 98 FullscreenNotificationObserver fullscreen_observer; |
| 99 fprintf(stderr, "%s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__); |
| 99 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 100 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
| 100 browser(), ui::VKEY_B, false, true, false, false, | 101 browser(), ui::VKEY_B, false, true, false, false, |
| 101 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 102 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
| 102 content::NotificationService::AllSources())); | 103 content::NotificationService::AllSources())); |
| 104 fprintf(stderr, "%s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__); |
| 103 fullscreen_observer.Wait(); | 105 fullscreen_observer.Wait(); |
| 104 } | 106 } |
| 105 ASSERT_TRUE(IsFullscreenPermissionRequested()); | 107 ASSERT_TRUE(IsFullscreenPermissionRequested()); |
| 106 ASSERT_TRUE(IsMouseLockPermissionRequested()); | 108 ASSERT_TRUE(IsMouseLockPermissionRequested()); |
| 107 | 109 |
| 108 // Escape, no prompts should remain. | 110 // Escape, no prompts should remain. |
| 109 { | 111 { |
| 110 FullscreenNotificationObserver fullscreen_observer; | 112 FullscreenNotificationObserver fullscreen_observer; |
| 111 SendEscapeToFullscreenController(); | 113 SendEscapeToFullscreenController(); |
| 114 fprintf(stderr, "%s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__); |
| 112 fullscreen_observer.Wait(); | 115 fullscreen_observer.Wait(); |
| 113 } | 116 } |
| 114 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 117 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
| 115 ASSERT_FALSE(IsMouseLockPermissionRequested()); | 118 ASSERT_FALSE(IsMouseLockPermissionRequested()); |
| 116 | 119 |
| 117 // Request to lock the mouse and enter fullscreen. | 120 // Request to lock the mouse and enter fullscreen. |
| 118 { | 121 { |
| 119 FullscreenNotificationObserver fullscreen_observer; | 122 FullscreenNotificationObserver fullscreen_observer; |
| 123 fprintf(stderr, "%s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__); |
| 120 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 124 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
| 121 browser(), ui::VKEY_B, false, true, false, false, | 125 browser(), ui::VKEY_B, false, true, false, false, |
| 122 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, | 126 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, |
| 123 content::NotificationService::AllSources())); | 127 content::NotificationService::AllSources())); |
| 128 fprintf(stderr, "%s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__); |
| 124 fullscreen_observer.Wait(); | 129 fullscreen_observer.Wait(); |
| 125 } | 130 } |
| 126 ASSERT_TRUE(IsFullscreenPermissionRequested()); | 131 ASSERT_TRUE(IsFullscreenPermissionRequested()); |
| 127 ASSERT_TRUE(IsMouseLockPermissionRequested()); | 132 ASSERT_TRUE(IsMouseLockPermissionRequested()); |
| 128 | 133 |
| 129 // Accept both, confirm mouse lock and fullscreen and no prompts. | 134 // Accept both, confirm mouse lock and fullscreen and no prompts. |
| 130 AcceptCurrentFullscreenOrMouseLockRequest(); | 135 AcceptCurrentFullscreenOrMouseLockRequest(); |
| 131 ASSERT_TRUE(IsMouseLocked()); | 136 ASSERT_TRUE(IsMouseLocked()); |
| 132 ASSERT_TRUE(IsFullscreenForTabOrPending()); | 137 ASSERT_TRUE(IsFullscreenForTabOrPending()); |
| 133 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 138 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
| 134 ASSERT_FALSE(IsMouseLockPermissionRequested()); | 139 ASSERT_FALSE(IsMouseLockPermissionRequested()); |
| 135 | 140 |
| 136 // Escape, confirm we are out of mouse lock and fullscreen with no prompts. | 141 // Escape, confirm we are out of mouse lock and fullscreen with no prompts. |
| 137 { | 142 { |
| 138 FullscreenNotificationObserver fullscreen_observer; | 143 FullscreenNotificationObserver fullscreen_observer; |
| 139 SendEscapeToFullscreenController(); | 144 SendEscapeToFullscreenController(); |
| 145 fprintf(stderr, "%s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__); |
| 140 fullscreen_observer.Wait(); | 146 fullscreen_observer.Wait(); |
| 141 } | 147 } |
| 142 ASSERT_FALSE(IsMouseLocked()); | 148 ASSERT_FALSE(IsMouseLocked()); |
| 143 ASSERT_FALSE(IsFullscreenForTabOrPending()); | 149 ASSERT_FALSE(IsFullscreenForTabOrPending()); |
| 144 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 150 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
| 145 ASSERT_FALSE(IsMouseLockPermissionRequested()); | 151 ASSERT_FALSE(IsMouseLockPermissionRequested()); |
| 146 } | 152 } |
| 147 | 153 |
| 148 // Tests mouse lock then fullscreen. | 154 // Tests mouse lock then fullscreen. |
| 149 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, | 155 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 510 |
| 505 GURL url = test_server()->GetURL("simple.html"); | 511 GURL url = test_server()->GetURL("simple.html"); |
| 506 AddTabAtIndexAndWait(0, url, content::PAGE_TRANSITION_TYPED); | 512 AddTabAtIndexAndWait(0, url, content::PAGE_TRANSITION_TYPED); |
| 507 | 513 |
| 508 // Validate that going fullscreen for a URL defaults to asking permision. | 514 // Validate that going fullscreen for a URL defaults to asking permision. |
| 509 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 515 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
| 510 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); | 516 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); |
| 511 ASSERT_TRUE(IsFullscreenPermissionRequested()); | 517 ASSERT_TRUE(IsFullscreenPermissionRequested()); |
| 512 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); | 518 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); |
| 513 } | 519 } |
| OLD | NEW |