Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1055)

Side by Side Diff: chrome/browser/ssl/certificate_reporting_test_utils.cc

Issue 2543523002: Implement main CertificateReportingService code and add unit tests. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // SSLCertReporter implementation. 60 // SSLCertReporter implementation.
61 void ReportInvalidCertificateChain( 61 void ReportInvalidCertificateChain(
62 const std::string& serialized_report) override { 62 const std::string& serialized_report) override {
63 reported_ = true; 63 reported_ = true;
64 if (expect_report_) { 64 if (expect_report_) {
65 safe_browsing_ui_manager_->ReportInvalidCertificateChain( 65 safe_browsing_ui_manager_->ReportInvalidCertificateChain(
66 serialized_report, report_sent_callback_); 66 serialized_report, report_sent_callback_);
67 } 67 }
68 } 68 }
69 69
70 // SSLCertReporter implementation.
71 void OnDidNotSendReport() override {}
72
70 void set_expect_report(bool expect_report) { expect_report_ = expect_report; } 73 void set_expect_report(bool expect_report) { expect_report_ = expect_report; }
71 74
72 private: 75 private:
73 const scoped_refptr<SafeBrowsingUIManager> safe_browsing_ui_manager_; 76 const scoped_refptr<SafeBrowsingUIManager> safe_browsing_ui_manager_;
74 bool reported_; 77 bool reported_;
75 bool expect_report_; 78 bool expect_report_;
76 base::Closure report_sent_callback_; 79 base::Closure report_sent_callback_;
77 }; 80 };
78 81
79 } // namespace 82 } // namespace
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (!base::StringToDouble(param, &sendingThreshold)) 161 if (!base::StringToDouble(param, &sendingThreshold))
159 return CERT_REPORT_NOT_EXPECTED; 162 return CERT_REPORT_NOT_EXPECTED;
160 163
161 if (sendingThreshold == 1.0) 164 if (sendingThreshold == 1.0)
162 return certificate_reporting_test_utils::CERT_REPORT_EXPECTED; 165 return certificate_reporting_test_utils::CERT_REPORT_EXPECTED;
163 } 166 }
164 return certificate_reporting_test_utils::CERT_REPORT_NOT_EXPECTED; 167 return certificate_reporting_test_utils::CERT_REPORT_NOT_EXPECTED;
165 } 168 }
166 169
167 } // namespace certificate_reporting_test_utils 170 } // namespace certificate_reporting_test_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698