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/content_settings/host_content_settings_map_factory.h" | 5 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/browser_commands.h" | 7 #include "chrome/browser/ui/browser_commands.h" |
8 #include "chrome/browser/ui/browser_tabstrip.h" | 8 #include "chrome/browser/ui/browser_tabstrip.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" | 11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
14 #include "components/content_settings/core/browser/host_content_settings_map.h" | 14 #include "components/content_settings/core/browser/host_content_settings_map.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "content/public/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
| 17 #include "net/test/embedded_test_server/embedded_test_server.h" |
17 | 18 |
18 using content::WebContents; | 19 using content::WebContents; |
19 using ui::PAGE_TRANSITION_TYPED; | 20 using ui::PAGE_TRANSITION_TYPED; |
20 | 21 |
21 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, | 22 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, |
22 PendingMouseLockExitsOnTabSwitch) { | 23 PendingMouseLockExitsOnTabSwitch) { |
23 AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); | 24 AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); |
24 AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); | 25 AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); |
25 WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents(); | 26 WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents(); |
26 | 27 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 GURL file_url(ui_test_utils::GetTestUrl( | 89 GURL file_url(ui_test_utils::GetTestUrl( |
89 base::FilePath(base::FilePath::kCurrentDirectory), | 90 base::FilePath(base::FilePath::kCurrentDirectory), |
90 base::FilePath(kEmptyFile))); | 91 base::FilePath(kEmptyFile))); |
91 AddTabAtIndex(0, file_url, PAGE_TRANSITION_TYPED); | 92 AddTabAtIndex(0, file_url, PAGE_TRANSITION_TYPED); |
92 RequestToLockMouse(true, false); | 93 RequestToLockMouse(true, false); |
93 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 94 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
94 ASSERT_TRUE(IsFullscreenBubbleDisplayingButtons()); | 95 ASSERT_TRUE(IsFullscreenBubbleDisplayingButtons()); |
95 } | 96 } |
96 | 97 |
97 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, PermissionContentSettings) { | 98 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, PermissionContentSettings) { |
98 GURL url = test_server()->GetURL(kFullscreenMouseLockHTML); | 99 ASSERT_TRUE(embedded_test_server()->Start()); |
99 ASSERT_TRUE(test_server()->Start()); | 100 GURL url = embedded_test_server()->GetURL(kFullscreenMouseLockHTML); |
100 ui_test_utils::NavigateToURL(browser(), url); | 101 ui_test_utils::NavigateToURL(browser(), url); |
101 | 102 |
102 EXPECT_FALSE(browser()->window()->IsFullscreen()); | 103 EXPECT_FALSE(browser()->window()->IsFullscreen()); |
103 | 104 |
104 // The content's origin is not allowed to go fullscreen. | 105 // The content's origin is not allowed to go fullscreen. |
105 EXPECT_EQ( | 106 EXPECT_EQ( |
106 CONTENT_SETTING_ASK, | 107 CONTENT_SETTING_ASK, |
107 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) | 108 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) |
108 ->GetContentSetting(url.GetOrigin(), | 109 ->GetContentSetting(url.GetOrigin(), |
109 url.GetOrigin(), | 110 url.GetOrigin(), |
(...skipping 30 matching lines...) Expand all Loading... |
140 CONTENT_SETTING_ASK, | 141 CONTENT_SETTING_ASK, |
141 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) | 142 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) |
142 ->GetContentSetting(url.GetOrigin(), | 143 ->GetContentSetting(url.GetOrigin(), |
143 GURL("https://test.com"), | 144 GURL("https://test.com"), |
144 CONTENT_SETTINGS_TYPE_FULLSCREEN, | 145 CONTENT_SETTINGS_TYPE_FULLSCREEN, |
145 std::string())); | 146 std::string())); |
146 | 147 |
147 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) | 148 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) |
148 ->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_FULLSCREEN); | 149 ->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_FULLSCREEN); |
149 } | 150 } |
OLD | NEW |