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_tabstrip.h" |
6 #include "chrome/browser/ui/browser_window.h" | 7 #include "chrome/browser/ui/browser_window.h" |
7 #include "chrome/browser/ui/fullscreen_controller_test.h" | 8 #include "chrome/browser/ui/fullscreen_controller_test.h" |
8 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
9 #include "content/public/browser/render_widget_host_view.h" | 10 #include "content/public/browser/render_widget_host_view.h" |
10 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
11 | 12 |
12 using content::WebContents; | 13 using content::WebContents; |
13 | 14 |
14 class FullscreenControllerInteractiveTest | 15 class FullscreenControllerInteractiveTest |
15 : public FullscreenControllerTest { | 16 : public FullscreenControllerTest { |
16 protected: | 17 protected: |
17 // IsMouseLocked verifies that the FullscreenController state believes | 18 // IsMouseLocked verifies that the FullscreenController state believes |
18 // the mouse is locked. This is possible only for tests that initiate | 19 // the mouse is locked. This is possible only for tests that initiate |
19 // mouse lock from a renderer process, and uses logic that tests that the | 20 // mouse lock from a renderer process, and uses logic that tests that the |
20 // browser has focus. Thus, this can only be used in interactive ui tests | 21 // browser has focus. Thus, this can only be used in interactive ui tests |
21 // and not on sharded tests. | 22 // and not on sharded tests. |
22 bool IsMouseLocked() { | 23 bool IsMouseLocked() { |
23 // Verify that IsMouseLocked is consistent between the | 24 // Verify that IsMouseLocked is consistent between the |
24 // Fullscreen Controller and the Render View Host View. | 25 // Fullscreen Controller and the Render View Host View. |
25 EXPECT_TRUE(browser()->IsMouseLocked() == | 26 EXPECT_TRUE(browser()->IsMouseLocked() == |
26 browser()->GetActiveWebContents()-> | 27 chrome::GetActiveWebContents(browser())-> |
27 GetRenderViewHost()->GetView()->IsMouseLocked()); | 28 GetRenderViewHost()->GetView()->IsMouseLocked()); |
28 return browser()->IsMouseLocked(); | 29 return browser()->IsMouseLocked(); |
29 } | 30 } |
30 }; | 31 }; |
31 | 32 |
32 // Tests mouse lock can be escaped with ESC key. | 33 // Tests mouse lock can be escaped with ESC key. |
33 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, EscapingMouseLock) { | 34 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, EscapingMouseLock) { |
34 ASSERT_TRUE(test_server()->Start()); | 35 ASSERT_TRUE(test_server()->Start()); |
35 ui_test_utils::NavigateToURL(browser(), | 36 ui_test_utils::NavigateToURL(browser(), |
36 test_server()->GetURL(kFullscreenMouseLockHTML)); | 37 test_server()->GetURL(kFullscreenMouseLockHTML)); |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 | 505 |
505 GURL url = test_server()->GetURL("simple.html"); | 506 GURL url = test_server()->GetURL("simple.html"); |
506 AddTabAtIndexAndWait(0, url, content::PAGE_TRANSITION_TYPED); | 507 AddTabAtIndexAndWait(0, url, content::PAGE_TRANSITION_TYPED); |
507 | 508 |
508 // Validate that going fullscreen for a URL defaults to asking permision. | 509 // Validate that going fullscreen for a URL defaults to asking permision. |
509 ASSERT_FALSE(IsFullscreenPermissionRequested()); | 510 ASSERT_FALSE(IsFullscreenPermissionRequested()); |
510 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); | 511 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); |
511 ASSERT_TRUE(IsFullscreenPermissionRequested()); | 512 ASSERT_TRUE(IsFullscreenPermissionRequested()); |
512 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); | 513 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); |
513 } | 514 } |
OLD | NEW |