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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #include "content/public/common/page_transition_types.h" | 75 #include "content/public/common/page_transition_types.h" |
76 #include "content/public/common/renderer_preferences.h" | 76 #include "content/public/common/renderer_preferences.h" |
77 #include "content/public/common/url_constants.h" | 77 #include "content/public/common/url_constants.h" |
78 #include "content/public/test/browser_test_utils.h" | 78 #include "content/public/test/browser_test_utils.h" |
79 #include "content/public/test/test_navigation_observer.h" | 79 #include "content/public/test/test_navigation_observer.h" |
80 #include "extensions/browser/extension_system.h" | 80 #include "extensions/browser/extension_system.h" |
81 #include "extensions/common/extension.h" | 81 #include "extensions/common/extension.h" |
82 #include "extensions/common/extension_set.h" | 82 #include "extensions/common/extension_set.h" |
83 #include "grit/chromium_strings.h" | 83 #include "grit/chromium_strings.h" |
84 #include "grit/generated_resources.h" | 84 #include "grit/generated_resources.h" |
| 85 #include "net/base/url_constants.h" |
85 #include "net/dns/mock_host_resolver.h" | 86 #include "net/dns/mock_host_resolver.h" |
86 #include "net/test/spawned_test_server/spawned_test_server.h" | 87 #include "net/test/spawned_test_server/spawned_test_server.h" |
87 #include "ui/base/l10n/l10n_util.h" | 88 #include "ui/base/l10n/l10n_util.h" |
88 | 89 |
89 #if defined(OS_MACOSX) | 90 #if defined(OS_MACOSX) |
90 #include "base/mac/mac_util.h" | 91 #include "base/mac/mac_util.h" |
91 #include "base/mac/scoped_nsautorelease_pool.h" | 92 #include "base/mac/scoped_nsautorelease_pool.h" |
92 #include "chrome/browser/ui/cocoa/run_loop_testing.h" | 93 #include "chrome/browser/ui/cocoa/run_loop_testing.h" |
93 #endif | 94 #endif |
94 | 95 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 }; | 199 }; |
199 | 200 |
200 // Causes the browser to swap processes on a redirect to an HTTPS URL. | 201 // Causes the browser to swap processes on a redirect to an HTTPS URL. |
201 class TransferHttpsRedirectsContentBrowserClient | 202 class TransferHttpsRedirectsContentBrowserClient |
202 : public chrome::ChromeContentBrowserClient { | 203 : public chrome::ChromeContentBrowserClient { |
203 public: | 204 public: |
204 virtual bool ShouldSwapProcessesForRedirect( | 205 virtual bool ShouldSwapProcessesForRedirect( |
205 content::ResourceContext* resource_context, | 206 content::ResourceContext* resource_context, |
206 const GURL& current_url, | 207 const GURL& current_url, |
207 const GURL& new_url) OVERRIDE { | 208 const GURL& new_url) OVERRIDE { |
208 return new_url.SchemeIs(content::kHttpsScheme); | 209 return new_url.SchemeIs(net::kHttpsScheme); |
209 } | 210 } |
210 }; | 211 }; |
211 | 212 |
212 // Used by CloseWithAppMenuOpen. Invokes CloseWindow on the supplied browser. | 213 // Used by CloseWithAppMenuOpen. Invokes CloseWindow on the supplied browser. |
213 void CloseWindowCallback(Browser* browser) { | 214 void CloseWindowCallback(Browser* browser) { |
214 chrome::CloseWindow(browser); | 215 chrome::CloseWindow(browser); |
215 } | 216 } |
216 | 217 |
217 // Used by CloseWithAppMenuOpen. Posts a CloseWindowCallback and shows the app | 218 // Used by CloseWithAppMenuOpen. Posts a CloseWindowCallback and shows the app |
218 // menu. | 219 // menu. |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 ui_test_utils::NavigateToURL(browser(), file_url); | 1087 ui_test_utils::NavigateToURL(browser(), file_url); |
1087 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); | 1088 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); |
1088 } | 1089 } |
1089 | 1090 |
1090 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttp) { | 1091 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttp) { |
1091 CommandUpdater* command_updater = | 1092 CommandUpdater* command_updater = |
1092 browser()->command_controller()->command_updater(); | 1093 browser()->command_controller()->command_updater(); |
1093 | 1094 |
1094 ASSERT_TRUE(test_server()->Start()); | 1095 ASSERT_TRUE(test_server()->Start()); |
1095 GURL http_url(test_server()->GetURL(std::string())); | 1096 GURL http_url(test_server()->GetURL(std::string())); |
1096 ASSERT_TRUE(http_url.SchemeIs(content::kHttpScheme)); | 1097 ASSERT_TRUE(http_url.SchemeIs(net::kHttpScheme)); |
1097 ui_test_utils::NavigateToURL(browser(), http_url); | 1098 ui_test_utils::NavigateToURL(browser(), http_url); |
1098 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); | 1099 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); |
1099 } | 1100 } |
1100 | 1101 |
1101 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttps) { | 1102 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttps) { |
1102 CommandUpdater* command_updater = | 1103 CommandUpdater* command_updater = |
1103 browser()->command_controller()->command_updater(); | 1104 browser()->command_controller()->command_updater(); |
1104 | 1105 |
1105 net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, | 1106 net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS, |
1106 net::SpawnedTestServer::kLocalhost, | 1107 net::SpawnedTestServer::kLocalhost, |
1107 base::FilePath(kDocRoot)); | 1108 base::FilePath(kDocRoot)); |
1108 ASSERT_TRUE(test_server.Start()); | 1109 ASSERT_TRUE(test_server.Start()); |
1109 GURL https_url(test_server.GetURL("/")); | 1110 GURL https_url(test_server.GetURL("/")); |
1110 ASSERT_TRUE(https_url.SchemeIs(content::kHttpsScheme)); | 1111 ASSERT_TRUE(https_url.SchemeIs(net::kHttpsScheme)); |
1111 ui_test_utils::NavigateToURL(browser(), https_url); | 1112 ui_test_utils::NavigateToURL(browser(), https_url); |
1112 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); | 1113 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); |
1113 } | 1114 } |
1114 | 1115 |
1115 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { | 1116 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { |
1116 CommandUpdater* command_updater = | 1117 CommandUpdater* command_updater = |
1117 browser()->command_controller()->command_updater(); | 1118 browser()->command_controller()->command_updater(); |
1118 | 1119 |
1119 net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_FTP, | 1120 net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_FTP, |
1120 net::SpawnedTestServer::kLocalhost, | 1121 net::SpawnedTestServer::kLocalhost, |
(...skipping 25 matching lines...) Expand all Loading... |
1146 GURL blank_url(content::kAboutBlankURL); | 1147 GURL blank_url(content::kAboutBlankURL); |
1147 ui_test_utils::NavigateToURL(browser(), blank_url); | 1148 ui_test_utils::NavigateToURL(browser(), blank_url); |
1148 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); | 1149 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); |
1149 } | 1150 } |
1150 | 1151 |
1151 // Change a tab into an application window. | 1152 // Change a tab into an application window. |
1152 // DISABLED: http://crbug.com/72310 | 1153 // DISABLED: http://crbug.com/72310 |
1153 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { | 1154 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { |
1154 ASSERT_TRUE(test_server()->Start()); | 1155 ASSERT_TRUE(test_server()->Start()); |
1155 GURL http_url(test_server()->GetURL(std::string())); | 1156 GURL http_url(test_server()->GetURL(std::string())); |
1156 ASSERT_TRUE(http_url.SchemeIs(content::kHttpScheme)); | 1157 ASSERT_TRUE(http_url.SchemeIs(net::kHttpScheme)); |
1157 | 1158 |
1158 ASSERT_EQ(1, browser()->tab_strip_model()->count()); | 1159 ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
1159 WebContents* initial_tab = browser()->tab_strip_model()->GetWebContentsAt(0); | 1160 WebContents* initial_tab = browser()->tab_strip_model()->GetWebContentsAt(0); |
1160 WebContents* app_tab = chrome::AddSelectedTabWithURL( | 1161 WebContents* app_tab = chrome::AddSelectedTabWithURL( |
1161 browser(), http_url, content::PAGE_TRANSITION_TYPED); | 1162 browser(), http_url, content::PAGE_TRANSITION_TYPED); |
1162 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | 1163 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
1163 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), | 1164 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), |
1164 browser()->host_desktop_type())); | 1165 browser()->host_desktop_type())); |
1165 | 1166 |
1166 // Normal tabs should accept load drops. | 1167 // Normal tabs should accept load drops. |
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 #endif | 2676 #endif |
2676 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2677 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
2677 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2678 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
2678 gfx::Size exp_final_size(initial_wcv_size); | 2679 gfx::Size exp_final_size(initial_wcv_size); |
2679 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2680 exp_final_size.Enlarge(wcv_resize_insets.width(), |
2680 wcv_resize_insets.height() + height_inset); | 2681 wcv_resize_insets.height() + height_inset); |
2681 EXPECT_EQ(exp_final_size, | 2682 EXPECT_EQ(exp_final_size, |
2682 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2683 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
2683 EXPECT_EQ(exp_final_size, web_contents->GetView()->GetContainerSize()); | 2684 EXPECT_EQ(exp_final_size, web_contents->GetView()->GetContainerSize()); |
2684 } | 2685 } |
OLD | NEW |