Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ssl/certificate_reporting_test_utils.h" | 5 #include "chrome/browser/ssl/certificate_reporting_test_utils.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 | 82 |
| 83 MockErrorReporter::MockErrorReporter( | 83 MockErrorReporter::MockErrorReporter( |
| 84 net::URLRequestContext* request_context, | 84 net::URLRequestContext* request_context, |
| 85 const GURL& upload_url, | 85 const GURL& upload_url, |
| 86 net::ReportSender::CookiesPreference cookies_preference) | 86 net::ReportSender::CookiesPreference cookies_preference) |
| 87 : certificate_reporting::ErrorReporter(request_context, | 87 : certificate_reporting::ErrorReporter(request_context, |
| 88 upload_url, | 88 upload_url, |
| 89 cookies_preference) {} | 89 cookies_preference) {} |
| 90 | 90 |
| 91 void MockErrorReporter::SendExtendedReportingReport( | 91 void MockErrorReporter::SendExtendedReportingReport( |
| 92 const std::string& serialized_report) { | 92 const std::string& serialized_report, |
| 93 int report_id) { | |
|
Jialiu Lin
2016/11/14 17:20:38
nit: maybe report_id_unused
meacer
2016/11/14 23:34:54
I've changed the interface to not accept a report_
| |
| 93 certificate_reporting::ErrorReport report; | 94 certificate_reporting::ErrorReport report; |
| 94 ASSERT_TRUE(report.InitializeFromString(serialized_report)); | 95 ASSERT_TRUE(report.InitializeFromString(serialized_report)); |
| 95 latest_hostname_reported_ = report.hostname(); | 96 latest_hostname_reported_ = report.hostname(); |
| 96 } | 97 } |
| 97 | 98 |
| 98 void CertificateReportingTest::SetUpMockReporter() { | 99 void CertificateReportingTest::SetUpMockReporter() { |
| 99 // Set up the mock reporter to track the hostnames that reports get | 100 // Set up the mock reporter to track the hostnames that reports get |
| 100 // sent for. The request_context argument is null here | 101 // sent for. The request_context argument is null here |
| 101 // because the MockErrorReporter doesn't actually use a | 102 // because the MockErrorReporter doesn't actually use a |
| 102 // request_context. (In order to pass a real request_context, the | 103 // request_context. (In order to pass a real request_context, the |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 if (!base::StringToDouble(param, &sendingThreshold)) | 157 if (!base::StringToDouble(param, &sendingThreshold)) |
| 157 return CERT_REPORT_NOT_EXPECTED; | 158 return CERT_REPORT_NOT_EXPECTED; |
| 158 | 159 |
| 159 if (sendingThreshold == 1.0) | 160 if (sendingThreshold == 1.0) |
| 160 return certificate_reporting_test_utils::CERT_REPORT_EXPECTED; | 161 return certificate_reporting_test_utils::CERT_REPORT_EXPECTED; |
| 161 } | 162 } |
| 162 return certificate_reporting_test_utils::CERT_REPORT_NOT_EXPECTED; | 163 return certificate_reporting_test_utils::CERT_REPORT_NOT_EXPECTED; |
| 163 } | 164 } |
| 164 | 165 |
| 165 } // namespace certificate_reporting_test_utils | 166 } // namespace certificate_reporting_test_utils |
| OLD | NEW |