OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/time.h" | 6 #include "base/time.h" |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/tabs/tab_strip_model.h" | 8 #include "chrome/browser/tabs/tab_strip_model.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
11 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 11 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
17 #include "content/browser/renderer_host/render_view_host.h" | 17 #include "content/browser/renderer_host/render_view_host.h" |
18 #include "content/browser/tab_contents/interstitial_page.h" | 18 #include "content/browser/tab_contents/interstitial_page.h" |
19 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/navigation_controller.h" |
20 #include "content/public/browser/navigation_entry.h" | 20 #include "content/public/browser/navigation_entry.h" |
21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/ssl_status.h" | 22 #include "content/public/browser/ssl_status.h" |
| 23 #include "content/public/browser/web_contents.h" |
23 #include "content/public/common/security_style.h" | 24 #include "content/public/common/security_style.h" |
24 #include "net/base/cert_status_flags.h" | 25 #include "net/base/cert_status_flags.h" |
25 #include "net/test/test_server.h" | 26 #include "net/test/test_server.h" |
26 | 27 |
27 using content::NavigationEntry; | 28 using content::NavigationEntry; |
28 using content::SSLStatus; | 29 using content::SSLStatus; |
| 30 using content::WebContents; |
29 | 31 |
30 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); | 32 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); |
31 | 33 |
32 class SSLUITest : public InProcessBrowserTest { | 34 class SSLUITest : public InProcessBrowserTest { |
33 typedef net::TestServer::HTTPSOptions HTTPSOptions; | 35 typedef net::TestServer::HTTPSOptions HTTPSOptions; |
34 | 36 |
35 public: | 37 public: |
36 SSLUITest() | 38 SSLUITest() |
37 : https_server_( | 39 : https_server_( |
38 HTTPSOptions(HTTPSOptions::CERT_OK), FilePath(kDocRoot)), | 40 HTTPSOptions(HTTPSOptions::CERT_OK), FilePath(kDocRoot)), |
39 https_server_expired_( | 41 https_server_expired_( |
40 HTTPSOptions(HTTPSOptions::CERT_EXPIRED), FilePath(kDocRoot)), | 42 HTTPSOptions(HTTPSOptions::CERT_EXPIRED), FilePath(kDocRoot)), |
41 https_server_mismatched_( | 43 https_server_mismatched_( |
42 HTTPSOptions(HTTPSOptions::CERT_MISMATCHED_NAME), | 44 HTTPSOptions(HTTPSOptions::CERT_MISMATCHED_NAME), |
43 FilePath(kDocRoot)) { | 45 FilePath(kDocRoot)) { |
44 EnableDOMAutomation(); | 46 EnableDOMAutomation(); |
45 } | 47 } |
46 | 48 |
47 // Browser will both run and display insecure content. | 49 // Browser will both run and display insecure content. |
48 virtual void SetUpCommandLine(CommandLine* command_line) { | 50 virtual void SetUpCommandLine(CommandLine* command_line) { |
49 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); | 51 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); |
50 } | 52 } |
51 | 53 |
52 void CheckAuthenticatedState(TabContents* tab, | 54 void CheckAuthenticatedState(WebContents* tab, |
53 bool displayed_insecure_content) { | 55 bool displayed_insecure_content) { |
54 ASSERT_FALSE(tab->IsCrashed()); | 56 ASSERT_FALSE(tab->IsCrashed()); |
55 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 57 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
56 ASSERT_TRUE(entry); | 58 ASSERT_TRUE(entry); |
57 EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->GetPageType()); | 59 EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->GetPageType()); |
58 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED, | 60 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED, |
59 entry->GetSSL().security_style); | 61 entry->GetSSL().security_style); |
60 EXPECT_EQ(0U, entry->GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); | 62 EXPECT_EQ(0U, entry->GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); |
61 EXPECT_EQ(displayed_insecure_content, | 63 EXPECT_EQ(displayed_insecure_content, |
62 !!(entry->GetSSL().content_status & | 64 !!(entry->GetSSL().content_status & |
63 SSLStatus::DISPLAYED_INSECURE_CONTENT)); | 65 SSLStatus::DISPLAYED_INSECURE_CONTENT)); |
64 EXPECT_FALSE( | 66 EXPECT_FALSE( |
65 !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); | 67 !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); |
66 } | 68 } |
67 | 69 |
68 void CheckUnauthenticatedState(TabContents* tab) { | 70 void CheckUnauthenticatedState(WebContents* tab) { |
69 ASSERT_FALSE(tab->IsCrashed()); | 71 ASSERT_FALSE(tab->IsCrashed()); |
70 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 72 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
71 ASSERT_TRUE(entry); | 73 ASSERT_TRUE(entry); |
72 EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->GetPageType()); | 74 EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->GetPageType()); |
73 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED, | 75 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED, |
74 entry->GetSSL().security_style); | 76 entry->GetSSL().security_style); |
75 EXPECT_EQ(0U, entry->GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); | 77 EXPECT_EQ(0U, entry->GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); |
76 EXPECT_FALSE(!!(entry->GetSSL().content_status & | 78 EXPECT_FALSE(!!(entry->GetSSL().content_status & |
77 SSLStatus::DISPLAYED_INSECURE_CONTENT)); | 79 SSLStatus::DISPLAYED_INSECURE_CONTENT)); |
78 EXPECT_FALSE( | 80 EXPECT_FALSE( |
79 !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); | 81 !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); |
80 } | 82 } |
81 | 83 |
82 void CheckAuthenticationBrokenState(TabContents* tab, | 84 void CheckAuthenticationBrokenState(WebContents* tab, |
83 net::CertStatus error, | 85 net::CertStatus error, |
84 bool ran_insecure_content, | 86 bool ran_insecure_content, |
85 bool interstitial) { | 87 bool interstitial) { |
86 ASSERT_FALSE(tab->IsCrashed()); | 88 ASSERT_FALSE(tab->IsCrashed()); |
87 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 89 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
88 ASSERT_TRUE(entry); | 90 ASSERT_TRUE(entry); |
89 EXPECT_EQ(interstitial ? | 91 EXPECT_EQ(interstitial ? |
90 content::PAGE_TYPE_INTERSTITIAL : content::PAGE_TYPE_NORMAL, | 92 content::PAGE_TYPE_INTERSTITIAL : content::PAGE_TYPE_NORMAL, |
91 entry->GetPageType()); | 93 entry->GetPageType()); |
92 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, | 94 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, |
93 entry->GetSSL().security_style); | 95 entry->GetSSL().security_style); |
94 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style | 96 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style |
95 // to SECURITY_STYLE_AUTHENTICATION_BROKEN. | 97 // to SECURITY_STYLE_AUTHENTICATION_BROKEN. |
96 ASSERT_NE(net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION, error); | 98 ASSERT_NE(net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION, error); |
97 EXPECT_EQ(error, | 99 EXPECT_EQ(error, |
98 entry->GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); | 100 entry->GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); |
99 EXPECT_FALSE(!!(entry->GetSSL().content_status & | 101 EXPECT_FALSE(!!(entry->GetSSL().content_status & |
100 SSLStatus::DISPLAYED_INSECURE_CONTENT)); | 102 SSLStatus::DISPLAYED_INSECURE_CONTENT)); |
101 EXPECT_EQ(ran_insecure_content, | 103 EXPECT_EQ(ran_insecure_content, |
102 !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); | 104 !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); |
103 } | 105 } |
104 | 106 |
105 void CheckWorkerLoadResult(TabContents* tab, bool expectLoaded) { | 107 void CheckWorkerLoadResult(WebContents* tab, bool expectLoaded) { |
106 // Workers are async and we don't have notifications for them passing | 108 // Workers are async and we don't have notifications for them passing |
107 // messages since they do it between renderer and worker processes. | 109 // messages since they do it between renderer and worker processes. |
108 // So have a polling loop, check every 200ms, timeout at 30s. | 110 // So have a polling loop, check every 200ms, timeout at 30s. |
109 const int timeout_ms = 200; | 111 const int timeout_ms = 200; |
110 base::Time timeToQuit = base::Time::Now() + | 112 base::Time timeToQuit = base::Time::Now() + |
111 base::TimeDelta::FromMilliseconds(30000); | 113 base::TimeDelta::FromMilliseconds(30000); |
112 | 114 |
113 while (base::Time::Now() < timeToQuit) { | 115 while (base::Time::Now() < timeToQuit) { |
114 bool workerFinished = false; | 116 bool workerFinished = false; |
115 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 117 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
(...skipping 11 matching lines...) Expand all Loading... |
127 } | 129 } |
128 | 130 |
129 bool actuallyLoadedContent = false; | 131 bool actuallyLoadedContent = false; |
130 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 132 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
131 tab->GetRenderViewHost(), std::wstring(), | 133 tab->GetRenderViewHost(), std::wstring(), |
132 L"window.domAutomationController.send(IsContentLoaded());", | 134 L"window.domAutomationController.send(IsContentLoaded());", |
133 &actuallyLoadedContent)); | 135 &actuallyLoadedContent)); |
134 EXPECT_EQ(expectLoaded, actuallyLoadedContent); | 136 EXPECT_EQ(expectLoaded, actuallyLoadedContent); |
135 } | 137 } |
136 | 138 |
137 void ProceedThroughInterstitial(TabContents* tab) { | 139 void ProceedThroughInterstitial(content::WebContents* tab) { |
138 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); | 140 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); |
139 ASSERT_TRUE(interstitial_page); | 141 ASSERT_TRUE(interstitial_page); |
140 ui_test_utils::WindowedNotificationObserver observer( | 142 ui_test_utils::WindowedNotificationObserver observer( |
141 content::NOTIFICATION_LOAD_STOP, | 143 content::NOTIFICATION_LOAD_STOP, |
142 content::Source<NavigationController>(&tab->GetController())); | 144 content::Source<NavigationController>(&tab->GetController())); |
143 interstitial_page->Proceed(); | 145 interstitial_page->Proceed(); |
144 observer.Wait(); | 146 observer.Wait(); |
145 } | 147 } |
146 | 148 |
147 int GetConstrainedWindowCount() const { | 149 int GetConstrainedWindowCount() const { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 246 } |
245 }; | 247 }; |
246 | 248 |
247 // Visits a regular page over http. | 249 // Visits a regular page over http. |
248 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { | 250 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { |
249 ASSERT_TRUE(test_server()->Start()); | 251 ASSERT_TRUE(test_server()->Start()); |
250 | 252 |
251 ui_test_utils::NavigateToURL(browser(), | 253 ui_test_utils::NavigateToURL(browser(), |
252 test_server()->GetURL("files/ssl/google.html")); | 254 test_server()->GetURL("files/ssl/google.html")); |
253 | 255 |
254 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); | 256 CheckUnauthenticatedState(browser()->GetSelectedWebContents()); |
255 } | 257 } |
256 | 258 |
257 // Visits a page over http which includes broken https resources (status should | 259 // Visits a page over http which includes broken https resources (status should |
258 // be OK). | 260 // be OK). |
259 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give | 261 // TODO(jcampan): test that bad HTTPS content is blocked (otherwise we'll give |
260 // the secure cookies away!). | 262 // the secure cookies away!). |
261 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { | 263 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { |
262 ASSERT_TRUE(test_server()->Start()); | 264 ASSERT_TRUE(test_server()->Start()); |
263 ASSERT_TRUE(https_server_expired_.Start()); | 265 ASSERT_TRUE(https_server_expired_.Start()); |
264 | 266 |
265 std::string replacement_path; | 267 std::string replacement_path; |
266 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 268 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
267 "files/ssl/page_with_unsafe_contents.html", | 269 "files/ssl/page_with_unsafe_contents.html", |
268 https_server_expired_.host_port_pair(), | 270 https_server_expired_.host_port_pair(), |
269 &replacement_path)); | 271 &replacement_path)); |
270 | 272 |
271 ui_test_utils::NavigateToURL( | 273 ui_test_utils::NavigateToURL( |
272 browser(), test_server()->GetURL(replacement_path)); | 274 browser(), test_server()->GetURL(replacement_path)); |
273 | 275 |
274 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); | 276 CheckUnauthenticatedState(browser()->GetSelectedWebContents()); |
275 } | 277 } |
276 | 278 |
277 // http://crbug.com/91745 | 279 // http://crbug.com/91745 |
278 #if defined(OS_CHROMEOS) | 280 #if defined(OS_CHROMEOS) |
279 #define MAYBE_TestOKHTTPS FLAKY_TestOKHTTPS | 281 #define MAYBE_TestOKHTTPS FLAKY_TestOKHTTPS |
280 #else | 282 #else |
281 #define MAYBE_TestOKHTTPS TestOKHTTPS | 283 #define MAYBE_TestOKHTTPS TestOKHTTPS |
282 #endif | 284 #endif |
283 | 285 |
284 // Visits a page over OK https: | 286 // Visits a page over OK https: |
285 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestOKHTTPS) { | 287 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestOKHTTPS) { |
286 ASSERT_TRUE(https_server_.Start()); | 288 ASSERT_TRUE(https_server_.Start()); |
287 | 289 |
288 ui_test_utils::NavigateToURL(browser(), | 290 ui_test_utils::NavigateToURL(browser(), |
289 https_server_.GetURL("files/ssl/google.html")); | 291 https_server_.GetURL("files/ssl/google.html")); |
290 | 292 |
291 CheckAuthenticatedState(browser()->GetSelectedTabContents(), false); | 293 CheckAuthenticatedState(browser()->GetSelectedWebContents(), false); |
292 } | 294 } |
293 | 295 |
294 // Visits a page with https error and proceed: | 296 // Visits a page with https error and proceed: |
295 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { | 297 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { |
296 ASSERT_TRUE(https_server_expired_.Start()); | 298 ASSERT_TRUE(https_server_expired_.Start()); |
297 | 299 |
298 ui_test_utils::NavigateToURL(browser(), | 300 ui_test_utils::NavigateToURL(browser(), |
299 https_server_expired_.GetURL("files/ssl/google.html")); | 301 https_server_expired_.GetURL("files/ssl/google.html")); |
300 | 302 |
301 TabContents* tab = browser()->GetSelectedTabContents(); | 303 WebContents* tab = browser()->GetSelectedWebContents(); |
302 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 304 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
303 true); // Interstitial showing | 305 true); // Interstitial showing |
304 | 306 |
305 ProceedThroughInterstitial(tab); | 307 ProceedThroughInterstitial(tab); |
306 | 308 |
307 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 309 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
308 false); // No interstitial showing | 310 false); // No interstitial showing |
309 } | 311 } |
310 | 312 |
311 // Visits a page with https error and don't proceed (and ensure we can still | 313 // Visits a page with https error and don't proceed (and ensure we can still |
312 // navigate at that point): | 314 // navigate at that point): |
313 #if defined(OS_WIN) | 315 #if defined(OS_WIN) |
314 // Disabled, flakily exceeds test timeout, http://crbug.com/43575. | 316 // Disabled, flakily exceeds test timeout, http://crbug.com/43575. |
315 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ | 317 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ |
316 DISABLED_TestHTTPSExpiredCertAndDontProceed | 318 DISABLED_TestHTTPSExpiredCertAndDontProceed |
317 #else | 319 #else |
318 // Marked as flaky, see bug 40932. | 320 // Marked as flaky, see bug 40932. |
319 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ | 321 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ |
320 FLAKY_TestHTTPSExpiredCertAndDontProceed | 322 FLAKY_TestHTTPSExpiredCertAndDontProceed |
321 #endif | 323 #endif |
322 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSExpiredCertAndDontProceed) { | 324 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSExpiredCertAndDontProceed) { |
323 ASSERT_TRUE(test_server()->Start()); | 325 ASSERT_TRUE(test_server()->Start()); |
324 ASSERT_TRUE(https_server_.Start()); | 326 ASSERT_TRUE(https_server_.Start()); |
325 ASSERT_TRUE(https_server_expired_.Start()); | 327 ASSERT_TRUE(https_server_expired_.Start()); |
326 | 328 |
327 // First navigate to an OK page. | 329 // First navigate to an OK page. |
328 ui_test_utils::NavigateToURL(browser(), | 330 ui_test_utils::NavigateToURL(browser(), |
329 https_server_.GetURL("files/ssl/google.html")); | 331 https_server_.GetURL("files/ssl/google.html")); |
330 | 332 |
331 TabContents* tab = browser()->GetSelectedTabContents(); | 333 WebContents* tab = browser()->GetSelectedWebContents(); |
332 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 334 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
333 ASSERT_TRUE(entry); | 335 ASSERT_TRUE(entry); |
334 | 336 |
335 GURL cross_site_url = | 337 GURL cross_site_url = |
336 https_server_expired_.GetURL("files/ssl/google.html"); | 338 https_server_expired_.GetURL("files/ssl/google.html"); |
337 // Change the host name from 127.0.0.1 to localhost so it triggers a | 339 // Change the host name from 127.0.0.1 to localhost so it triggers a |
338 // cross-site navigation so we can test http://crbug.com/5800 is gone. | 340 // cross-site navigation so we can test http://crbug.com/5800 is gone. |
339 ASSERT_EQ("127.0.0.1", cross_site_url.host()); | 341 ASSERT_EQ("127.0.0.1", cross_site_url.host()); |
340 GURL::Replacements replacements; | 342 GURL::Replacements replacements; |
341 std::string new_host("localhost"); | 343 std::string new_host("localhost"); |
(...skipping 24 matching lines...) Expand all Loading... |
366 // Visits a page with https error and then goes back using Browser::GoBack. | 368 // Visits a page with https error and then goes back using Browser::GoBack. |
367 // Marked as flaky, see bug 40932. | 369 // Marked as flaky, see bug 40932. |
368 IN_PROC_BROWSER_TEST_F(SSLUITest, | 370 IN_PROC_BROWSER_TEST_F(SSLUITest, |
369 FLAKY_TestHTTPSExpiredCertAndGoBackViaButton) { | 371 FLAKY_TestHTTPSExpiredCertAndGoBackViaButton) { |
370 ASSERT_TRUE(test_server()->Start()); | 372 ASSERT_TRUE(test_server()->Start()); |
371 ASSERT_TRUE(https_server_expired_.Start()); | 373 ASSERT_TRUE(https_server_expired_.Start()); |
372 | 374 |
373 // First navigate to an HTTP page. | 375 // First navigate to an HTTP page. |
374 ui_test_utils::NavigateToURL(browser(), | 376 ui_test_utils::NavigateToURL(browser(), |
375 test_server()->GetURL("files/ssl/google.html")); | 377 test_server()->GetURL("files/ssl/google.html")); |
376 TabContents* tab = browser()->GetSelectedTabContents(); | 378 WebContents* tab = browser()->GetSelectedWebContents(); |
377 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 379 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
378 ASSERT_TRUE(entry); | 380 ASSERT_TRUE(entry); |
379 | 381 |
380 // Now go to a bad HTTPS page that shows an interstitial. | 382 // Now go to a bad HTTPS page that shows an interstitial. |
381 ui_test_utils::NavigateToURL(browser(), | 383 ui_test_utils::NavigateToURL(browser(), |
382 https_server_expired_.GetURL("files/ssl/google.html")); | 384 https_server_expired_.GetURL("files/ssl/google.html")); |
383 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 385 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
384 true); // Interstitial showing | 386 true); // Interstitial showing |
385 | 387 |
386 ui_test_utils::WindowedNotificationObserver load_failed_observer( | 388 ui_test_utils::WindowedNotificationObserver load_failed_observer( |
387 content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 389 content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
388 content::NotificationService::AllSources()); | 390 content::NotificationService::AllSources()); |
389 | 391 |
390 // Simulate user clicking on back button (crbug.com/39248). | 392 // Simulate user clicking on back button (crbug.com/39248). |
391 browser()->GoBack(CURRENT_TAB); | 393 browser()->GoBack(CURRENT_TAB); |
392 | 394 |
393 // Wait until we hear the load failure, and make sure we haven't swapped out | 395 // Wait until we hear the load failure, and make sure we haven't swapped out |
394 // the previous page. Prevents regression of http://crbug.com/82667. | 396 // the previous page. Prevents regression of http://crbug.com/82667. |
395 load_failed_observer.Wait(); | 397 load_failed_observer.Wait(); |
396 EXPECT_FALSE(tab->GetRenderViewHost()->is_swapped_out()); | 398 EXPECT_FALSE(tab->GetRenderViewHost()->is_swapped_out()); |
397 | 399 |
398 // We should be back at the original good page. | 400 // We should be back at the original good page. |
399 EXPECT_FALSE(browser()->GetSelectedTabContents()->GetInterstitialPage()); | 401 EXPECT_FALSE(browser()->GetSelectedWebContents()->GetInterstitialPage()); |
400 CheckUnauthenticatedState(tab); | 402 CheckUnauthenticatedState(tab); |
401 } | 403 } |
402 | 404 |
403 // Visits a page with https error and then goes back using GoToOffset. | 405 // Visits a page with https error and then goes back using GoToOffset. |
404 // Marked as flaky, see bug 40932. | 406 // Marked as flaky, see bug 40932. |
405 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoBackViaMenu) { | 407 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoBackViaMenu) { |
406 ASSERT_TRUE(test_server()->Start()); | 408 ASSERT_TRUE(test_server()->Start()); |
407 ASSERT_TRUE(https_server_expired_.Start()); | 409 ASSERT_TRUE(https_server_expired_.Start()); |
408 | 410 |
409 // First navigate to an HTTP page. | 411 // First navigate to an HTTP page. |
410 ui_test_utils::NavigateToURL(browser(), | 412 ui_test_utils::NavigateToURL(browser(), |
411 test_server()->GetURL("files/ssl/google.html")); | 413 test_server()->GetURL("files/ssl/google.html")); |
412 TabContents* tab = browser()->GetSelectedTabContents(); | 414 WebContents* tab = browser()->GetSelectedWebContents(); |
413 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 415 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
414 ASSERT_TRUE(entry); | 416 ASSERT_TRUE(entry); |
415 | 417 |
416 // Now go to a bad HTTPS page that shows an interstitial. | 418 // Now go to a bad HTTPS page that shows an interstitial. |
417 ui_test_utils::NavigateToURL(browser(), | 419 ui_test_utils::NavigateToURL(browser(), |
418 https_server_expired_.GetURL("files/ssl/google.html")); | 420 https_server_expired_.GetURL("files/ssl/google.html")); |
419 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 421 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
420 true); // Interstitial showing | 422 true); // Interstitial showing |
421 | 423 |
422 // Simulate user clicking and holding on back button (crbug.com/37215). | 424 // Simulate user clicking and holding on back button (crbug.com/37215). |
423 tab->GetController().GoToOffset(-1); | 425 tab->GetController().GoToOffset(-1); |
424 | 426 |
425 // We should be back at the original good page. | 427 // We should be back at the original good page. |
426 EXPECT_FALSE(browser()->GetSelectedTabContents()->GetInterstitialPage()); | 428 EXPECT_FALSE(browser()->GetSelectedWebContents()->GetInterstitialPage()); |
427 CheckUnauthenticatedState(tab); | 429 CheckUnauthenticatedState(tab); |
428 } | 430 } |
429 | 431 |
430 // Visits a page with https error and then goes forward using GoToOffset. | 432 // Visits a page with https error and then goes forward using GoToOffset. |
431 // Marked as flaky, see bug 40932. | 433 // Marked as flaky, see bug 40932. |
432 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoForward) { | 434 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoForward) { |
433 ASSERT_TRUE(test_server()->Start()); | 435 ASSERT_TRUE(test_server()->Start()); |
434 ASSERT_TRUE(https_server_expired_.Start()); | 436 ASSERT_TRUE(https_server_expired_.Start()); |
435 | 437 |
436 // First navigate to two HTTP pages. | 438 // First navigate to two HTTP pages. |
437 ui_test_utils::NavigateToURL(browser(), | 439 ui_test_utils::NavigateToURL(browser(), |
438 test_server()->GetURL("files/ssl/google.html")); | 440 test_server()->GetURL("files/ssl/google.html")); |
439 TabContents* tab = browser()->GetSelectedTabContents(); | 441 WebContents* tab = browser()->GetSelectedWebContents(); |
440 NavigationEntry* entry1 = tab->GetController().GetActiveEntry(); | 442 NavigationEntry* entry1 = tab->GetController().GetActiveEntry(); |
441 ASSERT_TRUE(entry1); | 443 ASSERT_TRUE(entry1); |
442 ui_test_utils::NavigateToURL(browser(), | 444 ui_test_utils::NavigateToURL(browser(), |
443 test_server()->GetURL("files/ssl/blank_page.html")); | 445 test_server()->GetURL("files/ssl/blank_page.html")); |
444 NavigationEntry* entry2 = tab->GetController().GetActiveEntry(); | 446 NavigationEntry* entry2 = tab->GetController().GetActiveEntry(); |
445 ASSERT_TRUE(entry2); | 447 ASSERT_TRUE(entry2); |
446 | 448 |
447 // Now go back so that a page is in the forward history. | 449 // Now go back so that a page is in the forward history. |
448 { | 450 { |
449 ui_test_utils::WindowedNotificationObserver observer( | 451 ui_test_utils::WindowedNotificationObserver observer( |
(...skipping 15 matching lines...) Expand all Loading... |
465 // Simulate user clicking and holding on forward button. | 467 // Simulate user clicking and holding on forward button. |
466 { | 468 { |
467 ui_test_utils::WindowedNotificationObserver observer( | 469 ui_test_utils::WindowedNotificationObserver observer( |
468 content::NOTIFICATION_LOAD_STOP, | 470 content::NOTIFICATION_LOAD_STOP, |
469 content::Source<NavigationController>(&tab->GetController())); | 471 content::Source<NavigationController>(&tab->GetController())); |
470 tab->GetController().GoToOffset(1); | 472 tab->GetController().GoToOffset(1); |
471 observer.Wait(); | 473 observer.Wait(); |
472 } | 474 } |
473 | 475 |
474 // We should be showing the second good page. | 476 // We should be showing the second good page. |
475 EXPECT_FALSE(browser()->GetSelectedTabContents()->GetInterstitialPage()); | 477 EXPECT_FALSE(browser()->GetSelectedWebContents()->GetInterstitialPage()); |
476 CheckUnauthenticatedState(tab); | 478 CheckUnauthenticatedState(tab); |
477 EXPECT_FALSE(tab->GetController().CanGoForward()); | 479 EXPECT_FALSE(tab->GetController().CanGoForward()); |
478 NavigationEntry* entry4 = tab->GetController().GetActiveEntry(); | 480 NavigationEntry* entry4 = tab->GetController().GetActiveEntry(); |
479 EXPECT_TRUE(entry2 == entry4); | 481 EXPECT_TRUE(entry2 == entry4); |
480 } | 482 } |
481 | 483 |
482 // Flaky on CrOS http://crbug.com/92292 | 484 // Flaky on CrOS http://crbug.com/92292 |
483 #if defined(OS_CHROMEOS) | 485 #if defined(OS_CHROMEOS) |
484 #define MAYBE_TestHTTPSErrorWithNoNavEntry \ | 486 #define MAYBE_TestHTTPSErrorWithNoNavEntry \ |
485 DISABLED_TestHTTPSErrorWithNoNavEntry | 487 DISABLED_TestHTTPSErrorWithNoNavEntry |
486 #else | 488 #else |
487 #define MAYBE_TestHTTPSErrorWithNoNavEntry TestHTTPSErrorWithNoNavEntry | 489 #define MAYBE_TestHTTPSErrorWithNoNavEntry TestHTTPSErrorWithNoNavEntry |
488 #endif // defined(OS_CHROMEOS) | 490 #endif // defined(OS_CHROMEOS) |
489 | 491 |
490 // Open a page with a HTTPS error in a tab with no prior navigation (through a | 492 // Open a page with a HTTPS error in a tab with no prior navigation (through a |
491 // link with a blank target). This is to test that the lack of navigation entry | 493 // link with a blank target). This is to test that the lack of navigation entry |
492 // does not cause any problems (it was causing a crasher, see | 494 // does not cause any problems (it was causing a crasher, see |
493 // http://crbug.com/19941). | 495 // http://crbug.com/19941). |
494 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSErrorWithNoNavEntry) { | 496 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSErrorWithNoNavEntry) { |
495 ASSERT_TRUE(https_server_expired_.Start()); | 497 ASSERT_TRUE(https_server_expired_.Start()); |
496 | 498 |
497 GURL url = https_server_expired_.GetURL("files/ssl/google.htm"); | 499 GURL url = https_server_expired_.GetURL("files/ssl/google.htm"); |
498 TabContentsWrapper* tab2 = | 500 TabContentsWrapper* tab2 = |
499 browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); | 501 browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); |
500 ui_test_utils::WaitForLoadStop(tab2->tab_contents()); | 502 ui_test_utils::WaitForLoadStop(tab2->web_contents()); |
501 | 503 |
502 // Verify our assumption that there was no prior navigation. | 504 // Verify our assumption that there was no prior navigation. |
503 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_BACK)); | 505 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_BACK)); |
504 | 506 |
505 // We should have an interstitial page showing. | 507 // We should have an interstitial page showing. |
506 ASSERT_TRUE(tab2->tab_contents()->GetInterstitialPage()); | 508 ASSERT_TRUE(tab2->web_contents()->GetInterstitialPage()); |
507 } | 509 } |
508 | 510 |
509 // Disabled due to crash in downloads code that this triggers. | 511 // Disabled due to crash in downloads code that this triggers. |
510 // http://crbug.com/95331 | 512 // http://crbug.com/95331 |
511 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestBadHTTPSDownload) { | 513 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestBadHTTPSDownload) { |
512 ASSERT_TRUE(test_server()->Start()); | 514 ASSERT_TRUE(test_server()->Start()); |
513 ASSERT_TRUE(https_server_expired_.Start()); | 515 ASSERT_TRUE(https_server_expired_.Start()); |
514 GURL url_non_dangerous = test_server()->GetURL(""); | 516 GURL url_non_dangerous = test_server()->GetURL(""); |
515 GURL url_dangerous = https_server_expired_.GetURL( | 517 GURL url_dangerous = https_server_expired_.GetURL( |
516 "files/downloads/dangerous/dangerous.exe"); | 518 "files/downloads/dangerous/dangerous.exe"); |
517 | 519 |
518 // Visit a non-dangerous page. | 520 // Visit a non-dangerous page. |
519 ui_test_utils::NavigateToURL(browser(), url_non_dangerous); | 521 ui_test_utils::NavigateToURL(browser(), url_non_dangerous); |
520 | 522 |
521 // Now, start a transition to dangerous download. | 523 // Now, start a transition to dangerous download. |
522 { | 524 { |
523 ui_test_utils::WindowedNotificationObserver observer( | 525 ui_test_utils::WindowedNotificationObserver observer( |
524 content::NOTIFICATION_LOAD_STOP, | 526 content::NOTIFICATION_LOAD_STOP, |
525 content::NotificationService::AllSources()); | 527 content::NotificationService::AllSources()); |
526 browser::NavigateParams navigate_params(browser(), url_dangerous, | 528 browser::NavigateParams navigate_params(browser(), url_dangerous, |
527 content::PAGE_TRANSITION_TYPED); | 529 content::PAGE_TRANSITION_TYPED); |
528 browser::Navigate(&navigate_params); | 530 browser::Navigate(&navigate_params); |
529 observer.Wait(); | 531 observer.Wait(); |
530 } | 532 } |
531 | 533 |
532 // Proceed through the SSL interstitial. This doesn't use | 534 // Proceed through the SSL interstitial. This doesn't use |
533 // |ProceedThroughInterstitial| since no page load will commit. | 535 // |ProceedThroughInterstitial| since no page load will commit. |
534 TabContents* tab = browser()->GetSelectedTabContents(); | 536 WebContents* tab = browser()->GetSelectedWebContents(); |
535 ASSERT_TRUE(tab != NULL); | 537 ASSERT_TRUE(tab != NULL); |
536 ASSERT_TRUE(tab->GetInterstitialPage() != NULL); | 538 ASSERT_TRUE(tab->GetInterstitialPage() != NULL); |
537 { | 539 { |
538 ui_test_utils::WindowedNotificationObserver observer( | 540 ui_test_utils::WindowedNotificationObserver observer( |
539 chrome::NOTIFICATION_DOWNLOAD_INITIATED, | 541 chrome::NOTIFICATION_DOWNLOAD_INITIATED, |
540 content::NotificationService::AllSources()); | 542 content::NotificationService::AllSources()); |
541 tab->GetInterstitialPage()->Proceed(); | 543 tab->GetInterstitialPage()->Proceed(); |
542 observer.Wait(); | 544 observer.Wait(); |
543 } | 545 } |
544 | 546 |
(...skipping 18 matching lines...) Expand all Loading... |
563 std::string replacement_path; | 565 std::string replacement_path; |
564 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 566 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
565 "files/ssl/page_displays_insecure_content.html", | 567 "files/ssl/page_displays_insecure_content.html", |
566 test_server()->host_port_pair(), | 568 test_server()->host_port_pair(), |
567 &replacement_path)); | 569 &replacement_path)); |
568 | 570 |
569 // Load a page that displays insecure content. | 571 // Load a page that displays insecure content. |
570 ui_test_utils::NavigateToURL(browser(), | 572 ui_test_utils::NavigateToURL(browser(), |
571 https_server_.GetURL(replacement_path)); | 573 https_server_.GetURL(replacement_path)); |
572 | 574 |
573 CheckAuthenticatedState(browser()->GetSelectedTabContents(), true); | 575 CheckAuthenticatedState(browser()->GetSelectedWebContents(), true); |
574 } | 576 } |
575 | 577 |
576 // Visits a page that runs insecure content and tries to suppress the insecure | 578 // Visits a page that runs insecure content and tries to suppress the insecure |
577 // content warnings by randomizing location.hash. | 579 // content warnings by randomizing location.hash. |
578 // Based on http://crbug.com/8706 | 580 // Based on http://crbug.com/8706 |
579 IN_PROC_BROWSER_TEST_F(SSLUITest, | 581 IN_PROC_BROWSER_TEST_F(SSLUITest, |
580 TestRunsInsecuredContentRandomizeHash) { | 582 TestRunsInsecuredContentRandomizeHash) { |
581 ASSERT_TRUE(test_server()->Start()); | 583 ASSERT_TRUE(test_server()->Start()); |
582 ASSERT_TRUE(https_server_.Start()); | 584 ASSERT_TRUE(https_server_.Start()); |
583 | 585 |
584 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 586 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( |
585 "files/ssl/page_runs_insecure_content.html")); | 587 "files/ssl/page_runs_insecure_content.html")); |
586 | 588 |
587 CheckAuthenticationBrokenState(browser()->GetSelectedTabContents(), 0, true, | 589 CheckAuthenticationBrokenState(browser()->GetSelectedWebContents(), 0, true, |
588 false); | 590 false); |
589 } | 591 } |
590 | 592 |
591 // Visits a page with unsafe content and make sure that: | 593 // Visits a page with unsafe content and make sure that: |
592 // - frames content is replaced with warning | 594 // - frames content is replaced with warning |
593 // - images and scripts are filtered out entirely | 595 // - images and scripts are filtered out entirely |
594 // Marked as flaky, see bug 40932. | 596 // Marked as flaky, see bug 40932. |
595 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContents) { | 597 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContents) { |
596 ASSERT_TRUE(https_server_.Start()); | 598 ASSERT_TRUE(https_server_.Start()); |
597 ASSERT_TRUE(https_server_expired_.Start()); | 599 ASSERT_TRUE(https_server_expired_.Start()); |
598 | 600 |
599 std::string replacement_path; | 601 std::string replacement_path; |
600 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 602 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
601 "files/ssl/page_with_unsafe_contents.html", | 603 "files/ssl/page_with_unsafe_contents.html", |
602 https_server_expired_.host_port_pair(), | 604 https_server_expired_.host_port_pair(), |
603 &replacement_path)); | 605 &replacement_path)); |
604 ui_test_utils::NavigateToURL(browser(), | 606 ui_test_utils::NavigateToURL(browser(), |
605 https_server_.GetURL(replacement_path)); | 607 https_server_.GetURL(replacement_path)); |
606 | 608 |
607 TabContents* tab = browser()->GetSelectedTabContents(); | 609 WebContents* tab = browser()->GetSelectedWebContents(); |
608 // When the bad content is filtered, the state is expected to be | 610 // When the bad content is filtered, the state is expected to be |
609 // authenticated. | 611 // authenticated. |
610 CheckAuthenticatedState(tab, false); | 612 CheckAuthenticatedState(tab, false); |
611 | 613 |
612 // Because of cross-frame scripting restrictions, we cannot access the iframe | 614 // Because of cross-frame scripting restrictions, we cannot access the iframe |
613 // content. So to know if the frame was loaded, we just check if a popup was | 615 // content. So to know if the frame was loaded, we just check if a popup was |
614 // opened (the iframe content opens one). | 616 // opened (the iframe content opens one). |
615 // Note: because of bug 1115868, no constrained window is opened right now. | 617 // Note: because of bug 1115868, no constrained window is opened right now. |
616 // Once the bug is fixed, this will do the real check. | 618 // Once the bug is fixed, this will do the real check. |
617 EXPECT_EQ(0, GetConstrainedWindowCount()); | 619 EXPECT_EQ(0, GetConstrainedWindowCount()); |
(...skipping 21 matching lines...) Expand all Loading... |
639 ASSERT_TRUE(https_server_.Start()); | 641 ASSERT_TRUE(https_server_.Start()); |
640 | 642 |
641 std::string replacement_path; | 643 std::string replacement_path; |
642 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 644 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
643 "files/ssl/page_with_dynamic_insecure_content.html", | 645 "files/ssl/page_with_dynamic_insecure_content.html", |
644 test_server()->host_port_pair(), | 646 test_server()->host_port_pair(), |
645 &replacement_path)); | 647 &replacement_path)); |
646 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 648 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( |
647 replacement_path)); | 649 replacement_path)); |
648 | 650 |
649 TabContents* tab = browser()->GetSelectedTabContents(); | 651 WebContents* tab = browser()->GetSelectedWebContents(); |
650 CheckAuthenticatedState(tab, false); | 652 CheckAuthenticatedState(tab, false); |
651 | 653 |
652 // Load the insecure image. | 654 // Load the insecure image. |
653 bool js_result = false; | 655 bool js_result = false; |
654 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 656 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
655 tab->GetRenderViewHost(), std::wstring(), L"loadBadImage();", | 657 tab->GetRenderViewHost(), std::wstring(), L"loadBadImage();", |
656 &js_result)); | 658 &js_result)); |
657 EXPECT_TRUE(js_result); | 659 EXPECT_TRUE(js_result); |
658 | 660 |
659 // We should now have insecure content. | 661 // We should now have insecure content. |
660 CheckAuthenticatedState(tab, true); | 662 CheckAuthenticatedState(tab, true); |
661 } | 663 } |
662 | 664 |
663 // Visits two pages from the same origin: one that displays insecure content and | 665 // Visits two pages from the same origin: one that displays insecure content and |
664 // one that doesn't. The test checks that we do not propagate the insecure | 666 // one that doesn't. The test checks that we do not propagate the insecure |
665 // content state from one to the other. | 667 // content state from one to the other. |
666 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) { | 668 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) { |
667 ASSERT_TRUE(test_server()->Start()); | 669 ASSERT_TRUE(test_server()->Start()); |
668 ASSERT_TRUE(https_server_.Start()); | 670 ASSERT_TRUE(https_server_.Start()); |
669 | 671 |
670 ui_test_utils::NavigateToURL(browser(), | 672 ui_test_utils::NavigateToURL(browser(), |
671 https_server_.GetURL("files/ssl/blank_page.html")); | 673 https_server_.GetURL("files/ssl/blank_page.html")); |
672 | 674 |
673 TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper(); | 675 TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper(); |
674 | 676 |
675 // This tab should be fine. | 677 // This tab should be fine. |
676 CheckAuthenticatedState(tab1->tab_contents(), false); | 678 CheckAuthenticatedState(tab1->web_contents(), false); |
677 | 679 |
678 // Create a new tab. | 680 // Create a new tab. |
679 std::string replacement_path; | 681 std::string replacement_path; |
680 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 682 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
681 "files/ssl/page_displays_insecure_content.html", | 683 "files/ssl/page_displays_insecure_content.html", |
682 test_server()->host_port_pair(), | 684 test_server()->host_port_pair(), |
683 &replacement_path)); | 685 &replacement_path)); |
684 | 686 |
685 GURL url = https_server_.GetURL(replacement_path); | 687 GURL url = https_server_.GetURL(replacement_path); |
686 browser::NavigateParams params( | 688 browser::NavigateParams params( |
687 browser(), url, content::PAGE_TRANSITION_TYPED); | 689 browser(), url, content::PAGE_TRANSITION_TYPED); |
688 params.disposition = NEW_FOREGROUND_TAB; | 690 params.disposition = NEW_FOREGROUND_TAB; |
689 params.tabstrip_index = 0; | 691 params.tabstrip_index = 0; |
690 params.source_contents = tab1; | 692 params.source_contents = tab1; |
691 ui_test_utils::WindowedNotificationObserver observer( | 693 ui_test_utils::WindowedNotificationObserver observer( |
692 content::NOTIFICATION_LOAD_STOP, | 694 content::NOTIFICATION_LOAD_STOP, |
693 content::NotificationService::AllSources()); | 695 content::NotificationService::AllSources()); |
694 browser::Navigate(¶ms); | 696 browser::Navigate(¶ms); |
695 TabContentsWrapper* tab2 = params.target_contents; | 697 TabContentsWrapper* tab2 = params.target_contents; |
696 observer.Wait(); | 698 observer.Wait(); |
697 | 699 |
698 // The new tab has insecure content. | 700 // The new tab has insecure content. |
699 CheckAuthenticatedState(tab2->tab_contents(), true); | 701 CheckAuthenticatedState(tab2->web_contents(), true); |
700 | 702 |
701 // The original tab should not be contaminated. | 703 // The original tab should not be contaminated. |
702 CheckAuthenticatedState(tab1->tab_contents(), false); | 704 CheckAuthenticatedState(tab1->web_contents(), false); |
703 } | 705 } |
704 | 706 |
705 // Visits two pages from the same origin: one that runs insecure content and one | 707 // Visits two pages from the same origin: one that runs insecure content and one |
706 // that doesn't. The test checks that we propagate the insecure content state | 708 // that doesn't. The test checks that we propagate the insecure content state |
707 // from one to the other. | 709 // from one to the other. |
708 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) { | 710 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) { |
709 ASSERT_TRUE(test_server()->Start()); | 711 ASSERT_TRUE(test_server()->Start()); |
710 ASSERT_TRUE(https_server_.Start()); | 712 ASSERT_TRUE(https_server_.Start()); |
711 | 713 |
712 ui_test_utils::NavigateToURL(browser(), | 714 ui_test_utils::NavigateToURL(browser(), |
713 https_server_.GetURL("files/ssl/blank_page.html")); | 715 https_server_.GetURL("files/ssl/blank_page.html")); |
714 | 716 |
715 TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper(); | 717 TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper(); |
716 | 718 |
717 // This tab should be fine. | 719 // This tab should be fine. |
718 CheckAuthenticatedState(tab1->tab_contents(), false); | 720 CheckAuthenticatedState(tab1->web_contents(), false); |
719 | 721 |
720 std::string replacement_path; | 722 std::string replacement_path; |
721 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 723 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
722 "files/ssl/page_runs_insecure_content.html", | 724 "files/ssl/page_runs_insecure_content.html", |
723 test_server()->host_port_pair(), | 725 test_server()->host_port_pair(), |
724 &replacement_path)); | 726 &replacement_path)); |
725 | 727 |
726 // Create a new tab. | 728 // Create a new tab. |
727 GURL url = https_server_.GetURL(replacement_path); | 729 GURL url = https_server_.GetURL(replacement_path); |
728 browser::NavigateParams params( | 730 browser::NavigateParams params( |
729 browser(), url, content::PAGE_TRANSITION_TYPED); | 731 browser(), url, content::PAGE_TRANSITION_TYPED); |
730 params.disposition = NEW_FOREGROUND_TAB; | 732 params.disposition = NEW_FOREGROUND_TAB; |
731 params.source_contents = tab1; | 733 params.source_contents = tab1; |
732 ui_test_utils::WindowedNotificationObserver observer( | 734 ui_test_utils::WindowedNotificationObserver observer( |
733 content::NOTIFICATION_LOAD_STOP, | 735 content::NOTIFICATION_LOAD_STOP, |
734 content::NotificationService::AllSources()); | 736 content::NotificationService::AllSources()); |
735 browser::Navigate(¶ms); | 737 browser::Navigate(¶ms); |
736 TabContentsWrapper* tab2 = params.target_contents; | 738 TabContentsWrapper* tab2 = params.target_contents; |
737 observer.Wait(); | 739 observer.Wait(); |
738 | 740 |
739 // The new tab has insecure content. | 741 // The new tab has insecure content. |
740 CheckAuthenticationBrokenState(tab2->tab_contents(), 0, true, false); | 742 CheckAuthenticationBrokenState(tab2->web_contents(), 0, true, false); |
741 | 743 |
742 // Which means the origin for the first tab has also been contaminated with | 744 // Which means the origin for the first tab has also been contaminated with |
743 // insecure content. | 745 // insecure content. |
744 CheckAuthenticationBrokenState(tab1->tab_contents(), 0, true, false); | 746 CheckAuthenticationBrokenState(tab1->web_contents(), 0, true, false); |
745 } | 747 } |
746 | 748 |
747 // Visits a page with an image over http. Visits another page over https | 749 // Visits a page with an image over http. Visits another page over https |
748 // referencing that same image over http (hoping it is coming from the webcore | 750 // referencing that same image over http (hoping it is coming from the webcore |
749 // memory cache). | 751 // memory cache). |
750 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) { | 752 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) { |
751 ASSERT_TRUE(test_server()->Start()); | 753 ASSERT_TRUE(test_server()->Start()); |
752 ASSERT_TRUE(https_server_.Start()); | 754 ASSERT_TRUE(https_server_.Start()); |
753 | 755 |
754 std::string replacement_path; | 756 std::string replacement_path; |
755 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 757 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
756 "files/ssl/page_displays_insecure_content.html", | 758 "files/ssl/page_displays_insecure_content.html", |
757 test_server()->host_port_pair(), | 759 test_server()->host_port_pair(), |
758 &replacement_path)); | 760 &replacement_path)); |
759 | 761 |
760 // Load original page over HTTP. | 762 // Load original page over HTTP. |
761 const GURL url_http = test_server()->GetURL(replacement_path); | 763 const GURL url_http = test_server()->GetURL(replacement_path); |
762 ui_test_utils::NavigateToURL(browser(), url_http); | 764 ui_test_utils::NavigateToURL(browser(), url_http); |
763 TabContents* tab = browser()->GetSelectedTabContents(); | 765 WebContents* tab = browser()->GetSelectedWebContents(); |
764 CheckUnauthenticatedState(tab); | 766 CheckUnauthenticatedState(tab); |
765 | 767 |
766 // Load again but over SSL. It should be marked as displaying insecure | 768 // Load again but over SSL. It should be marked as displaying insecure |
767 // content (even though the image comes from the WebCore memory cache). | 769 // content (even though the image comes from the WebCore memory cache). |
768 const GURL url_https = https_server_.GetURL(replacement_path); | 770 const GURL url_https = https_server_.GetURL(replacement_path); |
769 ui_test_utils::NavigateToURL(browser(), url_https); | 771 ui_test_utils::NavigateToURL(browser(), url_https); |
770 CheckAuthenticatedState(tab, true); | 772 CheckAuthenticatedState(tab, true); |
771 } | 773 } |
772 | 774 |
773 // http://crbug.com/84729 | 775 // http://crbug.com/84729 |
(...skipping 13 matching lines...) Expand all Loading... |
787 | 789 |
788 std::string replacement_path; | 790 std::string replacement_path; |
789 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 791 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
790 "files/ssl/page_runs_insecure_content.html", | 792 "files/ssl/page_runs_insecure_content.html", |
791 test_server()->host_port_pair(), | 793 test_server()->host_port_pair(), |
792 &replacement_path)); | 794 &replacement_path)); |
793 | 795 |
794 // Load original page over HTTP. | 796 // Load original page over HTTP. |
795 const GURL url_http = test_server()->GetURL(replacement_path); | 797 const GURL url_http = test_server()->GetURL(replacement_path); |
796 ui_test_utils::NavigateToURL(browser(), url_http); | 798 ui_test_utils::NavigateToURL(browser(), url_http); |
797 TabContents* tab = browser()->GetSelectedTabContents(); | 799 WebContents* tab = browser()->GetSelectedWebContents(); |
798 CheckUnauthenticatedState(tab); | 800 CheckUnauthenticatedState(tab); |
799 | 801 |
800 // Load again but over SSL. It should be marked as displaying insecure | 802 // Load again but over SSL. It should be marked as displaying insecure |
801 // content (even though the image comes from the WebCore memory cache). | 803 // content (even though the image comes from the WebCore memory cache). |
802 const GURL url_https = https_server_.GetURL(replacement_path); | 804 const GURL url_https = https_server_.GetURL(replacement_path); |
803 ui_test_utils::NavigateToURL(browser(), url_https); | 805 ui_test_utils::NavigateToURL(browser(), url_https); |
804 CheckAuthenticationBrokenState(tab, 0, true, false); | 806 CheckAuthenticationBrokenState(tab, 0, true, false); |
805 } | 807 } |
806 | 808 |
807 // This test ensures the CN invalid status does not 'stick' to a certificate | 809 // This test ensures the CN invalid status does not 'stick' to a certificate |
808 // (see bug #1044942) and that it depends on the host-name. | 810 // (see bug #1044942) and that it depends on the host-name. |
809 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) { | 811 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) { |
810 ASSERT_TRUE(https_server_.Start()); | 812 ASSERT_TRUE(https_server_.Start()); |
811 ASSERT_TRUE(https_server_mismatched_.Start()); | 813 ASSERT_TRUE(https_server_mismatched_.Start()); |
812 | 814 |
813 // First we hit the server with hostname, this generates an invalid policy | 815 // First we hit the server with hostname, this generates an invalid policy |
814 // error. | 816 // error. |
815 ui_test_utils::NavigateToURL(browser(), | 817 ui_test_utils::NavigateToURL(browser(), |
816 https_server_mismatched_.GetURL("files/ssl/google.html")); | 818 https_server_mismatched_.GetURL("files/ssl/google.html")); |
817 | 819 |
818 // We get an interstitial page as a result. | 820 // We get an interstitial page as a result. |
819 TabContents* tab = browser()->GetSelectedTabContents(); | 821 WebContents* tab = browser()->GetSelectedWebContents(); |
820 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 822 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
821 false, true); // Interstitial showing. | 823 false, true); // Interstitial showing. |
822 ProceedThroughInterstitial(tab); | 824 ProceedThroughInterstitial(tab); |
823 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 825 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
824 false, false); // No interstitial showing. | 826 false, false); // No interstitial showing. |
825 | 827 |
826 // Now we try again with the right host name this time. | 828 // Now we try again with the right host name this time. |
827 GURL url(https_server_.GetURL("files/ssl/google.html")); | 829 GURL url(https_server_.GetURL("files/ssl/google.html")); |
828 ui_test_utils::NavigateToURL(browser(), url); | 830 ui_test_utils::NavigateToURL(browser(), url); |
829 | 831 |
(...skipping 17 matching lines...) Expand all Loading... |
847 #define MAYBE_TestRefNavigation TestRefNavigation | 849 #define MAYBE_TestRefNavigation TestRefNavigation |
848 #endif | 850 #endif |
849 | 851 |
850 // Test that navigating to a #ref does not change a bad security state. | 852 // Test that navigating to a #ref does not change a bad security state. |
851 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { | 853 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { |
852 ASSERT_TRUE(https_server_expired_.Start()); | 854 ASSERT_TRUE(https_server_expired_.Start()); |
853 | 855 |
854 ui_test_utils::NavigateToURL(browser(), | 856 ui_test_utils::NavigateToURL(browser(), |
855 https_server_expired_.GetURL("files/ssl/page_with_refs.html")); | 857 https_server_expired_.GetURL("files/ssl/page_with_refs.html")); |
856 | 858 |
857 TabContents* tab = browser()->GetSelectedTabContents(); | 859 WebContents* tab = browser()->GetSelectedWebContents(); |
858 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 860 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
859 true); // Interstitial showing. | 861 true); // Interstitial showing. |
860 | 862 |
861 ProceedThroughInterstitial(tab); | 863 ProceedThroughInterstitial(tab); |
862 | 864 |
863 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 865 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
864 false); // No interstitial showing. | 866 false); // No interstitial showing. |
865 | 867 |
866 // Now navigate to a ref in the page, the security state should not have | 868 // Now navigate to a ref in the page, the security state should not have |
867 // changed. | 869 // changed. |
(...skipping 14 matching lines...) Expand all Loading... |
882 | 884 |
883 std::string replacement_path; | 885 std::string replacement_path; |
884 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 886 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
885 "files/ssl/page_with_unsafe_popup.html", | 887 "files/ssl/page_with_unsafe_popup.html", |
886 https_server_expired_.host_port_pair(), | 888 https_server_expired_.host_port_pair(), |
887 &replacement_path)); | 889 &replacement_path)); |
888 | 890 |
889 ui_test_utils::NavigateToURL(browser(), | 891 ui_test_utils::NavigateToURL(browser(), |
890 test_server()->GetURL(replacement_path)); | 892 test_server()->GetURL(replacement_path)); |
891 | 893 |
892 TabContents* tab1 = browser()->GetSelectedTabContents(); | 894 WebContents* tab1 = browser()->GetSelectedWebContents(); |
893 // It is probably overkill to add a notification for a popup-opening, let's | 895 // It is probably overkill to add a notification for a popup-opening, let's |
894 // just poll. | 896 // just poll. |
895 for (int i = 0; i < 10; i++) { | 897 for (int i = 0; i < 10; i++) { |
896 if (GetConstrainedWindowCount() > 0) | 898 if (GetConstrainedWindowCount() > 0) |
897 break; | 899 break; |
898 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 900 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
899 MessageLoop::QuitClosure(), 1000); | 901 MessageLoop::QuitClosure(), 1000); |
900 ui_test_utils::RunMessageLoop(); | 902 ui_test_utils::RunMessageLoop(); |
901 } | 903 } |
902 ASSERT_EQ(1, GetConstrainedWindowCount()); | 904 ASSERT_EQ(1, GetConstrainedWindowCount()); |
(...skipping 14 matching lines...) Expand all Loading... |
917 // Visit a page over bad https that is a redirect to a page with good https. | 919 // Visit a page over bad https that is a redirect to a page with good https. |
918 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) { | 920 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) { |
919 ASSERT_TRUE(https_server_.Start()); | 921 ASSERT_TRUE(https_server_.Start()); |
920 ASSERT_TRUE(https_server_expired_.Start()); | 922 ASSERT_TRUE(https_server_expired_.Start()); |
921 | 923 |
922 GURL url1 = https_server_expired_.GetURL("server-redirect?"); | 924 GURL url1 = https_server_expired_.GetURL("server-redirect?"); |
923 GURL url2 = https_server_.GetURL("files/ssl/google.html"); | 925 GURL url2 = https_server_.GetURL("files/ssl/google.html"); |
924 | 926 |
925 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); | 927 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); |
926 | 928 |
927 TabContents* tab = browser()->GetSelectedTabContents(); | 929 WebContents* tab = browser()->GetSelectedWebContents(); |
928 | 930 |
929 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 931 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
930 true); // Interstitial showing. | 932 true); // Interstitial showing. |
931 | 933 |
932 ProceedThroughInterstitial(tab); | 934 ProceedThroughInterstitial(tab); |
933 | 935 |
934 // We have been redirected to the good page. | 936 // We have been redirected to the good page. |
935 CheckAuthenticatedState(tab, false); | 937 CheckAuthenticatedState(tab, false); |
936 } | 938 } |
937 | 939 |
938 // Visit a page over good https that is a redirect to a page with bad https. | 940 // Visit a page over good https that is a redirect to a page with bad https. |
939 // Marked as flaky, see bug 40932. | 941 // Marked as flaky, see bug 40932. |
940 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectGoodToBadHTTPS) { | 942 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectGoodToBadHTTPS) { |
941 ASSERT_TRUE(https_server_.Start()); | 943 ASSERT_TRUE(https_server_.Start()); |
942 ASSERT_TRUE(https_server_expired_.Start()); | 944 ASSERT_TRUE(https_server_expired_.Start()); |
943 | 945 |
944 GURL url1 = https_server_.GetURL("server-redirect?"); | 946 GURL url1 = https_server_.GetURL("server-redirect?"); |
945 GURL url2 = https_server_expired_.GetURL("files/ssl/google.html"); | 947 GURL url2 = https_server_expired_.GetURL("files/ssl/google.html"); |
946 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); | 948 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); |
947 | 949 |
948 TabContents* tab = browser()->GetSelectedTabContents(); | 950 WebContents* tab = browser()->GetSelectedWebContents(); |
949 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 951 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
950 true); // Interstitial showing. | 952 true); // Interstitial showing. |
951 | 953 |
952 ProceedThroughInterstitial(tab); | 954 ProceedThroughInterstitial(tab); |
953 | 955 |
954 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 956 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
955 false); // No interstitial showing. | 957 false); // No interstitial showing. |
956 } | 958 } |
957 | 959 |
958 // Visit a page over http that is a redirect to a page with good HTTPS. | 960 // Visit a page over http that is a redirect to a page with good HTTPS. |
959 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) { | 961 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) { |
960 ASSERT_TRUE(test_server()->Start()); | 962 ASSERT_TRUE(test_server()->Start()); |
961 ASSERT_TRUE(https_server_.Start()); | 963 ASSERT_TRUE(https_server_.Start()); |
962 | 964 |
963 TabContents* tab = browser()->GetSelectedTabContents(); | 965 WebContents* tab = browser()->GetSelectedWebContents(); |
964 | 966 |
965 // HTTP redirects to good HTTPS. | 967 // HTTP redirects to good HTTPS. |
966 GURL http_url = test_server()->GetURL("server-redirect?"); | 968 GURL http_url = test_server()->GetURL("server-redirect?"); |
967 GURL good_https_url = | 969 GURL good_https_url = |
968 https_server_.GetURL("files/ssl/google.html"); | 970 https_server_.GetURL("files/ssl/google.html"); |
969 | 971 |
970 ui_test_utils::NavigateToURL(browser(), | 972 ui_test_utils::NavigateToURL(browser(), |
971 GURL(http_url.spec() + good_https_url.spec())); | 973 GURL(http_url.spec() + good_https_url.spec())); |
972 CheckAuthenticatedState(tab, false); | 974 CheckAuthenticatedState(tab, false); |
973 } | 975 } |
974 | 976 |
975 // Visit a page over http that is a redirect to a page with bad HTTPS. | 977 // Visit a page over http that is a redirect to a page with bad HTTPS. |
976 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPToBadHTTPS) { | 978 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPToBadHTTPS) { |
977 ASSERT_TRUE(test_server()->Start()); | 979 ASSERT_TRUE(test_server()->Start()); |
978 ASSERT_TRUE(https_server_expired_.Start()); | 980 ASSERT_TRUE(https_server_expired_.Start()); |
979 | 981 |
980 TabContents* tab = browser()->GetSelectedTabContents(); | 982 WebContents* tab = browser()->GetSelectedWebContents(); |
981 | 983 |
982 GURL http_url = test_server()->GetURL("server-redirect?"); | 984 GURL http_url = test_server()->GetURL("server-redirect?"); |
983 GURL bad_https_url = | 985 GURL bad_https_url = |
984 https_server_expired_.GetURL("files/ssl/google.html"); | 986 https_server_expired_.GetURL("files/ssl/google.html"); |
985 ui_test_utils::NavigateToURL(browser(), | 987 ui_test_utils::NavigateToURL(browser(), |
986 GURL(http_url.spec() + bad_https_url.spec())); | 988 GURL(http_url.spec() + bad_https_url.spec())); |
987 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 989 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
988 true); // Interstitial showing. | 990 true); // Interstitial showing. |
989 | 991 |
990 ProceedThroughInterstitial(tab); | 992 ProceedThroughInterstitial(tab); |
991 | 993 |
992 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 994 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
993 false); // No interstitial showing. | 995 false); // No interstitial showing. |
994 } | 996 } |
995 | 997 |
996 // Visit a page over https that is a redirect to a page with http (to make sure | 998 // Visit a page over https that is a redirect to a page with http (to make sure |
997 // we don't keep the secure state). | 999 // we don't keep the secure state). |
998 // Marked as flaky, see bug 40932. | 1000 // Marked as flaky, see bug 40932. |
999 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPSToHTTP) { | 1001 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPSToHTTP) { |
1000 ASSERT_TRUE(test_server()->Start()); | 1002 ASSERT_TRUE(test_server()->Start()); |
1001 ASSERT_TRUE(https_server_.Start()); | 1003 ASSERT_TRUE(https_server_.Start()); |
1002 | 1004 |
1003 GURL https_url = https_server_.GetURL("server-redirect?"); | 1005 GURL https_url = https_server_.GetURL("server-redirect?"); |
1004 GURL http_url = test_server()->GetURL("files/ssl/google.html"); | 1006 GURL http_url = test_server()->GetURL("files/ssl/google.html"); |
1005 | 1007 |
1006 ui_test_utils::NavigateToURL(browser(), | 1008 ui_test_utils::NavigateToURL(browser(), |
1007 GURL(https_url.spec() + http_url.spec())); | 1009 GURL(https_url.spec() + http_url.spec())); |
1008 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); | 1010 CheckUnauthenticatedState(browser()->GetSelectedWebContents()); |
1009 } | 1011 } |
1010 | 1012 |
1011 // Visits a page to which we could not connect (bad port) over http and https | 1013 // Visits a page to which we could not connect (bad port) over http and https |
1012 // and make sure the security style is correct. | 1014 // and make sure the security style is correct. |
1013 IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) { | 1015 IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) { |
1014 ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17")); | 1016 ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17")); |
1015 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); | 1017 CheckUnauthenticatedState(browser()->GetSelectedWebContents()); |
1016 | 1018 |
1017 // Same thing over HTTPS. | 1019 // Same thing over HTTPS. |
1018 ui_test_utils::NavigateToURL(browser(), GURL("https://localhost:17")); | 1020 ui_test_utils::NavigateToURL(browser(), GURL("https://localhost:17")); |
1019 CheckUnauthenticatedState(browser()->GetSelectedTabContents()); | 1021 CheckUnauthenticatedState(browser()->GetSelectedWebContents()); |
1020 } | 1022 } |
1021 | 1023 |
1022 // | 1024 // |
1023 // Frame navigation | 1025 // Frame navigation |
1024 // | 1026 // |
1025 | 1027 |
1026 // From a good HTTPS top frame: | 1028 // From a good HTTPS top frame: |
1027 // - navigate to an OK HTTPS frame | 1029 // - navigate to an OK HTTPS frame |
1028 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then | 1030 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then |
1029 // back | 1031 // back |
1030 // - navigate to HTTP (expect insecure content), then back | 1032 // - navigate to HTTP (expect insecure content), then back |
1031 IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { | 1033 IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { |
1032 ASSERT_TRUE(test_server()->Start()); | 1034 ASSERT_TRUE(test_server()->Start()); |
1033 ASSERT_TRUE(https_server_.Start()); | 1035 ASSERT_TRUE(https_server_.Start()); |
1034 ASSERT_TRUE(https_server_expired_.Start()); | 1036 ASSERT_TRUE(https_server_expired_.Start()); |
1035 | 1037 |
1036 std::string top_frame_path; | 1038 std::string top_frame_path; |
1037 ASSERT_TRUE(GetTopFramePath(*test_server(), | 1039 ASSERT_TRUE(GetTopFramePath(*test_server(), |
1038 https_server_, | 1040 https_server_, |
1039 https_server_expired_, | 1041 https_server_expired_, |
1040 &top_frame_path)); | 1042 &top_frame_path)); |
1041 | 1043 |
1042 TabContents* tab = browser()->GetSelectedTabContents(); | 1044 WebContents* tab = browser()->GetSelectedWebContents(); |
1043 ui_test_utils::NavigateToURL(browser(), | 1045 ui_test_utils::NavigateToURL(browser(), |
1044 https_server_.GetURL(top_frame_path)); | 1046 https_server_.GetURL(top_frame_path)); |
1045 | 1047 |
1046 CheckAuthenticatedState(tab, false); | 1048 CheckAuthenticatedState(tab, false); |
1047 | 1049 |
1048 bool success = false; | 1050 bool success = false; |
1049 // Now navigate inside the frame. | 1051 // Now navigate inside the frame. |
1050 { | 1052 { |
1051 ui_test_utils::WindowedNotificationObserver observer( | 1053 ui_test_utils::WindowedNotificationObserver observer( |
1052 content::NOTIFICATION_LOAD_STOP, | 1054 content::NOTIFICATION_LOAD_STOP, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestBadFrameNavigation) { | 1133 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestBadFrameNavigation) { |
1132 ASSERT_TRUE(https_server_.Start()); | 1134 ASSERT_TRUE(https_server_.Start()); |
1133 ASSERT_TRUE(https_server_expired_.Start()); | 1135 ASSERT_TRUE(https_server_expired_.Start()); |
1134 | 1136 |
1135 std::string top_frame_path; | 1137 std::string top_frame_path; |
1136 ASSERT_TRUE(GetTopFramePath(*test_server(), | 1138 ASSERT_TRUE(GetTopFramePath(*test_server(), |
1137 https_server_, | 1139 https_server_, |
1138 https_server_expired_, | 1140 https_server_expired_, |
1139 &top_frame_path)); | 1141 &top_frame_path)); |
1140 | 1142 |
1141 TabContents* tab = browser()->GetSelectedTabContents(); | 1143 WebContents* tab = browser()->GetSelectedWebContents(); |
1142 ui_test_utils::NavigateToURL(browser(), | 1144 ui_test_utils::NavigateToURL(browser(), |
1143 https_server_expired_.GetURL(top_frame_path)); | 1145 https_server_expired_.GetURL(top_frame_path)); |
1144 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1146 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1145 true); // Interstitial showing | 1147 true); // Interstitial showing |
1146 | 1148 |
1147 ProceedThroughInterstitial(tab); | 1149 ProceedThroughInterstitial(tab); |
1148 | 1150 |
1149 // Navigate to a good frame. | 1151 // Navigate to a good frame. |
1150 bool success = false; | 1152 bool success = false; |
1151 ui_test_utils::WindowedNotificationObserver observer( | 1153 ui_test_utils::WindowedNotificationObserver observer( |
(...skipping 18 matching lines...) Expand all Loading... |
1170 ASSERT_TRUE(test_server()->Start()); | 1172 ASSERT_TRUE(test_server()->Start()); |
1171 ASSERT_TRUE(https_server_.Start()); | 1173 ASSERT_TRUE(https_server_.Start()); |
1172 ASSERT_TRUE(https_server_expired_.Start()); | 1174 ASSERT_TRUE(https_server_expired_.Start()); |
1173 | 1175 |
1174 std::string top_frame_path; | 1176 std::string top_frame_path; |
1175 ASSERT_TRUE(GetTopFramePath(*test_server(), | 1177 ASSERT_TRUE(GetTopFramePath(*test_server(), |
1176 https_server_, | 1178 https_server_, |
1177 https_server_expired_, | 1179 https_server_expired_, |
1178 &top_frame_path)); | 1180 &top_frame_path)); |
1179 | 1181 |
1180 TabContents* tab = browser()->GetSelectedTabContents(); | 1182 WebContents* tab = browser()->GetSelectedWebContents(); |
1181 ui_test_utils::NavigateToURL(browser(), | 1183 ui_test_utils::NavigateToURL(browser(), |
1182 test_server()->GetURL(top_frame_path)); | 1184 test_server()->GetURL(top_frame_path)); |
1183 CheckUnauthenticatedState(tab); | 1185 CheckUnauthenticatedState(tab); |
1184 | 1186 |
1185 // Now navigate inside the frame to a secure HTTPS frame. | 1187 // Now navigate inside the frame to a secure HTTPS frame. |
1186 { | 1188 { |
1187 bool success = false; | 1189 bool success = false; |
1188 ui_test_utils::WindowedNotificationObserver observer( | 1190 ui_test_utils::WindowedNotificationObserver observer( |
1189 content::NOTIFICATION_LOAD_STOP, | 1191 content::NOTIFICATION_LOAD_STOP, |
1190 content::Source<NavigationController>(&tab->GetController())); | 1192 content::Source<NavigationController>(&tab->GetController())); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 ASSERT_TRUE(https_server_.Start()); | 1234 ASSERT_TRUE(https_server_.Start()); |
1233 ASSERT_TRUE(https_server_expired_.Start()); | 1235 ASSERT_TRUE(https_server_expired_.Start()); |
1234 | 1236 |
1235 // This page will spawn a Worker which will try to load content from | 1237 // This page will spawn a Worker which will try to load content from |
1236 // BadCertServer. | 1238 // BadCertServer. |
1237 std::string page_with_unsafe_worker_path; | 1239 std::string page_with_unsafe_worker_path; |
1238 ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_expired_, | 1240 ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_expired_, |
1239 &page_with_unsafe_worker_path)); | 1241 &page_with_unsafe_worker_path)); |
1240 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 1242 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( |
1241 page_with_unsafe_worker_path)); | 1243 page_with_unsafe_worker_path)); |
1242 TabContents* tab = browser()->GetSelectedTabContents(); | 1244 WebContents* tab = browser()->GetSelectedWebContents(); |
1243 // Expect Worker not to load insecure content. | 1245 // Expect Worker not to load insecure content. |
1244 CheckWorkerLoadResult(tab, false); | 1246 CheckWorkerLoadResult(tab, false); |
1245 // The bad content is filtered, expect the state to be authenticated. | 1247 // The bad content is filtered, expect the state to be authenticated. |
1246 CheckAuthenticatedState(tab, false); | 1248 CheckAuthenticatedState(tab, false); |
1247 } | 1249 } |
1248 | 1250 |
1249 // Marked as flaky, see bug 40932. | 1251 // Marked as flaky, see bug 40932. |
1250 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorker) { | 1252 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorker) { |
1251 ASSERT_TRUE(https_server_.Start()); | 1253 ASSERT_TRUE(https_server_.Start()); |
1252 ASSERT_TRUE(https_server_expired_.Start()); | 1254 ASSERT_TRUE(https_server_expired_.Start()); |
1253 | 1255 |
1254 // Navigate to an unsafe site. Proceed with interstitial page to indicate | 1256 // Navigate to an unsafe site. Proceed with interstitial page to indicate |
1255 // the user approves the bad certificate. | 1257 // the user approves the bad certificate. |
1256 ui_test_utils::NavigateToURL(browser(), | 1258 ui_test_utils::NavigateToURL(browser(), |
1257 https_server_expired_.GetURL("files/ssl/blank_page.html")); | 1259 https_server_expired_.GetURL("files/ssl/blank_page.html")); |
1258 TabContents* tab = browser()->GetSelectedTabContents(); | 1260 WebContents* tab = browser()->GetSelectedWebContents(); |
1259 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1261 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1260 true); // Interstitial showing | 1262 true); // Interstitial showing |
1261 ProceedThroughInterstitial(tab); | 1263 ProceedThroughInterstitial(tab); |
1262 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1264 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
1263 false); // No Interstitial | 1265 false); // No Interstitial |
1264 | 1266 |
1265 // Navigate to safe page that has Worker loading unsafe content. | 1267 // Navigate to safe page that has Worker loading unsafe content. |
1266 // Expect content to load but be marked as auth broken due to running insecure | 1268 // Expect content to load but be marked as auth broken due to running insecure |
1267 // content. | 1269 // content. |
1268 std::string page_with_unsafe_worker_path; | 1270 std::string page_with_unsafe_worker_path; |
(...skipping 14 matching lines...) Expand all Loading... |
1283 | 1285 |
1284 std::string replacement_path; | 1286 std::string replacement_path; |
1285 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1287 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
1286 "files/ssl/page_displays_insecure_content.html", | 1288 "files/ssl/page_displays_insecure_content.html", |
1287 test_server()->host_port_pair(), | 1289 test_server()->host_port_pair(), |
1288 &replacement_path)); | 1290 &replacement_path)); |
1289 | 1291 |
1290 ui_test_utils::NavigateToURL(browser(), | 1292 ui_test_utils::NavigateToURL(browser(), |
1291 https_server_.GetURL(replacement_path)); | 1293 https_server_.GetURL(replacement_path)); |
1292 | 1294 |
1293 CheckAuthenticatedState(browser()->GetSelectedTabContents(), false); | 1295 CheckAuthenticatedState(browser()->GetSelectedWebContents(), false); |
1294 } | 1296 } |
1295 | 1297 |
1296 // Test that when the browser blocks displaying insecure content (iframes), the | 1298 // Test that when the browser blocks displaying insecure content (iframes), the |
1297 // indicator shows a secure page, because the blocking made the otherwise | 1299 // indicator shows a secure page, because the blocking made the otherwise |
1298 // unsafe page safe (the notification of this state is handled by other means) | 1300 // unsafe page safe (the notification of this state is handled by other means) |
1299 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureIframe) { | 1301 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureIframe) { |
1300 ASSERT_TRUE(test_server()->Start()); | 1302 ASSERT_TRUE(test_server()->Start()); |
1301 ASSERT_TRUE(https_server_.Start()); | 1303 ASSERT_TRUE(https_server_.Start()); |
1302 | 1304 |
1303 std::string replacement_path; | 1305 std::string replacement_path; |
1304 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1306 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
1305 "files/ssl/page_displays_insecure_iframe.html", | 1307 "files/ssl/page_displays_insecure_iframe.html", |
1306 test_server()->host_port_pair(), | 1308 test_server()->host_port_pair(), |
1307 &replacement_path)); | 1309 &replacement_path)); |
1308 | 1310 |
1309 ui_test_utils::NavigateToURL(browser(), | 1311 ui_test_utils::NavigateToURL(browser(), |
1310 https_server_.GetURL(replacement_path)); | 1312 https_server_.GetURL(replacement_path)); |
1311 | 1313 |
1312 CheckAuthenticatedState(browser()->GetSelectedTabContents(), false); | 1314 CheckAuthenticatedState(browser()->GetSelectedWebContents(), false); |
1313 } | 1315 } |
1314 | 1316 |
1315 | 1317 |
1316 // Test that when the browser blocks running insecure content, the | 1318 // Test that when the browser blocks running insecure content, the |
1317 // indicator shows a secure page, because the blocking made the otherwise | 1319 // indicator shows a secure page, because the blocking made the otherwise |
1318 // unsafe page safe (the notification of this state is handled by other means). | 1320 // unsafe page safe (the notification of this state is handled by other means). |
1319 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockRunningInsecureContent) { | 1321 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockRunningInsecureContent) { |
1320 ASSERT_TRUE(test_server()->Start()); | 1322 ASSERT_TRUE(test_server()->Start()); |
1321 ASSERT_TRUE(https_server_.Start()); | 1323 ASSERT_TRUE(https_server_.Start()); |
1322 | 1324 |
1323 std::string replacement_path; | 1325 std::string replacement_path; |
1324 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1326 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
1325 "files/ssl/page_runs_insecure_content.html", | 1327 "files/ssl/page_runs_insecure_content.html", |
1326 test_server()->host_port_pair(), | 1328 test_server()->host_port_pair(), |
1327 &replacement_path)); | 1329 &replacement_path)); |
1328 | 1330 |
1329 ui_test_utils::NavigateToURL(browser(), | 1331 ui_test_utils::NavigateToURL(browser(), |
1330 https_server_.GetURL(replacement_path)); | 1332 https_server_.GetURL(replacement_path)); |
1331 | 1333 |
1332 CheckAuthenticatedState(browser()->GetSelectedTabContents(), false); | 1334 CheckAuthenticatedState(browser()->GetSelectedWebContents(), false); |
1333 } | 1335 } |
1334 | 1336 |
1335 | 1337 |
1336 // TODO(jcampan): more tests to do below. | 1338 // TODO(jcampan): more tests to do below. |
1337 | 1339 |
1338 // Visit a page over https that contains a frame with a redirect. | 1340 // Visit a page over https that contains a frame with a redirect. |
1339 | 1341 |
1340 // XMLHttpRequest insecure content in synchronous mode. | 1342 // XMLHttpRequest insecure content in synchronous mode. |
1341 | 1343 |
1342 // XMLHttpRequest insecure content in asynchronous mode. | 1344 // XMLHttpRequest insecure content in asynchronous mode. |
1343 | 1345 |
1344 // XMLHttpRequest over bad ssl in synchronous mode. | 1346 // XMLHttpRequest over bad ssl in synchronous mode. |
1345 | 1347 |
1346 // XMLHttpRequest over OK ssl in synchronous mode. | 1348 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |