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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 501 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
502 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 502 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
503 ASSERT_TRUE(entry); | 503 ASSERT_TRUE(entry); |
504 | 504 |
505 GURL cross_site_url = | 505 GURL cross_site_url = |
506 https_server_expired_.GetURL("files/ssl/google.html"); | 506 https_server_expired_.GetURL("files/ssl/google.html"); |
507 // Change the host name from 127.0.0.1 to localhost so it triggers a | 507 // Change the host name from 127.0.0.1 to localhost so it triggers a |
508 // cross-site navigation so we can test http://crbug.com/5800 is gone. | 508 // cross-site navigation so we can test http://crbug.com/5800 is gone. |
509 ASSERT_EQ("127.0.0.1", cross_site_url.host()); | 509 ASSERT_EQ("127.0.0.1", cross_site_url.host()); |
510 GURL::Replacements replacements; | 510 GURL::Replacements replacements; |
511 std::string new_host("localhost"); | 511 replacements.SetHostStr("localhost"); |
512 replacements.SetHostStr(new_host); | |
513 cross_site_url = cross_site_url.ReplaceComponents(replacements); | 512 cross_site_url = cross_site_url.ReplaceComponents(replacements); |
514 | 513 |
515 // Now go to a bad HTTPS page. | 514 // Now go to a bad HTTPS page. |
516 ui_test_utils::NavigateToURL(browser(), cross_site_url); | 515 ui_test_utils::NavigateToURL(browser(), cross_site_url); |
517 | 516 |
518 // An interstitial should be showing. | 517 // An interstitial should be showing. |
519 CheckAuthenticationBrokenState(tab, | 518 CheckAuthenticationBrokenState(tab, |
520 net::CERT_STATUS_COMMON_NAME_INVALID, | 519 net::CERT_STATUS_COMMON_NAME_INVALID, |
521 AuthState::SHOWING_INTERSTITIAL); | 520 AuthState::SHOWING_INTERSTITIAL); |
522 | 521 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) { | 706 IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) { |
708 ASSERT_TRUE(test_server()->Start()); | 707 ASSERT_TRUE(test_server()->Start()); |
709 ASSERT_TRUE(wss_server_expired_.Start()); | 708 ASSERT_TRUE(wss_server_expired_.Start()); |
710 | 709 |
711 // Setup page title observer. | 710 // Setup page title observer. |
712 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 711 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
713 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 712 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
714 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 713 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
715 | 714 |
716 // Visit bad HTTPS page. | 715 // Visit bad HTTPS page. |
717 std::string scheme("https"); | |
718 GURL::Replacements replacements; | 716 GURL::Replacements replacements; |
719 replacements.SetSchemeStr(scheme); | 717 replacements.SetSchemeStr("https"); |
720 ui_test_utils::NavigateToURL( | 718 ui_test_utils::NavigateToURL( |
721 browser(), | 719 browser(), |
722 wss_server_expired_.GetURL( | 720 wss_server_expired_.GetURL( |
723 "connect_check.html").ReplaceComponents(replacements)); | 721 "connect_check.html").ReplaceComponents(replacements)); |
724 CheckAuthenticationBrokenState( | 722 CheckAuthenticationBrokenState( |
725 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); | 723 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); |
726 | 724 |
727 // Proceed anyway. | 725 // Proceed anyway. |
728 ProceedThroughInterstitial(tab); | 726 ProceedThroughInterstitial(tab); |
729 | 727 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 net::SpawnedTestServer::SSLOptions options( | 778 net::SpawnedTestServer::SSLOptions options( |
781 net::SpawnedTestServer::SSLOptions::CERT_OK); | 779 net::SpawnedTestServer::SSLOptions::CERT_OK); |
782 options.request_client_certificate = true; | 780 options.request_client_certificate = true; |
783 base::FilePath ca_path = net::GetTestCertsDirectory().Append( | 781 base::FilePath ca_path = net::GetTestCertsDirectory().Append( |
784 FILE_PATH_LITERAL("websocket_cacert.pem")); | 782 FILE_PATH_LITERAL("websocket_cacert.pem")); |
785 options.client_authorities.push_back(ca_path); | 783 options.client_authorities.push_back(ca_path); |
786 net::SpawnedTestServer wss_server(net::SpawnedTestServer::TYPE_WSS, | 784 net::SpawnedTestServer wss_server(net::SpawnedTestServer::TYPE_WSS, |
787 options, | 785 options, |
788 net::GetWebSocketTestDataDirectory()); | 786 net::GetWebSocketTestDataDirectory()); |
789 ASSERT_TRUE(wss_server.Start()); | 787 ASSERT_TRUE(wss_server.Start()); |
790 std::string scheme("https"); | |
791 GURL::Replacements replacements; | 788 GURL::Replacements replacements; |
792 replacements.SetSchemeStr(scheme); | 789 replacements.SetSchemeStr("https"); |
793 GURL url = wss_server.GetURL("connect_check.html").ReplaceComponents( | 790 GURL url = wss_server.GetURL("connect_check.html").ReplaceComponents( |
794 replacements); | 791 replacements); |
795 | 792 |
796 // Setup page title observer. | 793 // Setup page title observer. |
797 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 794 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
798 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 795 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
799 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 796 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
800 | 797 |
801 // Add an entry into AutoSelectCertificateForUrls policy for automatic client | 798 // Add an entry into AutoSelectCertificateForUrls policy for automatic client |
802 // cert selection. | 799 // cert selection. |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1757 IN_PROC_BROWSER_TEST_F(SSLUITestIgnoreCertErrors, TestWSS) { | 1754 IN_PROC_BROWSER_TEST_F(SSLUITestIgnoreCertErrors, TestWSS) { |
1758 ASSERT_TRUE(test_server()->Start()); | 1755 ASSERT_TRUE(test_server()->Start()); |
1759 ASSERT_TRUE(wss_server_expired_.Start()); | 1756 ASSERT_TRUE(wss_server_expired_.Start()); |
1760 | 1757 |
1761 // Setup page title observer. | 1758 // Setup page title observer. |
1762 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1759 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
1763 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 1760 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
1764 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 1761 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
1765 | 1762 |
1766 // Visit bad HTTPS page. | 1763 // Visit bad HTTPS page. |
1767 std::string scheme("https"); | |
1768 GURL::Replacements replacements; | 1764 GURL::Replacements replacements; |
1769 replacements.SetSchemeStr(scheme); | 1765 replacements.SetSchemeStr("https"); |
1770 ui_test_utils::NavigateToURL( | 1766 ui_test_utils::NavigateToURL( |
1771 browser(), | 1767 browser(), |
1772 wss_server_expired_.GetURL( | 1768 wss_server_expired_.GetURL( |
1773 "connect_check.html").ReplaceComponents(replacements)); | 1769 "connect_check.html").ReplaceComponents(replacements)); |
1774 | 1770 |
1775 // We shouldn't have an interstitial page showing here. | 1771 // We shouldn't have an interstitial page showing here. |
1776 | 1772 |
1777 // Test page run a WebSocket wss connection test. The result will be shown | 1773 // Test page run a WebSocket wss connection test. The result will be shown |
1778 // as page title. | 1774 // as page title. |
1779 const base::string16 result = watcher.WaitAndGetTitle(); | 1775 const base::string16 result = watcher.WaitAndGetTitle(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 | 1876 |
1881 // Visit a page over https that contains a frame with a redirect. | 1877 // Visit a page over https that contains a frame with a redirect. |
1882 | 1878 |
1883 // XMLHttpRequest insecure content in synchronous mode. | 1879 // XMLHttpRequest insecure content in synchronous mode. |
1884 | 1880 |
1885 // XMLHttpRequest insecure content in asynchronous mode. | 1881 // XMLHttpRequest insecure content in asynchronous mode. |
1886 | 1882 |
1887 // XMLHttpRequest over bad ssl in synchronous mode. | 1883 // XMLHttpRequest over bad ssl in synchronous mode. |
1888 | 1884 |
1889 // XMLHttpRequest over OK ssl in synchronous mode. | 1885 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |