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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1069 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1069 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1070 CheckUnauthenticatedState(tab); | 1070 CheckUnauthenticatedState(tab); |
| 1071 | 1071 |
| 1072 // Load again but over SSL. It should be marked as displaying insecure | 1072 // Load again but over SSL. It should be marked as displaying insecure |
| 1073 // content (even though the image comes from the WebCore memory cache). | 1073 // content (even though the image comes from the WebCore memory cache). |
| 1074 const GURL url_https = https_server_.GetURL(replacement_path); | 1074 const GURL url_https = https_server_.GetURL(replacement_path); |
| 1075 ui_test_utils::NavigateToURL(browser(), url_https); | 1075 ui_test_utils::NavigateToURL(browser(), url_https); |
| 1076 CheckAuthenticationBrokenState(tab, 0, true, false); | 1076 CheckAuthenticationBrokenState(tab, 0, true, false); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInlineUsingInvalidCertificate) { | |
| 1080 ASSERT_TRUE(https_server_mismatched_.Start()); | |
| 1081 ASSERT_TRUE(https_server_.Start()); | |
| 1082 | |
| 1083 // Load the image using insecure server. | |
| 1084 GURL url(https_server_mismatched_.GetURL("files/ssl/google_files/logo.gif")); | |
| 1085 ui_test_utils::NavigateToURL(browser(), url); | |
| 1086 | |
| 1087 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | |
| 1088 CheckAuthenticationBrokenState( | |
| 1089 tab, net::CERT_STATUS_COMMON_NAME_INVALID, false, true); | |
| 1090 ProceedThroughInterstitial(tab); | |
| 1091 CheckAuthenticationBrokenState( | |
| 1092 tab, net::CERT_STATUS_COMMON_NAME_INVALID, false, false); | |
| 1093 | |
| 1094 // Load the webpage using secure server. | |
| 1095 std::string replacement_path; | |
| 1096 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | |
| 1097 "files/ssl/page_with_dynamic_insecure_content.html", | |
| 1098 https_server_mismatched_.host_port_pair(), | |
| 1099 &replacement_path)); | |
| 1100 ui_test_utils::NavigateToURL(browser(), | |
| 1101 https_server_.GetURL(replacement_path)); | |
| 1102 CheckAuthenticatedState(tab, false); | |
| 1103 EXPECT_FALSE(tab->DisplayedInsecureContent()); | |
| 1104 | |
| 1105 // Load the inline image using insecure server. | |
| 1106 bool js_result = false; | |
| 1107 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | |
| 1108 tab, "loadBadImage('https');", &js_result)); | |
| 1109 EXPECT_TRUE(js_result); | |
| 1110 | |
| 1111 // Page security should be downgraded. | |
| 1112 CheckAuthenticatedState(tab, true); | |
| 1113 EXPECT_TRUE(tab->DisplayedInsecureContent()); | |
| 1114 } | |
|
Ryan Sleevi
2014/03/11 01:39:39
Can you add an additional test to test for 'intran
| |
| 1115 | |
| 1079 // This test ensures the CN invalid status does not 'stick' to a certificate | 1116 // 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. | 1117 // (see bug #1044942) and that it depends on the host-name. |
| 1081 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) { | 1118 IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) { |
| 1082 ASSERT_TRUE(https_server_.Start()); | 1119 ASSERT_TRUE(https_server_.Start()); |
| 1083 ASSERT_TRUE(https_server_mismatched_.Start()); | 1120 ASSERT_TRUE(https_server_mismatched_.Start()); |
| 1084 | 1121 |
| 1085 // First we hit the server with hostname, this generates an invalid policy | 1122 // First we hit the server with hostname, this generates an invalid policy |
| 1086 // error. | 1123 // error. |
| 1087 ui_test_utils::NavigateToURL(browser(), | 1124 ui_test_utils::NavigateToURL(browser(), |
| 1088 https_server_mismatched_.GetURL("files/ssl/google.html")); | 1125 https_server_mismatched_.GetURL("files/ssl/google.html")); |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1670 | 1707 |
| 1671 // Visit a page over https that contains a frame with a redirect. | 1708 // Visit a page over https that contains a frame with a redirect. |
| 1672 | 1709 |
| 1673 // XMLHttpRequest insecure content in synchronous mode. | 1710 // XMLHttpRequest insecure content in synchronous mode. |
| 1674 | 1711 |
| 1675 // XMLHttpRequest insecure content in asynchronous mode. | 1712 // XMLHttpRequest insecure content in asynchronous mode. |
| 1676 | 1713 |
| 1677 // XMLHttpRequest over bad ssl in synchronous mode. | 1714 // XMLHttpRequest over bad ssl in synchronous mode. |
| 1678 | 1715 |
| 1679 // XMLHttpRequest over OK ssl in synchronous mode. | 1716 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |