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/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 &replacement_path)); | 1058 &replacement_path)); |
1059 | 1059 |
1060 // Load a page that displays insecure content. | 1060 // Load a page that displays insecure content. |
1061 ui_test_utils::NavigateToURL(browser(), | 1061 ui_test_utils::NavigateToURL(browser(), |
1062 https_server_.GetURL(replacement_path)); | 1062 https_server_.GetURL(replacement_path)); |
1063 | 1063 |
1064 CheckAuthenticatedState(browser()->tab_strip_model()->GetActiveWebContents(), | 1064 CheckAuthenticatedState(browser()->tab_strip_model()->GetActiveWebContents(), |
1065 AuthState::DISPLAYED_INSECURE_CONTENT); | 1065 AuthState::DISPLAYED_INSECURE_CONTENT); |
1066 } | 1066 } |
1067 | 1067 |
1068 // User proceeds, checkbox is shown and checked, Finch parameter is set | 1068 // Test that if the user proceeds and the checkbox is checked, a report |
1069 // -> we expect a report. | 1069 // is sent or not sent depending on the Finch config. |
1070 IN_PROC_BROWSER_TEST_F( | 1070 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, |
1071 SSLUITestWithExtendedReporting, | 1071 TestBrokenHTTPSProceedReporting) { |
1072 TestBrokenHTTPSProceedWithShowYesCheckYesParamYesReportYes) { | 1072 CertificateReportingTestUtils::ExpectReport expect_report = |
1073 CertificateReportingTestUtils::SetCertReportingFinchConfig( | 1073 CertificateReportingTestUtils::GetReportExpectedFromFinch(); |
1074 CertReportHelper::kFinchGroupShowPossiblySend, "1.0"); | |
1075 TestBrokenHTTPSReporting( | 1074 TestBrokenHTTPSReporting( |
1076 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, | 1075 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, |
1077 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, | 1076 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, expect_report, |
1078 CertificateReportingTestUtils::CERT_REPORT_EXPECTED, browser()); | 1077 browser()); |
1079 } | 1078 } |
1080 | 1079 |
1081 // User goes back, checkbox is shown and checked, Finch parameter is set | 1080 // Test that if the user goes back and the checkbox is checked, a report |
1082 // -> we expect a report. | 1081 // is sent or not sent depending on the Finch config. |
1083 IN_PROC_BROWSER_TEST_F( | 1082 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, |
1084 SSLUITestWithExtendedReporting, | 1083 TestBrokenHTTPSGoBackReporting) { |
1085 TestBrokenHTTPSGoBackWithShowYesCheckYesParamYesReportYes) { | 1084 CertificateReportingTestUtils::ExpectReport expect_report = |
1086 CertificateReportingTestUtils::SetCertReportingFinchConfig( | 1085 CertificateReportingTestUtils::GetReportExpectedFromFinch(); |
1087 CertReportHelper::kFinchGroupShowPossiblySend, "1.0"); | |
1088 TestBrokenHTTPSReporting( | 1086 TestBrokenHTTPSReporting( |
1089 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, | 1087 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, |
1090 CertificateReportingTestUtils::SSL_INTERSTITIAL_DO_NOT_PROCEED, | 1088 CertificateReportingTestUtils::SSL_INTERSTITIAL_DO_NOT_PROCEED, |
1091 CertificateReportingTestUtils::CERT_REPORT_EXPECTED, browser()); | 1089 expect_report, browser()); |
1092 } | 1090 } |
1093 | 1091 |
1094 // User proceeds, checkbox is shown but unchecked, Finch parameter is set | 1092 // User proceeds, checkbox is shown but unchecked. Reports should never |
1095 // -> we expect no report. | 1093 // be sent, regardless of Finch config. |
1096 IN_PROC_BROWSER_TEST_F( | 1094 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, |
1097 SSLUITestWithExtendedReporting, | 1095 TestBrokenHTTPSProceedReportingWithNoOptIn) { |
1098 TestBrokenHTTPSProceedWithShowYesCheckNoParamYesReportNo) { | |
1099 CertificateReportingTestUtils::SetCertReportingFinchConfig( | |
1100 CertReportHelper::kFinchGroupShowPossiblySend, "1.0"); | |
1101 TestBrokenHTTPSReporting( | 1096 TestBrokenHTTPSReporting( |
1102 CertificateReportingTestUtils::EXTENDED_REPORTING_DO_NOT_OPT_IN, | 1097 CertificateReportingTestUtils::EXTENDED_REPORTING_DO_NOT_OPT_IN, |
1103 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, | 1098 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, |
1104 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, browser()); | 1099 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, browser()); |
1105 } | 1100 } |
1106 | 1101 |
1107 // User goes back, checkbox is shown but unchecked, Finch parameter is set | 1102 // User goes back, checkbox is shown but unchecked. Reports should never |
1108 // -> we expect no report. | 1103 // be sent, regardless of Finch config. |
1109 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, | 1104 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, |
1110 TestBrokenHTTPSGoBackShowYesCheckNoParamYesReportNo) { | 1105 TestBrokenHTTPSGoBackShowYesCheckNoParamYesReportNo) { |
1111 CertificateReportingTestUtils::SetCertReportingFinchConfig( | |
1112 CertReportHelper::kFinchGroupShowPossiblySend, "1.0"); | |
1113 TestBrokenHTTPSReporting( | 1106 TestBrokenHTTPSReporting( |
1114 CertificateReportingTestUtils::EXTENDED_REPORTING_DO_NOT_OPT_IN, | 1107 CertificateReportingTestUtils::EXTENDED_REPORTING_DO_NOT_OPT_IN, |
1115 CertificateReportingTestUtils::SSL_INTERSTITIAL_DO_NOT_PROCEED, | 1108 CertificateReportingTestUtils::SSL_INTERSTITIAL_DO_NOT_PROCEED, |
1116 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, browser()); | 1109 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, browser()); |
1117 } | 1110 } |
1118 | 1111 |
1119 // User proceeds, checkbox is shown and checked, Finch parameter is not | 1112 // User proceeds, checkbox is not shown but checked -> we expect no |
1120 // set -> we expect no report. | 1113 // report. |
1121 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, | 1114 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, |
1122 TestBrokenHTTPSProceedShowYesCheckYesParamNoReportNo) { | 1115 TestBrokenHTTPSProceedShowNoCheckYesReportNo) { |
1123 CertificateReportingTestUtils::SetCertReportingFinchConfig( | 1116 if (base::FieldTrialList::FindFullName( |
1124 CertReportHelper::kFinchGroupShowPossiblySend, "-1.0"); | 1117 CertReportHelper::kFinchExperimentName) == |
| 1118 CertReportHelper::kFinchGroupDontShowDontSend) { |
| 1119 TestBrokenHTTPSReporting( |
| 1120 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, |
| 1121 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, |
| 1122 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, browser()); |
| 1123 } |
| 1124 } |
| 1125 |
| 1126 // Browser is incognito, user proceeds, checkbox has previously opted in |
| 1127 // -> no report, regardless of Finch config. |
| 1128 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, |
| 1129 TestBrokenHTTPSInIncognitoReportNo) { |
1125 TestBrokenHTTPSReporting( | 1130 TestBrokenHTTPSReporting( |
1126 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, | 1131 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, |
1127 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, | 1132 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, |
1128 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, browser()); | |
1129 } | |
1130 | |
1131 // User goes back, checkbox is shown and checked, Finch parameter is not set | |
1132 // -> we expect no report. | |
1133 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, | |
1134 TestBrokenHTTPSGoBackShowYesCheckYesParamNoReportNo) { | |
1135 CertificateReportingTestUtils::SetCertReportingFinchConfig( | |
1136 CertReportHelper::kFinchGroupShowPossiblySend, "-1.0"); | |
1137 TestBrokenHTTPSReporting( | |
1138 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, | |
1139 CertificateReportingTestUtils::SSL_INTERSTITIAL_DO_NOT_PROCEED, | |
1140 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, browser()); | |
1141 } | |
1142 | |
1143 // User proceeds, checkbox is not shown but checked -> we expect no report | |
1144 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, | |
1145 TestBrokenHTTPSProceedShowNoCheckYesReportNo) { | |
1146 CertificateReportingTestUtils::SetCertReportingFinchConfig( | |
1147 CertReportHelper::kFinchGroupDontShowDontSend); | |
1148 TestBrokenHTTPSReporting( | |
1149 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, | |
1150 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, | |
1151 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, browser()); | |
1152 } | |
1153 | |
1154 // Browser is incognito, user proceeds, checkbox is shown and checked, Finch | |
1155 // parameter is set -> we expect no report | |
1156 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, | |
1157 TestBrokenHTTPSInIncognitoReportNo) { | |
1158 CertificateReportingTestUtils::SetCertReportingFinchConfig( | |
1159 CertReportHelper::kFinchGroupShowPossiblySend, "1.0"); | |
1160 TestBrokenHTTPSReporting( | |
1161 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, | |
1162 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, | |
1163 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, | 1133 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, |
1164 CreateIncognitoBrowser()); | 1134 CreateIncognitoBrowser()); |
1165 } | 1135 } |
1166 | 1136 |
1167 // User proceeds, checkbox is shown and checked, Finch parameter is invalid | |
1168 // -> we expect no report. | |
1169 IN_PROC_BROWSER_TEST_F( | |
1170 SSLUITestWithExtendedReporting, | |
1171 TestBrokenHTTPSProceedWithShowYesCheckYesParamInvalidReportNo) { | |
1172 CertificateReportingTestUtils::SetCertReportingFinchConfig( | |
1173 CertReportHelper::kFinchGroupShowPossiblySend, "abcdef"); | |
1174 TestBrokenHTTPSReporting( | |
1175 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, | |
1176 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, | |
1177 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, browser()); | |
1178 } | |
1179 | |
1180 // Test that reports don't get sent when extended reporting opt-in is | 1137 // Test that reports don't get sent when extended reporting opt-in is |
1181 // disabled by policy. | 1138 // disabled by policy. |
1182 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, | 1139 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, |
1183 TestBrokenHTTPSNoReportingWhenDisallowed) { | 1140 TestBrokenHTTPSNoReportingWhenDisallowed) { |
1184 browser()->profile()->GetPrefs()->SetBoolean( | 1141 browser()->profile()->GetPrefs()->SetBoolean( |
1185 prefs::kSafeBrowsingExtendedReportingOptInAllowed, false); | 1142 prefs::kSafeBrowsingExtendedReportingOptInAllowed, false); |
1186 TestBrokenHTTPSReporting( | 1143 TestBrokenHTTPSReporting( |
1187 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, | 1144 CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN, |
1188 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, | 1145 CertificateReportingTestUtils::SSL_INTERSTITIAL_PROCEED, |
1189 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, browser()); | 1146 CertificateReportingTestUtils::CERT_REPORT_NOT_EXPECTED, browser()); |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2247 | 2204 |
2248 // Visit a page over https that contains a frame with a redirect. | 2205 // Visit a page over https that contains a frame with a redirect. |
2249 | 2206 |
2250 // XMLHttpRequest insecure content in synchronous mode. | 2207 // XMLHttpRequest insecure content in synchronous mode. |
2251 | 2208 |
2252 // XMLHttpRequest insecure content in asynchronous mode. | 2209 // XMLHttpRequest insecure content in asynchronous mode. |
2253 | 2210 |
2254 // XMLHttpRequest over bad ssl in synchronous mode. | 2211 // XMLHttpRequest over bad ssl in synchronous mode. |
2255 | 2212 |
2256 // XMLHttpRequest over OK ssl in synchronous mode. | 2213 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |