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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 }; | 197 }; |
198 | 198 |
199 // Causes the browser to swap processes on a redirect to an HTTPS URL. | 199 // Causes the browser to swap processes on a redirect to an HTTPS URL. |
200 class TransferHttpsRedirectsContentBrowserClient | 200 class TransferHttpsRedirectsContentBrowserClient |
201 : public chrome::ChromeContentBrowserClient { | 201 : public chrome::ChromeContentBrowserClient { |
202 public: | 202 public: |
203 virtual bool ShouldSwapProcessesForRedirect( | 203 virtual bool ShouldSwapProcessesForRedirect( |
204 content::ResourceContext* resource_context, | 204 content::ResourceContext* resource_context, |
205 const GURL& current_url, | 205 const GURL& current_url, |
206 const GURL& new_url) OVERRIDE { | 206 const GURL& new_url) OVERRIDE { |
207 return new_url.SchemeIs(content::kHttpsScheme); | 207 return new_url.SchemeIs(url::kHttpsScheme); |
208 } | 208 } |
209 }; | 209 }; |
210 | 210 |
211 // Used by CloseWithAppMenuOpen. Invokes CloseWindow on the supplied browser. | 211 // Used by CloseWithAppMenuOpen. Invokes CloseWindow on the supplied browser. |
212 void CloseWindowCallback(Browser* browser) { | 212 void CloseWindowCallback(Browser* browser) { |
213 chrome::CloseWindow(browser); | 213 chrome::CloseWindow(browser); |
214 } | 214 } |
215 | 215 |
216 // Used by CloseWithAppMenuOpen. Posts a CloseWindowCallback and shows the app | 216 // Used by CloseWithAppMenuOpen. Posts a CloseWindowCallback and shows the app |
217 // menu. | 217 // menu. |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 ui_test_utils::NavigateToURL(browser(), file_url); | 1112 ui_test_utils::NavigateToURL(browser(), file_url); |
1113 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); | 1113 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); |
1114 } | 1114 } |
1115 | 1115 |
1116 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttp) { | 1116 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttp) { |
1117 CommandUpdater* command_updater = | 1117 CommandUpdater* command_updater = |
1118 browser()->command_controller()->command_updater(); | 1118 browser()->command_controller()->command_updater(); |
1119 | 1119 |
1120 ASSERT_TRUE(test_server()->Start()); | 1120 ASSERT_TRUE(test_server()->Start()); |
1121 GURL http_url(test_server()->GetURL(std::string())); | 1121 GURL http_url(test_server()->GetURL(std::string())); |
1122 ASSERT_TRUE(http_url.SchemeIs(content::kHttpScheme)); | 1122 ASSERT_TRUE(http_url.SchemeIs(url::kHttpScheme)); |
1123 ui_test_utils::NavigateToURL(browser(), http_url); | 1123 ui_test_utils::NavigateToURL(browser(), http_url); |
1124 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); | 1124 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); |
1125 } | 1125 } |
1126 | 1126 |
1127 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttps) { | 1127 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttps) { |
1128 CommandUpdater* command_updater = | 1128 CommandUpdater* command_updater = |
1129 browser()->command_controller()->command_updater(); | 1129 browser()->command_controller()->command_updater(); |
1130 | 1130 |
1131 net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, | 1131 net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, |
1132 net::SpawnedTestServer::kLocalhost, | 1132 net::SpawnedTestServer::kLocalhost, |
1133 base::FilePath(kDocRoot)); | 1133 base::FilePath(kDocRoot)); |
1134 ASSERT_TRUE(test_server.Start()); | 1134 ASSERT_TRUE(test_server.Start()); |
1135 GURL https_url(test_server.GetURL("/")); | 1135 GURL https_url(test_server.GetURL("/")); |
1136 ASSERT_TRUE(https_url.SchemeIs(content::kHttpsScheme)); | 1136 ASSERT_TRUE(https_url.SchemeIs(url::kHttpsScheme)); |
1137 ui_test_utils::NavigateToURL(browser(), https_url); | 1137 ui_test_utils::NavigateToURL(browser(), https_url); |
1138 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); | 1138 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); |
1139 } | 1139 } |
1140 | 1140 |
1141 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { | 1141 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { |
1142 CommandUpdater* command_updater = | 1142 CommandUpdater* command_updater = |
1143 browser()->command_controller()->command_updater(); | 1143 browser()->command_controller()->command_updater(); |
1144 | 1144 |
1145 net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_FTP, | 1145 net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_FTP, |
1146 net::SpawnedTestServer::kLocalhost, | 1146 net::SpawnedTestServer::kLocalhost, |
(...skipping 25 matching lines...) Expand all Loading... |
1172 GURL blank_url(content::kAboutBlankURL); | 1172 GURL blank_url(content::kAboutBlankURL); |
1173 ui_test_utils::NavigateToURL(browser(), blank_url); | 1173 ui_test_utils::NavigateToURL(browser(), blank_url); |
1174 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); | 1174 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); |
1175 } | 1175 } |
1176 | 1176 |
1177 // Change a tab into an application window. | 1177 // Change a tab into an application window. |
1178 // DISABLED: http://crbug.com/72310 | 1178 // DISABLED: http://crbug.com/72310 |
1179 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { | 1179 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { |
1180 ASSERT_TRUE(test_server()->Start()); | 1180 ASSERT_TRUE(test_server()->Start()); |
1181 GURL http_url(test_server()->GetURL(std::string())); | 1181 GURL http_url(test_server()->GetURL(std::string())); |
1182 ASSERT_TRUE(http_url.SchemeIs(content::kHttpScheme)); | 1182 ASSERT_TRUE(http_url.SchemeIs(url::kHttpScheme)); |
1183 | 1183 |
1184 ASSERT_EQ(1, browser()->tab_strip_model()->count()); | 1184 ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
1185 WebContents* initial_tab = browser()->tab_strip_model()->GetWebContentsAt(0); | 1185 WebContents* initial_tab = browser()->tab_strip_model()->GetWebContentsAt(0); |
1186 WebContents* app_tab = chrome::AddSelectedTabWithURL( | 1186 WebContents* app_tab = chrome::AddSelectedTabWithURL( |
1187 browser(), http_url, content::PAGE_TRANSITION_TYPED); | 1187 browser(), http_url, content::PAGE_TRANSITION_TYPED); |
1188 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | 1188 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
1189 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), | 1189 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), |
1190 browser()->host_desktop_type())); | 1190 browser()->host_desktop_type())); |
1191 | 1191 |
1192 // Normal tabs should accept load drops. | 1192 // Normal tabs should accept load drops. |
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2701 #endif | 2701 #endif |
2702 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2702 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
2703 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2703 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
2704 gfx::Size exp_final_size(initial_wcv_size); | 2704 gfx::Size exp_final_size(initial_wcv_size); |
2705 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2705 exp_final_size.Enlarge(wcv_resize_insets.width(), |
2706 wcv_resize_insets.height() + height_inset); | 2706 wcv_resize_insets.height() + height_inset); |
2707 EXPECT_EQ(exp_final_size, | 2707 EXPECT_EQ(exp_final_size, |
2708 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2708 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
2709 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); | 2709 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); |
2710 } | 2710 } |
OLD | NEW |