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

Side by Side Diff: chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win_shared build Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
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/fullscreen_controller_test.h" 6 #include "chrome/browser/ui/fullscreen_controller_test.h"
7 #include "content/public/browser/render_view_host.h" 7 #include "content/public/browser/render_view_host.h"
8 #include "content/public/browser/render_widget_host_view.h" 8 #include "content/public/browser/render_widget_host_view.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 // Tests mouse lock and fullscreen modes can be escaped with ESC key. 79 // Tests mouse lock and fullscreen modes can be escaped with ESC key.
80 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, 80 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
81 EscapingMouseLockAndFullscreen) { 81 EscapingMouseLockAndFullscreen) {
82 ASSERT_TRUE(test_server()->Start()); 82 ASSERT_TRUE(test_server()->Start());
83 ui_test_utils::NavigateToURL(browser(), 83 ui_test_utils::NavigateToURL(browser(),
84 test_server()->GetURL(kFullscreenMouseLockHTML)); 84 test_server()->GetURL(kFullscreenMouseLockHTML));
85 85
86 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); 86 ASSERT_FALSE(IsFullscreenBubbleDisplayed());
87 87
88 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
Paweł Hajdan Jr. 2012/06/18 15:56:25 Ouch, some debugging code? This can't be a part of
jbates 2012/06/18 23:14:03 Done.
88 // Request to lock the mouse and enter fullscreen. 89 // Request to lock the mouse and enter fullscreen.
89 { 90 {
90 FullscreenNotificationObserver fullscreen_observer; 91 FullscreenNotificationObserver fullscreen_observer;
91 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( 92 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
92 browser(), ui::VKEY_B, false, true, false, false, 93 browser(), ui::VKEY_B, false, true, false, false,
93 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, 94 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
94 content::NotificationService::AllSources())); 95 content::NotificationService::AllSources()));
96 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
95 fullscreen_observer.Wait(); 97 fullscreen_observer.Wait();
96 } 98 }
97 ASSERT_TRUE(IsFullscreenPermissionRequested()); 99 ASSERT_TRUE(IsFullscreenPermissionRequested());
98 ASSERT_TRUE(IsMouseLockPermissionRequested()); 100 ASSERT_TRUE(IsMouseLockPermissionRequested());
99 101
102 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
100 // Escape, no prompts should remain. 103 // Escape, no prompts should remain.
101 { 104 {
102 FullscreenNotificationObserver fullscreen_observer; 105 FullscreenNotificationObserver fullscreen_observer;
103 SendEscapeToFullscreenController(); 106 SendEscapeToFullscreenController();
107 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
104 fullscreen_observer.Wait(); 108 fullscreen_observer.Wait();
105 } 109 }
106 ASSERT_FALSE(IsFullscreenPermissionRequested()); 110 ASSERT_FALSE(IsFullscreenPermissionRequested());
107 ASSERT_FALSE(IsMouseLockPermissionRequested()); 111 ASSERT_FALSE(IsMouseLockPermissionRequested());
108 112
113 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
109 // Request to lock the mouse and enter fullscreen. 114 // Request to lock the mouse and enter fullscreen.
110 { 115 {
111 FullscreenNotificationObserver fullscreen_observer; 116 FullscreenNotificationObserver fullscreen_observer;
112 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( 117 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
113 browser(), ui::VKEY_B, false, true, false, false, 118 browser(), ui::VKEY_B, false, true, false, false,
114 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, 119 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
115 content::NotificationService::AllSources())); 120 content::NotificationService::AllSources()));
121 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
116 fullscreen_observer.Wait(); 122 fullscreen_observer.Wait();
123 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
117 } 124 }
118 ASSERT_TRUE(IsFullscreenPermissionRequested()); 125 ASSERT_TRUE(IsFullscreenPermissionRequested());
126 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
119 ASSERT_TRUE(IsMouseLockPermissionRequested()); 127 ASSERT_TRUE(IsMouseLockPermissionRequested());
120 128
129 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
121 // Accept both, confirm mouse lock and fullscreen and no prompts. 130 // Accept both, confirm mouse lock and fullscreen and no prompts.
122 AcceptCurrentFullscreenOrMouseLockRequest(); 131 AcceptCurrentFullscreenOrMouseLockRequest();
123 ASSERT_TRUE(IsMouseLocked()); 132 ASSERT_TRUE(IsMouseLocked());
124 ASSERT_TRUE(IsFullscreenForTabOrPending()); 133 ASSERT_TRUE(IsFullscreenForTabOrPending());
125 ASSERT_FALSE(IsFullscreenPermissionRequested()); 134 ASSERT_FALSE(IsFullscreenPermissionRequested());
126 ASSERT_FALSE(IsMouseLockPermissionRequested()); 135 ASSERT_FALSE(IsMouseLockPermissionRequested());
127 136
137 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
128 // Escape, confirm we are out of mouse lock and fullscreen with no prompts. 138 // Escape, confirm we are out of mouse lock and fullscreen with no prompts.
129 { 139 {
130 FullscreenNotificationObserver fullscreen_observer; 140 FullscreenNotificationObserver fullscreen_observer;
141 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
131 SendEscapeToFullscreenController(); 142 SendEscapeToFullscreenController();
143 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
132 fullscreen_observer.Wait(); 144 fullscreen_observer.Wait();
145 fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__);
133 } 146 }
134 ASSERT_FALSE(IsMouseLocked()); 147 ASSERT_FALSE(IsMouseLocked());
135 ASSERT_FALSE(IsFullscreenForTabOrPending()); 148 ASSERT_FALSE(IsFullscreenForTabOrPending());
136 ASSERT_FALSE(IsFullscreenPermissionRequested()); 149 ASSERT_FALSE(IsFullscreenPermissionRequested());
137 ASSERT_FALSE(IsMouseLockPermissionRequested()); 150 ASSERT_FALSE(IsMouseLockPermissionRequested());
138 } 151 }
139 152
140 // Tests mouse lock then fullscreen. 153 // Tests mouse lock then fullscreen.
141 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, 154 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
142 MouseLockThenFullscreen) { 155 MouseLockThenFullscreen) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 324
312 // Lock the mouse with a user gesture, make sure we see bubble again 325 // Lock the mouse with a user gesture, make sure we see bubble again
313 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( 326 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
314 browser(), ui::VKEY_1, false, false, false, false, 327 browser(), ui::VKEY_1, false, false, false, false,
315 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, 328 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
316 content::NotificationService::AllSources())); 329 content::NotificationService::AllSources()));
317 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); 330 ASSERT_TRUE(IsFullscreenBubbleDisplayed());
318 ASSERT_TRUE(IsMouseLocked()); 331 ASSERT_TRUE(IsMouseLocked());
319 } 332 }
320 333
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698