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

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

Issue 10546106: TabContentsWrapper -> TabContents, part 53. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
11 using content::WebContents; 11 using content::WebContents;
12 12
13 class FullscreenControllerInteractiveTest 13 class FullscreenControllerInteractiveTest
14 : public FullscreenControllerTest { 14 : public FullscreenControllerTest {
15 protected: 15 protected:
16 // IsMouseLocked verifies that the FullscreenController state believes 16 // IsMouseLocked verifies that the FullscreenController state believes
17 // the mouse is locked. This is possible only for tests that initiate 17 // the mouse is locked. This is possible only for tests that initiate
18 // mouse lock from a renderer process, and uses logic that tests that the 18 // mouse lock from a renderer process, and uses logic that tests that the
19 // browser has focus. Thus, this can only be used in interactive ui tests 19 // browser has focus. Thus, this can only be used in interactive ui tests
20 // and not on sharded tests. 20 // and not on sharded tests.
21 bool IsMouseLocked() { 21 bool IsMouseLocked() {
22 // Verify that IsMouseLocked is consistent between the 22 // Verify that IsMouseLocked is consistent between the
23 // Fullscreen Controller and the Render View Host View. 23 // Fullscreen Controller and the Render View Host View.
24 EXPECT_TRUE(browser()->IsMouseLocked() == 24 EXPECT_TRUE(browser()->IsMouseLocked() ==
25 browser()->GetSelectedWebContents()-> 25 browser()->GetActiveWebContents()->
26 GetRenderViewHost()->GetView()->IsMouseLocked()); 26 GetRenderViewHost()->GetView()->IsMouseLocked());
27 return browser()->IsMouseLocked(); 27 return browser()->IsMouseLocked();
28 } 28 }
29 }; 29 };
30 30
31 // Tests mouse lock can be escaped with ESC key. 31 // Tests mouse lock can be escaped with ESC key.
32 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, EscapingMouseLock) { 32 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, EscapingMouseLock) {
33 ASSERT_TRUE(test_server()->Start()); 33 ASSERT_TRUE(test_server()->Start());
34 ui_test_utils::NavigateToURL(browser(), 34 ui_test_utils::NavigateToURL(browser(),
35 test_server()->GetURL(kFullscreenMouseLockHTML)); 35 test_server()->GetURL(kFullscreenMouseLockHTML));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ASSERT_FALSE(IsMouseLockPermissionRequested()); 137 ASSERT_FALSE(IsMouseLockPermissionRequested());
138 } 138 }
139 139
140 // Tests mouse lock then fullscreen. 140 // Tests mouse lock then fullscreen.
141 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, 141 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
142 MouseLockThenFullscreen) { 142 MouseLockThenFullscreen) {
143 ASSERT_TRUE(test_server()->Start()); 143 ASSERT_TRUE(test_server()->Start());
144 ui_test_utils::NavigateToURL(browser(), 144 ui_test_utils::NavigateToURL(browser(),
145 test_server()->GetURL(kFullscreenMouseLockHTML)); 145 test_server()->GetURL(kFullscreenMouseLockHTML));
146 146
147 WebContents* tab = browser()->GetSelectedWebContents(); 147 WebContents* tab = browser()->GetActiveWebContents();
148 148
149 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); 149 ASSERT_FALSE(IsFullscreenBubbleDisplayed());
150 150
151 // Lock the mouse without a user gesture, expect no response. 151 // Lock the mouse without a user gesture, expect no response.
152 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( 152 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
153 browser(), ui::VKEY_D, false, false, false, false, 153 browser(), ui::VKEY_D, false, false, false, false,
154 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, 154 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
155 content::NotificationService::AllSources())); 155 content::NotificationService::AllSources()));
156 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); 156 ASSERT_FALSE(IsFullscreenBubbleDisplayed());
157 ASSERT_FALSE(IsMouseLocked()); 157 ASSERT_FALSE(IsMouseLocked());
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 // Lock the mouse with a user gesture, make sure we see bubble again 312 // Lock the mouse with a user gesture, make sure we see bubble again
313 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( 313 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
314 browser(), ui::VKEY_1, false, false, false, false, 314 browser(), ui::VKEY_1, false, false, false, false,
315 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, 315 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
316 content::NotificationService::AllSources())); 316 content::NotificationService::AllSources()));
317 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); 317 ASSERT_TRUE(IsFullscreenBubbleDisplayed());
318 ASSERT_TRUE(IsMouseLocked()); 318 ASSERT_TRUE(IsMouseLocked());
319 } 319 }
320 320
OLDNEW
« no previous file with comments | « chrome/browser/ui/fullscreen_controller_browsertest.cc ('k') | chrome/browser/ui/fullscreen_controller_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698