Chromium Code Reviews| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 void CheckAuthenticatedState(WebContents* tab, | 139 void CheckAuthenticatedState(WebContents* tab, |
| 140 bool expected_displayed_insecure_content) { | 140 bool expected_displayed_insecure_content) { |
| 141 CheckState(tab, content::SECURITY_STYLE_AUTHENTICATED, | 141 CheckState(tab, content::SECURITY_STYLE_AUTHENTICATED, |
| 142 expected_displayed_insecure_content, false); | 142 expected_displayed_insecure_content, false); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void CheckUnauthenticatedState(WebContents* tab) { | 145 void CheckUnauthenticatedState(WebContents* tab) { |
| 146 CheckState(tab, content::SECURITY_STYLE_UNAUTHENTICATED, false, false); | 146 CheckState(tab, content::SECURITY_STYLE_UNAUTHENTICATED, false, false); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void CheckBrokenAuthenticatedState(WebContents* tab) { | 149 void CheckBrokenAuthenticatedState(WebContents* tab, |
| 150 CheckState(tab, content::SECURITY_STYLE_AUTHENTICATION_BROKEN, false, true); | 150 bool expected_displayed_insecure_content) { |
| 151 CheckState(tab, content::SECURITY_STYLE_AUTHENTICATION_BROKEN, | |
| 152 expected_displayed_insecure_content, true); | |
| 151 } | 153 } |
| 152 | 154 |
| 153 void CheckAuthenticationBrokenState(WebContents* tab, | 155 void CheckAuthenticationBrokenState(WebContents* tab, |
| 154 net::CertStatus error, | 156 net::CertStatus error, |
| 157 bool displayed_insecure_content, | |
| 155 bool ran_insecure_content, | 158 bool ran_insecure_content, |
| 156 bool interstitial) { | 159 bool interstitial) { |
|
Ryan Sleevi
2014/03/11 01:46:55
I'm wondering whether we should change these three
| |
| 157 ASSERT_FALSE(tab->IsCrashed()); | 160 ASSERT_FALSE(tab->IsCrashed()); |
| 158 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 161 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
| 159 ASSERT_TRUE(entry); | 162 ASSERT_TRUE(entry); |
| 160 EXPECT_EQ(interstitial ? | 163 EXPECT_EQ(interstitial ? |
| 161 content::PAGE_TYPE_INTERSTITIAL : content::PAGE_TYPE_NORMAL, | 164 content::PAGE_TYPE_INTERSTITIAL : content::PAGE_TYPE_NORMAL, |
| 162 entry->GetPageType()); | 165 entry->GetPageType()); |
| 163 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, | 166 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, |
| 164 entry->GetSSL().security_style); | 167 entry->GetSSL().security_style); |
| 165 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style | 168 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style |
| 166 // to SECURITY_STYLE_AUTHENTICATION_BROKEN. | 169 // to SECURITY_STYLE_AUTHENTICATION_BROKEN. |
| 167 ASSERT_NE(net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION, error); | 170 ASSERT_NE(net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION, error); |
| 168 EXPECT_EQ(error, entry->GetSSL().cert_status & error); | 171 EXPECT_EQ(error, entry->GetSSL().cert_status & error); |
| 169 EXPECT_FALSE(!!(entry->GetSSL().content_status & | 172 EXPECT_EQ(displayed_insecure_content, |
| 170 SSLStatus::DISPLAYED_INSECURE_CONTENT)); | 173 !!(entry->GetSSL().content_status & |
| 174 SSLStatus::DISPLAYED_INSECURE_CONTENT)); | |
| 171 EXPECT_EQ(ran_insecure_content, | 175 EXPECT_EQ(ran_insecure_content, |
| 172 !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); | 176 !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); |
| 173 net::CertStatus extra_cert_errors = error ^ (entry->GetSSL().cert_status & | 177 net::CertStatus extra_cert_errors = error ^ (entry->GetSSL().cert_status & |
| 174 net::CERT_STATUS_ALL_ERRORS); | 178 net::CERT_STATUS_ALL_ERRORS); |
| 175 if (extra_cert_errors) | 179 if (extra_cert_errors) |
| 176 LOG(WARNING) << "Got unexpected cert error: " << extra_cert_errors; | 180 LOG(WARNING) << "Got unexpected cert error: " << extra_cert_errors; |
| 177 } | 181 } |
| 178 | 182 |
| 179 void CheckWorkerLoadResult(WebContents* tab, bool expected_load) { | 183 void CheckWorkerLoadResult(WebContents* tab, bool expected_load) { |
| 180 // Workers are async and we don't have notifications for them passing | 184 // Workers are async and we don't have notifications for them passing |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 https_server_expired_.host_port_pair(), | 362 https_server_expired_.host_port_pair(), |
| 359 &replacement_path)); | 363 &replacement_path)); |
| 360 | 364 |
| 361 ui_test_utils::NavigateToURL( | 365 ui_test_utils::NavigateToURL( |
| 362 browser(), test_server()->GetURL(replacement_path)); | 366 browser(), test_server()->GetURL(replacement_path)); |
| 363 | 367 |
| 364 CheckUnauthenticatedState( | 368 CheckUnauthenticatedState( |
| 365 browser()->tab_strip_model()->GetActiveWebContents()); | 369 browser()->tab_strip_model()->GetActiveWebContents()); |
| 366 } | 370 } |
| 367 | 371 |
| 372 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBrokenHTTPSWithInsecureContent) { | |
| 373 ASSERT_TRUE(test_server()->Start()); | |
| 374 ASSERT_TRUE(https_server_expired_.Start()); | |
| 375 | |
| 376 std::string replacement_path; | |
| 377 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | |
| 378 "files/ssl/page_displays_insecure_content.html", | |
| 379 test_server()->host_port_pair(), | |
| 380 &replacement_path)); | |
| 381 | |
| 382 ui_test_utils::NavigateToURL(browser(), | |
| 383 https_server_expired_.GetURL(replacement_path)); | |
| 384 | |
| 385 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | |
| 386 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, | |
| 387 false, false, true); | |
| 388 | |
| 389 ProceedThroughInterstitial(tab); | |
| 390 | |
| 391 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, | |
| 392 true, false, false); | |
| 393 } | |
| 394 | |
| 368 // http://crbug.com/91745 | 395 // http://crbug.com/91745 |
| 369 #if defined(OS_CHROMEOS) | 396 #if defined(OS_CHROMEOS) |
| 370 #define MAYBE_TestOKHTTPS DISABLED_TestOKHTTPS | 397 #define MAYBE_TestOKHTTPS DISABLED_TestOKHTTPS |
| 371 #else | 398 #else |
| 372 #define MAYBE_TestOKHTTPS TestOKHTTPS | 399 #define MAYBE_TestOKHTTPS TestOKHTTPS |
| 373 #endif | 400 #endif |
| 374 | 401 |
| 375 // Visits a page over OK https: | 402 // Visits a page over OK https: |
| 376 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestOKHTTPS) { | 403 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestOKHTTPS) { |
| 377 ASSERT_TRUE(https_server_.Start()); | 404 ASSERT_TRUE(https_server_.Start()); |
| 378 | 405 |
| 379 ui_test_utils::NavigateToURL(browser(), | 406 ui_test_utils::NavigateToURL(browser(), |
| 380 https_server_.GetURL("files/ssl/google.html")); | 407 https_server_.GetURL("files/ssl/google.html")); |
| 381 | 408 |
| 382 CheckAuthenticatedState( | 409 CheckAuthenticatedState( |
| 383 browser()->tab_strip_model()->GetActiveWebContents(), false); | 410 browser()->tab_strip_model()->GetActiveWebContents(), false); |
| 384 } | 411 } |
| 385 | 412 |
| 386 // Visits a page with https error and proceed: | 413 // Visits a page with https error and proceed: |
| 387 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { | 414 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { |
| 388 ASSERT_TRUE(https_server_expired_.Start()); | 415 ASSERT_TRUE(https_server_expired_.Start()); |
| 389 | 416 |
| 390 ui_test_utils::NavigateToURL(browser(), | 417 ui_test_utils::NavigateToURL(browser(), |
| 391 https_server_expired_.GetURL("files/ssl/google.html")); | 418 https_server_expired_.GetURL("files/ssl/google.html")); |
| 392 | 419 |
| 393 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 420 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 394 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 421 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 395 true); // Interstitial showing | 422 false, true); // Interstitial showing |
| 396 | 423 |
| 397 ProceedThroughInterstitial(tab); | 424 ProceedThroughInterstitial(tab); |
| 398 | 425 |
| 399 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 426 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 400 false); // No interstitial showing | 427 false, false); // No interstitial showing |
| 401 } | 428 } |
| 402 | 429 |
| 403 #ifndef NEDBUG | 430 #ifndef NEDBUG |
| 404 // Flaky on Windows debug (http://crbug.com/280537). | 431 // Flaky on Windows debug (http://crbug.com/280537). |
| 405 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ | 432 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ |
| 406 DISABLED_TestHTTPSExpiredCertAndDontProceed | 433 DISABLED_TestHTTPSExpiredCertAndDontProceed |
| 407 #else | 434 #else |
| 408 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ | 435 #define MAYBE_TestHTTPSExpiredCertAndDontProceed \ |
| 409 TestHTTPSExpiredCertAndDontProceed | 436 TestHTTPSExpiredCertAndDontProceed |
| 410 #endif | 437 #endif |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 432 GURL::Replacements replacements; | 459 GURL::Replacements replacements; |
| 433 std::string new_host("localhost"); | 460 std::string new_host("localhost"); |
| 434 replacements.SetHostStr(new_host); | 461 replacements.SetHostStr(new_host); |
| 435 cross_site_url = cross_site_url.ReplaceComponents(replacements); | 462 cross_site_url = cross_site_url.ReplaceComponents(replacements); |
| 436 | 463 |
| 437 // Now go to a bad HTTPS page. | 464 // Now go to a bad HTTPS page. |
| 438 ui_test_utils::NavigateToURL(browser(), cross_site_url); | 465 ui_test_utils::NavigateToURL(browser(), cross_site_url); |
| 439 | 466 |
| 440 // An interstitial should be showing. | 467 // An interstitial should be showing. |
| 441 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 468 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
| 442 false, true); | 469 false, false, true); |
| 443 | 470 |
| 444 // Simulate user clicking "Take me back". | 471 // Simulate user clicking "Take me back". |
| 445 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); | 472 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); |
| 446 ASSERT_TRUE(interstitial_page); | 473 ASSERT_TRUE(interstitial_page); |
| 447 interstitial_page->DontProceed(); | 474 interstitial_page->DontProceed(); |
| 448 | 475 |
| 449 // We should be back to the original good page. | 476 // We should be back to the original good page. |
| 450 CheckAuthenticatedState(tab, false); | 477 CheckAuthenticatedState(tab, false); |
| 451 | 478 |
| 452 // Try to navigate to a new page. (to make sure bug 5800 is fixed). | 479 // Try to navigate to a new page. (to make sure bug 5800 is fixed). |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 465 ui_test_utils::NavigateToURL(browser(), | 492 ui_test_utils::NavigateToURL(browser(), |
| 466 test_server()->GetURL("files/ssl/google.html")); | 493 test_server()->GetURL("files/ssl/google.html")); |
| 467 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 494 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 468 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 495 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
| 469 ASSERT_TRUE(entry); | 496 ASSERT_TRUE(entry); |
| 470 | 497 |
| 471 // Now go to a bad HTTPS page that shows an interstitial. | 498 // Now go to a bad HTTPS page that shows an interstitial. |
| 472 ui_test_utils::NavigateToURL(browser(), | 499 ui_test_utils::NavigateToURL(browser(), |
| 473 https_server_expired_.GetURL("files/ssl/google.html")); | 500 https_server_expired_.GetURL("files/ssl/google.html")); |
| 474 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 501 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 475 true); // Interstitial showing | 502 false, true); // Interstitial showing |
| 476 | 503 |
| 477 ProvisionalLoadWaiter load_failed_observer(tab); | 504 ProvisionalLoadWaiter load_failed_observer(tab); |
| 478 | 505 |
| 479 // Simulate user clicking on back button (crbug.com/39248). | 506 // Simulate user clicking on back button (crbug.com/39248). |
| 480 chrome::GoBack(browser(), CURRENT_TAB); | 507 chrome::GoBack(browser(), CURRENT_TAB); |
| 481 | 508 |
| 482 // Wait until we hear the load failure, and make sure we haven't swapped out | 509 // Wait until we hear the load failure, and make sure we haven't swapped out |
| 483 // the previous page. Prevents regression of http://crbug.com/82667. | 510 // the previous page. Prevents regression of http://crbug.com/82667. |
| 484 load_failed_observer.Wait(); | 511 load_failed_observer.Wait(); |
| 485 EXPECT_FALSE(content::RenderViewHostTester::IsRenderViewHostSwappedOut( | 512 EXPECT_FALSE(content::RenderViewHostTester::IsRenderViewHostSwappedOut( |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 502 ui_test_utils::NavigateToURL(browser(), | 529 ui_test_utils::NavigateToURL(browser(), |
| 503 test_server()->GetURL("files/ssl/google.html")); | 530 test_server()->GetURL("files/ssl/google.html")); |
| 504 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 531 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 505 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 532 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
| 506 ASSERT_TRUE(entry); | 533 ASSERT_TRUE(entry); |
| 507 | 534 |
| 508 // Now go to a bad HTTPS page that shows an interstitial. | 535 // Now go to a bad HTTPS page that shows an interstitial. |
| 509 ui_test_utils::NavigateToURL(browser(), | 536 ui_test_utils::NavigateToURL(browser(), |
| 510 https_server_expired_.GetURL("files/ssl/google.html")); | 537 https_server_expired_.GetURL("files/ssl/google.html")); |
| 511 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 538 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 512 true); // Interstitial showing | 539 false, true); // Interstitial showing |
| 513 | 540 |
| 514 // Simulate user clicking and holding on back button (crbug.com/37215). | 541 // Simulate user clicking and holding on back button (crbug.com/37215). |
| 515 tab->GetController().GoToOffset(-1); | 542 tab->GetController().GoToOffset(-1); |
| 516 | 543 |
| 517 // We should be back at the original good page. | 544 // We should be back at the original good page. |
| 518 EXPECT_FALSE(browser()->tab_strip_model()->GetActiveWebContents()-> | 545 EXPECT_FALSE(browser()->tab_strip_model()->GetActiveWebContents()-> |
| 519 GetInterstitialPage()); | 546 GetInterstitialPage()); |
| 520 CheckUnauthenticatedState(tab); | 547 CheckUnauthenticatedState(tab); |
| 521 } | 548 } |
| 522 | 549 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 545 observer.Wait(); | 572 observer.Wait(); |
| 546 } | 573 } |
| 547 ASSERT_TRUE(tab->GetController().CanGoForward()); | 574 ASSERT_TRUE(tab->GetController().CanGoForward()); |
| 548 NavigationEntry* entry3 = tab->GetController().GetActiveEntry(); | 575 NavigationEntry* entry3 = tab->GetController().GetActiveEntry(); |
| 549 ASSERT_TRUE(entry1 == entry3); | 576 ASSERT_TRUE(entry1 == entry3); |
| 550 | 577 |
| 551 // Now go to a bad HTTPS page that shows an interstitial. | 578 // Now go to a bad HTTPS page that shows an interstitial. |
| 552 ui_test_utils::NavigateToURL(browser(), | 579 ui_test_utils::NavigateToURL(browser(), |
| 553 https_server_expired_.GetURL("files/ssl/google.html")); | 580 https_server_expired_.GetURL("files/ssl/google.html")); |
| 554 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 581 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 555 true); // Interstitial showing | 582 false, true); // Interstitial showing |
| 556 | 583 |
| 557 // Simulate user clicking and holding on forward button. | 584 // Simulate user clicking and holding on forward button. |
| 558 { | 585 { |
| 559 content::WindowedNotificationObserver observer( | 586 content::WindowedNotificationObserver observer( |
| 560 content::NOTIFICATION_LOAD_STOP, | 587 content::NOTIFICATION_LOAD_STOP, |
| 561 content::Source<NavigationController>(&tab->GetController())); | 588 content::Source<NavigationController>(&tab->GetController())); |
| 562 tab->GetController().GoToOffset(1); | 589 tab->GetController().GoToOffset(1); |
| 563 observer.Wait(); | 590 observer.Wait(); |
| 564 } | 591 } |
| 565 | 592 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 634 | 661 |
| 635 // Visit bad HTTPS page. | 662 // Visit bad HTTPS page. |
| 636 std::string scheme("https"); | 663 std::string scheme("https"); |
| 637 GURL::Replacements replacements; | 664 GURL::Replacements replacements; |
| 638 replacements.SetSchemeStr(scheme); | 665 replacements.SetSchemeStr(scheme); |
| 639 ui_test_utils::NavigateToURL( | 666 ui_test_utils::NavigateToURL( |
| 640 browser(), | 667 browser(), |
| 641 wss_server_expired_.GetURL( | 668 wss_server_expired_.GetURL( |
| 642 "connect_check.html").ReplaceComponents(replacements)); | 669 "connect_check.html").ReplaceComponents(replacements)); |
| 643 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 670 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 644 true); // Interstitial showing | 671 false, true); // Interstitial showing |
| 645 | 672 |
| 646 // Proceed anyway. | 673 // Proceed anyway. |
| 647 ProceedThroughInterstitial(tab); | 674 ProceedThroughInterstitial(tab); |
| 648 | 675 |
| 649 // Test page run a WebSocket wss connection test. The result will be shown | 676 // Test page run a WebSocket wss connection test. The result will be shown |
| 650 // as page title. | 677 // as page title. |
| 651 const base::string16 result = watcher.WaitAndGetTitle(); | 678 const base::string16 result = watcher.WaitAndGetTitle(); |
| 652 EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); | 679 EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); |
| 653 } | 680 } |
| 654 | 681 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 // Based on http://crbug.com/8706 | 872 // Based on http://crbug.com/8706 |
| 846 IN_PROC_BROWSER_TEST_F(SSLUITest, | 873 IN_PROC_BROWSER_TEST_F(SSLUITest, |
| 847 TestRunsInsecuredContentRandomizeHash) { | 874 TestRunsInsecuredContentRandomizeHash) { |
| 848 ASSERT_TRUE(test_server()->Start()); | 875 ASSERT_TRUE(test_server()->Start()); |
| 849 ASSERT_TRUE(https_server_.Start()); | 876 ASSERT_TRUE(https_server_.Start()); |
| 850 | 877 |
| 851 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 878 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( |
| 852 "files/ssl/page_runs_insecure_content.html")); | 879 "files/ssl/page_runs_insecure_content.html")); |
| 853 | 880 |
| 854 CheckAuthenticationBrokenState( | 881 CheckAuthenticationBrokenState( |
| 855 browser()->tab_strip_model()->GetActiveWebContents(), 0, true, false); | 882 browser()->tab_strip_model()->GetActiveWebContents(), |
| 883 0, true, true, false); | |
| 856 } | 884 } |
| 857 | 885 |
| 858 // Visits a page with unsafe content and make sure that: | 886 // Visits a page with unsafe content and make sure that: |
| 859 // - frames content is replaced with warning | 887 // - frames content is replaced with warning |
| 860 // - images and scripts are filtered out entirely | 888 // - images and scripts are filtered out entirely |
| 861 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContents) { | 889 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContents) { |
| 862 ASSERT_TRUE(https_server_.Start()); | 890 ASSERT_TRUE(https_server_.Start()); |
| 863 ASSERT_TRUE(https_server_expired_.Start()); | 891 ASSERT_TRUE(https_server_expired_.Start()); |
| 864 | 892 |
| 865 std::string replacement_path; | 893 std::string replacement_path; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1002 content::NOTIFICATION_LOAD_STOP, | 1030 content::NOTIFICATION_LOAD_STOP, |
| 1003 content::NotificationService::AllSources()); | 1031 content::NotificationService::AllSources()); |
| 1004 chrome::Navigate(¶ms); | 1032 chrome::Navigate(¶ms); |
| 1005 WebContents* tab2 = params.target_contents; | 1033 WebContents* tab2 = params.target_contents; |
| 1006 observer.Wait(); | 1034 observer.Wait(); |
| 1007 | 1035 |
| 1008 // Both tabs should have the same process. | 1036 // Both tabs should have the same process. |
| 1009 EXPECT_EQ(tab1->GetRenderProcessHost(), tab2->GetRenderProcessHost()); | 1037 EXPECT_EQ(tab1->GetRenderProcessHost(), tab2->GetRenderProcessHost()); |
| 1010 | 1038 |
| 1011 // The new tab has insecure content. | 1039 // The new tab has insecure content. |
| 1012 CheckAuthenticationBrokenState(tab2, 0, true, false); | 1040 CheckAuthenticationBrokenState(tab2, 0, true, true, false); |
| 1013 | 1041 |
| 1014 // Which means the origin for the first tab has also been contaminated with | 1042 // Which means the origin for the first tab has also been contaminated with |
| 1015 // insecure content. | 1043 // insecure content. |
| 1016 CheckAuthenticationBrokenState(tab1, 0, true, false); | 1044 CheckAuthenticationBrokenState(tab1, 0, false, true, false); |
|
joleksy
2014/03/03 11:22:45
Note: RAN_INSECURE_CONTENT is stored at host level
Ryan Sleevi
2014/03/11 01:46:55
Right. Active content has the potential of corrupt
| |
| 1017 } | 1045 } |
| 1018 | 1046 |
| 1019 // Visits a page with an image over http. Visits another page over https | 1047 // Visits a page with an image over http. Visits another page over https |
| 1020 // referencing that same image over http (hoping it is coming from the webcore | 1048 // referencing that same image over http (hoping it is coming from the webcore |
| 1021 // memory cache). | 1049 // memory cache). |
| 1022 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) { | 1050 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) { |
| 1023 ASSERT_TRUE(test_server()->Start()); | 1051 ASSERT_TRUE(test_server()->Start()); |
| 1024 ASSERT_TRUE(https_server_.Start()); | 1052 ASSERT_TRUE(https_server_.Start()); |
| 1025 | 1053 |
| 1026 std::string replacement_path; | 1054 std::string replacement_path; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1066 // Load original page over HTTP. | 1094 // Load original page over HTTP. |
| 1067 const GURL url_http = test_server()->GetURL(replacement_path); | 1095 const GURL url_http = test_server()->GetURL(replacement_path); |
| 1068 ui_test_utils::NavigateToURL(browser(), url_http); | 1096 ui_test_utils::NavigateToURL(browser(), url_http); |
| 1069 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1097 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1070 CheckUnauthenticatedState(tab); | 1098 CheckUnauthenticatedState(tab); |
| 1071 | 1099 |
| 1072 // Load again but over SSL. It should be marked as displaying insecure | 1100 // Load again but over SSL. It should be marked as displaying insecure |
| 1073 // content (even though the image comes from the WebCore memory cache). | 1101 // content (even though the image comes from the WebCore memory cache). |
| 1074 const GURL url_https = https_server_.GetURL(replacement_path); | 1102 const GURL url_https = https_server_.GetURL(replacement_path); |
| 1075 ui_test_utils::NavigateToURL(browser(), url_https); | 1103 ui_test_utils::NavigateToURL(browser(), url_https); |
| 1076 CheckAuthenticationBrokenState(tab, 0, true, false); | 1104 CheckAuthenticationBrokenState(tab, 0, true, true, false); |
| 1077 } | 1105 } |
| 1078 | 1106 |
| 1079 // This test ensures the CN invalid status does not 'stick' to a certificate | 1107 // This test ensures the CN invalid status does not 'stick' to a certificate |
| 1080 // (see bug #1044942) and that it depends on the host-name. | 1108 // (see bug #1044942) and that it depends on the host-name. |
| 1081 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) { | 1109 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) { |
| 1082 ASSERT_TRUE(https_server_.Start()); | 1110 ASSERT_TRUE(https_server_.Start()); |
| 1083 ASSERT_TRUE(https_server_mismatched_.Start()); | 1111 ASSERT_TRUE(https_server_mismatched_.Start()); |
| 1084 | 1112 |
| 1085 // First we hit the server with hostname, this generates an invalid policy | 1113 // First we hit the server with hostname, this generates an invalid policy |
| 1086 // error. | 1114 // error. |
| 1087 ui_test_utils::NavigateToURL(browser(), | 1115 ui_test_utils::NavigateToURL(browser(), |
| 1088 https_server_mismatched_.GetURL("files/ssl/google.html")); | 1116 https_server_mismatched_.GetURL("files/ssl/google.html")); |
| 1089 | 1117 |
| 1090 // We get an interstitial page as a result. | 1118 // We get an interstitial page as a result. |
| 1091 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1119 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1092 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 1120 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
| 1093 false, true); // Interstitial showing. | 1121 false, false, true); // Interstitial showing. |
| 1094 ProceedThroughInterstitial(tab); | 1122 ProceedThroughInterstitial(tab); |
| 1095 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 1123 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
| 1096 false, false); // No interstitial showing. | 1124 false, false, false); // No interstitial. |
| 1097 | 1125 |
| 1098 // Now we try again with the right host name this time. | 1126 // Now we try again with the right host name this time. |
| 1099 GURL url(https_server_.GetURL("files/ssl/google.html")); | 1127 GURL url(https_server_.GetURL("files/ssl/google.html")); |
| 1100 ui_test_utils::NavigateToURL(browser(), url); | 1128 ui_test_utils::NavigateToURL(browser(), url); |
| 1101 | 1129 |
| 1102 // Security state should be OK. | 1130 // Security state should be OK. |
| 1103 CheckAuthenticatedState(tab, false); | 1131 CheckAuthenticatedState(tab, false); |
| 1104 | 1132 |
| 1105 // Now try again the broken one to make sure it is still broken. | 1133 // Now try again the broken one to make sure it is still broken. |
| 1106 ui_test_utils::NavigateToURL(browser(), | 1134 ui_test_utils::NavigateToURL(browser(), |
| 1107 https_server_mismatched_.GetURL("files/ssl/google.html")); | 1135 https_server_mismatched_.GetURL("files/ssl/google.html")); |
| 1108 | 1136 |
| 1109 // Since we OKed the interstitial last time, we get right to the page. | 1137 // Since we OKed the interstitial last time, we get right to the page. |
| 1110 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 1138 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
| 1111 false, false); // No interstitial showing. | 1139 false, false, false); // No interstitial. |
| 1112 } | 1140 } |
| 1113 | 1141 |
| 1114 #if defined(OS_CHROMEOS) | 1142 #if defined(OS_CHROMEOS) |
| 1115 // This test seems to be flaky and hang on chromiumos. | 1143 // This test seems to be flaky and hang on chromiumos. |
| 1116 // http://crbug.com/84419 | 1144 // http://crbug.com/84419 |
| 1117 #define MAYBE_TestRefNavigation DISABLED_TestRefNavigation | 1145 #define MAYBE_TestRefNavigation DISABLED_TestRefNavigation |
| 1118 #else | 1146 #else |
| 1119 #define MAYBE_TestRefNavigation TestRefNavigation | 1147 #define MAYBE_TestRefNavigation TestRefNavigation |
| 1120 #endif | 1148 #endif |
| 1121 | 1149 |
| 1122 // Test that navigating to a #ref does not change a bad security state. | 1150 // Test that navigating to a #ref does not change a bad security state. |
| 1123 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { | 1151 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { |
| 1124 ASSERT_TRUE(https_server_expired_.Start()); | 1152 ASSERT_TRUE(https_server_expired_.Start()); |
| 1125 | 1153 |
| 1126 ui_test_utils::NavigateToURL(browser(), | 1154 ui_test_utils::NavigateToURL(browser(), |
| 1127 https_server_expired_.GetURL("files/ssl/page_with_refs.html")); | 1155 https_server_expired_.GetURL("files/ssl/page_with_refs.html")); |
| 1128 | 1156 |
| 1129 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1157 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1130 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1158 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1131 true); // Interstitial showing. | 1159 false, true); // Interstitial showing. |
| 1132 | 1160 |
| 1133 ProceedThroughInterstitial(tab); | 1161 ProceedThroughInterstitial(tab); |
| 1134 | 1162 |
| 1135 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1163 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1136 false); // No interstitial showing. | 1164 false, false); // No interstitial showing. |
| 1137 | 1165 |
| 1138 // Now navigate to a ref in the page, the security state should not have | 1166 // Now navigate to a ref in the page, the security state should not have |
| 1139 // changed. | 1167 // changed. |
| 1140 ui_test_utils::NavigateToURL(browser(), | 1168 ui_test_utils::NavigateToURL(browser(), |
| 1141 https_server_expired_.GetURL("files/ssl/page_with_refs.html#jp")); | 1169 https_server_expired_.GetURL("files/ssl/page_with_refs.html#jp")); |
| 1142 | 1170 |
| 1143 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1171 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1144 false); // No interstitial showing. | 1172 false, false); // No interstitial showing. |
| 1145 } | 1173 } |
| 1146 | 1174 |
| 1147 // Tests that closing a page that has a unsafe pop-up does not crash the | 1175 // Tests that closing a page that has a unsafe pop-up does not crash the |
| 1148 // browser (bug #1966). | 1176 // browser (bug #1966). |
| 1149 // TODO(jcampan): http://crbug.com/2136 disabled because the popup is not | 1177 // TODO(jcampan): http://crbug.com/2136 disabled because the popup is not |
| 1150 // opened as it is not initiated by a user gesture. | 1178 // opened as it is not initiated by a user gesture. |
| 1151 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { | 1179 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { |
| 1152 ASSERT_TRUE(test_server()->Start()); | 1180 ASSERT_TRUE(test_server()->Start()); |
| 1153 ASSERT_TRUE(https_server_expired_.Start()); | 1181 ASSERT_TRUE(https_server_expired_.Start()); |
| 1154 | 1182 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1194 ASSERT_TRUE(https_server_expired_.Start()); | 1222 ASSERT_TRUE(https_server_expired_.Start()); |
| 1195 | 1223 |
| 1196 GURL url1 = https_server_expired_.GetURL("server-redirect?"); | 1224 GURL url1 = https_server_expired_.GetURL("server-redirect?"); |
| 1197 GURL url2 = https_server_.GetURL("files/ssl/google.html"); | 1225 GURL url2 = https_server_.GetURL("files/ssl/google.html"); |
| 1198 | 1226 |
| 1199 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); | 1227 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); |
| 1200 | 1228 |
| 1201 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1229 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1202 | 1230 |
| 1203 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1231 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1204 true); // Interstitial showing. | 1232 false, true); // Interstitial showing. |
| 1205 | 1233 |
| 1206 ProceedThroughInterstitial(tab); | 1234 ProceedThroughInterstitial(tab); |
| 1207 | 1235 |
| 1208 // We have been redirected to the good page. | 1236 // We have been redirected to the good page. |
| 1209 CheckAuthenticatedState(tab, false); | 1237 CheckAuthenticatedState(tab, false); |
| 1210 } | 1238 } |
| 1211 | 1239 |
| 1212 // Visit a page over good https that is a redirect to a page with bad https. | 1240 // Visit a page over good https that is a redirect to a page with bad https. |
| 1213 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectGoodToBadHTTPS) { | 1241 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectGoodToBadHTTPS) { |
| 1214 ASSERT_TRUE(https_server_.Start()); | 1242 ASSERT_TRUE(https_server_.Start()); |
| 1215 ASSERT_TRUE(https_server_expired_.Start()); | 1243 ASSERT_TRUE(https_server_expired_.Start()); |
| 1216 | 1244 |
| 1217 GURL url1 = https_server_.GetURL("server-redirect?"); | 1245 GURL url1 = https_server_.GetURL("server-redirect?"); |
| 1218 GURL url2 = https_server_expired_.GetURL("files/ssl/google.html"); | 1246 GURL url2 = https_server_expired_.GetURL("files/ssl/google.html"); |
| 1219 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); | 1247 ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); |
| 1220 | 1248 |
| 1221 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1249 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1222 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1250 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1223 true); // Interstitial showing. | 1251 false, true); // Interstitial showing. |
| 1224 | 1252 |
| 1225 ProceedThroughInterstitial(tab); | 1253 ProceedThroughInterstitial(tab); |
| 1226 | 1254 |
| 1227 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1255 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1228 false); // No interstitial showing. | 1256 false, false); // No interstitial showing. |
| 1229 } | 1257 } |
| 1230 | 1258 |
| 1231 // Visit a page over http that is a redirect to a page with good HTTPS. | 1259 // Visit a page over http that is a redirect to a page with good HTTPS. |
| 1232 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) { | 1260 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) { |
| 1233 ASSERT_TRUE(test_server()->Start()); | 1261 ASSERT_TRUE(test_server()->Start()); |
| 1234 ASSERT_TRUE(https_server_.Start()); | 1262 ASSERT_TRUE(https_server_.Start()); |
| 1235 | 1263 |
| 1236 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1264 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1237 | 1265 |
| 1238 // HTTP redirects to good HTTPS. | 1266 // HTTP redirects to good HTTPS. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1251 ASSERT_TRUE(https_server_expired_.Start()); | 1279 ASSERT_TRUE(https_server_expired_.Start()); |
| 1252 | 1280 |
| 1253 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1281 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1254 | 1282 |
| 1255 GURL http_url = test_server()->GetURL("server-redirect?"); | 1283 GURL http_url = test_server()->GetURL("server-redirect?"); |
| 1256 GURL bad_https_url = | 1284 GURL bad_https_url = |
| 1257 https_server_expired_.GetURL("files/ssl/google.html"); | 1285 https_server_expired_.GetURL("files/ssl/google.html"); |
| 1258 ui_test_utils::NavigateToURL(browser(), | 1286 ui_test_utils::NavigateToURL(browser(), |
| 1259 GURL(http_url.spec() + bad_https_url.spec())); | 1287 GURL(http_url.spec() + bad_https_url.spec())); |
| 1260 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1288 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1261 true); // Interstitial showing. | 1289 false, true); // Interstitial showing. |
| 1262 | 1290 |
| 1263 ProceedThroughInterstitial(tab); | 1291 ProceedThroughInterstitial(tab); |
| 1264 | 1292 |
| 1265 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1293 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1266 false); // No interstitial showing. | 1294 false, false); // No interstitial showing. |
| 1267 } | 1295 } |
| 1268 | 1296 |
| 1269 // Visit a page over https that is a redirect to a page with http (to make sure | 1297 // Visit a page over https that is a redirect to a page with http (to make sure |
| 1270 // we don't keep the secure state). | 1298 // we don't keep the secure state). |
| 1271 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) { | 1299 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) { |
| 1272 ASSERT_TRUE(test_server()->Start()); | 1300 ASSERT_TRUE(test_server()->Start()); |
| 1273 ASSERT_TRUE(https_server_.Start()); | 1301 ASSERT_TRUE(https_server_.Start()); |
| 1274 | 1302 |
| 1275 GURL https_url = https_server_.GetURL("server-redirect?"); | 1303 GURL https_url = https_server_.GetURL("server-redirect?"); |
| 1276 GURL http_url = test_server()->GetURL("files/ssl/google.html"); | 1304 GURL http_url = test_server()->GetURL("files/ssl/google.html"); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1382 content::Source<NavigationController>(&tab->GetController())); | 1410 content::Source<NavigationController>(&tab->GetController())); |
| 1383 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 1411 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 1384 tab, | 1412 tab, |
| 1385 "window.domAutomationController.send(clickLink('HTTPLink'));", | 1413 "window.domAutomationController.send(clickLink('HTTPLink'));", |
| 1386 &success)); | 1414 &success)); |
| 1387 ASSERT_TRUE(success); | 1415 ASSERT_TRUE(success); |
| 1388 observer.Wait(); | 1416 observer.Wait(); |
| 1389 } | 1417 } |
| 1390 | 1418 |
| 1391 // Our state should be unathenticated (in the ran mixed script sense) | 1419 // Our state should be unathenticated (in the ran mixed script sense) |
| 1392 CheckBrokenAuthenticatedState(tab); | 1420 CheckBrokenAuthenticatedState(tab, true); |
| 1393 | 1421 |
| 1394 // Go back, our state should be unchanged. | 1422 // Go back, our state should be unchanged. |
| 1395 { | 1423 { |
| 1396 content::WindowedNotificationObserver observer( | 1424 content::WindowedNotificationObserver observer( |
| 1397 content::NOTIFICATION_LOAD_STOP, | 1425 content::NOTIFICATION_LOAD_STOP, |
| 1398 content::Source<NavigationController>(&tab->GetController())); | 1426 content::Source<NavigationController>(&tab->GetController())); |
| 1399 tab->GetController().GoBack(); | 1427 tab->GetController().GoBack(); |
| 1400 observer.Wait(); | 1428 observer.Wait(); |
| 1401 } | 1429 } |
| 1402 | 1430 |
| 1403 CheckBrokenAuthenticatedState(tab); | 1431 CheckBrokenAuthenticatedState(tab, true); |
| 1404 } | 1432 } |
| 1405 | 1433 |
| 1406 // From a bad HTTPS top frame: | 1434 // From a bad HTTPS top frame: |
| 1407 // - navigate to an OK HTTPS frame (expected to be still authentication broken). | 1435 // - navigate to an OK HTTPS frame (expected to be still authentication broken). |
| 1408 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { | 1436 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { |
| 1409 ASSERT_TRUE(https_server_.Start()); | 1437 ASSERT_TRUE(https_server_.Start()); |
| 1410 ASSERT_TRUE(https_server_expired_.Start()); | 1438 ASSERT_TRUE(https_server_expired_.Start()); |
| 1411 | 1439 |
| 1412 std::string top_frame_path; | 1440 std::string top_frame_path; |
| 1413 ASSERT_TRUE(GetTopFramePath(*test_server(), | 1441 ASSERT_TRUE(GetTopFramePath(*test_server(), |
| 1414 https_server_, | 1442 https_server_, |
| 1415 https_server_expired_, | 1443 https_server_expired_, |
| 1416 &top_frame_path)); | 1444 &top_frame_path)); |
| 1417 | 1445 |
| 1418 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1446 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1419 ui_test_utils::NavigateToURL(browser(), | 1447 ui_test_utils::NavigateToURL(browser(), |
| 1420 https_server_expired_.GetURL(top_frame_path)); | 1448 https_server_expired_.GetURL(top_frame_path)); |
| 1421 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1449 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1422 true); // Interstitial showing | 1450 false, true); // Interstitial showing |
| 1423 | 1451 |
| 1424 ProceedThroughInterstitial(tab); | 1452 ProceedThroughInterstitial(tab); |
| 1425 | 1453 |
| 1426 // Navigate to a good frame. | 1454 // Navigate to a good frame. |
| 1427 bool success = false; | 1455 bool success = false; |
| 1428 content::WindowedNotificationObserver observer( | 1456 content::WindowedNotificationObserver observer( |
| 1429 content::NOTIFICATION_LOAD_STOP, | 1457 content::NOTIFICATION_LOAD_STOP, |
| 1430 content::Source<NavigationController>(&tab->GetController())); | 1458 content::Source<NavigationController>(&tab->GetController())); |
| 1431 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 1459 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 1432 tab, | 1460 tab, |
| 1433 "window.domAutomationController.send(clickLink('goodHTTPSLink'));", | 1461 "window.domAutomationController.send(clickLink('goodHTTPSLink'));", |
| 1434 &success)); | 1462 &success)); |
| 1435 ASSERT_TRUE(success); | 1463 ASSERT_TRUE(success); |
| 1436 observer.Wait(); | 1464 observer.Wait(); |
| 1437 | 1465 |
| 1438 // We should still be authentication broken. | 1466 // We should still be authentication broken. |
| 1439 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1467 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1440 false); | 1468 false, false); |
| 1441 } | 1469 } |
| 1442 | 1470 |
| 1443 // From an HTTP top frame, navigate to good and bad HTTPS (security state should | 1471 // From an HTTP top frame, navigate to good and bad HTTPS (security state should |
| 1444 // stay unauthenticated). | 1472 // stay unauthenticated). |
| 1445 // Disabled, flakily exceeds test timeout, http://crbug.com/43437. | 1473 // Disabled, flakily exceeds test timeout, http://crbug.com/43437. |
| 1446 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestUnauthenticatedFrameNavigation) { | 1474 IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestUnauthenticatedFrameNavigation) { |
| 1447 ASSERT_TRUE(test_server()->Start()); | 1475 ASSERT_TRUE(test_server()->Start()); |
| 1448 ASSERT_TRUE(https_server_.Start()); | 1476 ASSERT_TRUE(https_server_.Start()); |
| 1449 ASSERT_TRUE(https_server_expired_.Start()); | 1477 ASSERT_TRUE(https_server_expired_.Start()); |
| 1450 | 1478 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1527 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsInWorker) { | 1555 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsInWorker) { |
| 1528 ASSERT_TRUE(https_server_.Start()); | 1556 ASSERT_TRUE(https_server_.Start()); |
| 1529 ASSERT_TRUE(https_server_expired_.Start()); | 1557 ASSERT_TRUE(https_server_expired_.Start()); |
| 1530 | 1558 |
| 1531 // Navigate to an unsafe site. Proceed with interstitial page to indicate | 1559 // Navigate to an unsafe site. Proceed with interstitial page to indicate |
| 1532 // the user approves the bad certificate. | 1560 // the user approves the bad certificate. |
| 1533 ui_test_utils::NavigateToURL(browser(), | 1561 ui_test_utils::NavigateToURL(browser(), |
| 1534 https_server_expired_.GetURL("files/ssl/blank_page.html")); | 1562 https_server_expired_.GetURL("files/ssl/blank_page.html")); |
| 1535 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1563 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1536 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1564 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1537 true); // Interstitial showing | 1565 false, true); // Interstitial showing |
| 1538 ProceedThroughInterstitial(tab); | 1566 ProceedThroughInterstitial(tab); |
| 1539 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1567 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1540 false); // No Interstitial | 1568 false, false); // No Interstitial |
| 1541 | 1569 |
| 1542 // Navigate to safe page that has Worker loading unsafe content. | 1570 // Navigate to safe page that has Worker loading unsafe content. |
| 1543 // Expect content to load but be marked as auth broken due to running insecure | 1571 // Expect content to load but be marked as auth broken due to running insecure |
| 1544 // content. | 1572 // content. |
| 1545 std::string page_with_unsafe_worker_path; | 1573 std::string page_with_unsafe_worker_path; |
| 1546 ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_expired_, | 1574 ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_expired_, |
| 1547 &page_with_unsafe_worker_path)); | 1575 &page_with_unsafe_worker_path)); |
| 1548 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 1576 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( |
| 1549 page_with_unsafe_worker_path)); | 1577 page_with_unsafe_worker_path)); |
| 1550 CheckWorkerLoadResult(tab, true); // Worker loads insecure content | 1578 CheckWorkerLoadResult(tab, true); // Worker loads insecure content |
| 1551 CheckAuthenticationBrokenState(tab, 0, true, false); | 1579 CheckAuthenticationBrokenState(tab, 0, false, true, false); |
| 1552 } | 1580 } |
| 1553 | 1581 |
| 1554 // Test that when the browser blocks displaying insecure content (images), the | 1582 // Test that when the browser blocks displaying insecure content (images), the |
| 1555 // indicator shows a secure page, because the blocking made the otherwise | 1583 // indicator shows a secure page, because the blocking made the otherwise |
| 1556 // unsafe page safe (the notification of this state is handled by other means). | 1584 // unsafe page safe (the notification of this state is handled by other means). |
| 1557 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureImage) { | 1585 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureImage) { |
| 1558 ASSERT_TRUE(test_server()->Start()); | 1586 ASSERT_TRUE(test_server()->Start()); |
| 1559 ASSERT_TRUE(https_server_.Start()); | 1587 ASSERT_TRUE(https_server_.Start()); |
| 1560 | 1588 |
| 1561 std::string replacement_path; | 1589 std::string replacement_path; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1645 // http://crbug.com/322948 | 1673 // http://crbug.com/322948 |
| 1646 IN_PROC_BROWSER_TEST_F(SSLUITest, InterstitialNotAffectedByContentSettings) { | 1674 IN_PROC_BROWSER_TEST_F(SSLUITest, InterstitialNotAffectedByContentSettings) { |
| 1647 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 1675 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
| 1648 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); | 1676 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); |
| 1649 | 1677 |
| 1650 ASSERT_TRUE(https_server_expired_.Start()); | 1678 ASSERT_TRUE(https_server_expired_.Start()); |
| 1651 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1679 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1652 ui_test_utils::NavigateToURL(browser(), | 1680 ui_test_utils::NavigateToURL(browser(), |
| 1653 https_server_expired_.GetURL("files/ssl/google.html")); | 1681 https_server_expired_.GetURL("files/ssl/google.html")); |
| 1654 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1682 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1655 true); // Interstitial showing | 1683 false, true); // Interstitial showing |
| 1656 | 1684 |
| 1657 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); | 1685 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); |
| 1658 content::RenderViewHost* interstitial_rvh = | 1686 content::RenderViewHost* interstitial_rvh = |
| 1659 interstitial_page->GetRenderViewHostForTesting(); | 1687 interstitial_page->GetRenderViewHostForTesting(); |
| 1660 bool result = false; | 1688 bool result = false; |
| 1661 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 1689 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 1662 interstitial_rvh, | 1690 interstitial_rvh, |
| 1663 "window.domAutomationController.send(true);", | 1691 "window.domAutomationController.send(true);", |
| 1664 &result)); | 1692 &result)); |
| 1665 // The above will hang without the fix. | 1693 // The above will hang without the fix. |
| 1666 ASSERT_TRUE(result); | 1694 ASSERT_TRUE(result); |
| 1667 } | 1695 } |
| 1668 | 1696 |
| 1669 // TODO(jcampan): more tests to do below. | 1697 // TODO(jcampan): more tests to do below. |
| 1670 | 1698 |
| 1671 // Visit a page over https that contains a frame with a redirect. | 1699 // Visit a page over https that contains a frame with a redirect. |
| 1672 | 1700 |
| 1673 // XMLHttpRequest insecure content in synchronous mode. | 1701 // XMLHttpRequest insecure content in synchronous mode. |
| 1674 | 1702 |
| 1675 // XMLHttpRequest insecure content in asynchronous mode. | 1703 // XMLHttpRequest insecure content in asynchronous mode. |
| 1676 | 1704 |
| 1677 // XMLHttpRequest over bad ssl in synchronous mode. | 1705 // XMLHttpRequest over bad ssl in synchronous mode. |
| 1678 | 1706 |
| 1679 // XMLHttpRequest over OK ssl in synchronous mode. | 1707 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |