| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chrome_expect_ct_reporter.h" | 5 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 TestCertificateReportSender() | 37 TestCertificateReportSender() |
| 38 : ReportSender(nullptr, net::ReportSender::DO_NOT_SEND_COOKIES) {} | 38 : ReportSender(nullptr, net::ReportSender::DO_NOT_SEND_COOKIES) {} |
| 39 ~TestCertificateReportSender() override {} | 39 ~TestCertificateReportSender() override {} |
| 40 | 40 |
| 41 void Send(const GURL& report_uri, | 41 void Send(const GURL& report_uri, |
| 42 const std::string& serialized_report) override { | 42 const std::string& serialized_report) override { |
| 43 latest_report_uri_ = report_uri; | 43 latest_report_uri_ = report_uri; |
| 44 latest_serialized_report_ = serialized_report; | 44 latest_serialized_report_ = serialized_report; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void SetContentTypeHeader(const std::string& content_type) override {} |
| 48 |
| 47 const GURL& latest_report_uri() { return latest_report_uri_; } | 49 const GURL& latest_report_uri() { return latest_report_uri_; } |
| 48 | 50 |
| 49 const std::string& latest_serialized_report() { | 51 const std::string& latest_serialized_report() { |
| 50 return latest_serialized_report_; | 52 return latest_serialized_report_; |
| 51 } | 53 } |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 GURL latest_report_uri_; | 56 GURL latest_report_uri_; |
| 55 std::string latest_serialized_report_; | 57 std::string latest_serialized_report_; |
| 56 }; | 58 }; |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 reporter.OnExpectCTFailed(host_port, report_uri, ssl_info); | 480 reporter.OnExpectCTFailed(host_port, report_uri, ssl_info); |
| 479 EXPECT_EQ(report_uri, sender->latest_report_uri()); | 481 EXPECT_EQ(report_uri, sender->latest_report_uri()); |
| 480 EXPECT_FALSE(sender->latest_serialized_report().empty()); | 482 EXPECT_FALSE(sender->latest_serialized_report().empty()); |
| 481 ASSERT_NO_FATAL_FAILURE(CheckExpectCTReport( | 483 ASSERT_NO_FATAL_FAILURE(CheckExpectCTReport( |
| 482 sender->latest_serialized_report(), host_port, ssl_info)); | 484 sender->latest_serialized_report(), host_port, ssl_info)); |
| 483 | 485 |
| 484 histograms.ExpectTotalCount(kFailureHistogramName, 0); | 486 histograms.ExpectTotalCount(kFailureHistogramName, 0); |
| 485 histograms.ExpectTotalCount(kSendHistogramName, 1); | 487 histograms.ExpectTotalCount(kSendHistogramName, 1); |
| 486 histograms.ExpectBucketCount(kSendHistogramName, true, 1); | 488 histograms.ExpectBucketCount(kSendHistogramName, true, 1); |
| 487 } | 489 } |
| OLD | NEW |