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

Unified Diff: chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc

Issue 935663004: Add checkbox for reporting invalid TLS/SSL cert chains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment tweaks Created 5 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc
diff --git a/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc b/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc
index 6aff91899b2c0bfdb209acaddd441db5d0c429bf..00507509fdc59b24a2a356ae793b02d323f8cf35 100644
--- a/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc
+++ b/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc
@@ -82,16 +82,16 @@ class SendingTestReporter : public TestReporter {
// Passes if invoked with a good SSLInfo and for a hostname that is a Google
// pinned property.
- void SendReport(const std::string& hostname,
- const SSLInfo& ssl_info) override {
+ void SendPinningViolationReport(const std::string& hostname,
+ const SSLInfo& ssl_info) override {
EXPECT_TRUE(IsGoodSSLInfo(ssl_info));
EXPECT_TRUE(net::TransportSecurityState::IsGooglePinnedProperty(hostname));
passed_ = true;
}
~SendingTestReporter() override {
- // If the object is destroyed without having its SendReport method invoked,
- // we failed.
+ // If the object is destroyed without having its SendPinningViolationReport
+ // method invoked, we failed.
EXPECT_TRUE(passed_);
}
@@ -105,8 +105,8 @@ class NotSendingTestReporter : public TestReporter {
// Passes if invoked with a bad SSLInfo and for a hostname that is not a
// Google pinned property.
- void SendReport(const std::string& hostname,
- const SSLInfo& ssl_info) override {
+ void SendPinningViolationReport(const std::string& hostname,
+ const SSLInfo& ssl_info) override {
EXPECT_FALSE(IsGoodSSLInfo(ssl_info));
EXPECT_FALSE(net::TransportSecurityState::IsGooglePinnedProperty(hostname));
}
@@ -120,18 +120,20 @@ class MockReporter : public ChromeFraudulentCertificateReporter {
: ChromeFraudulentCertificateReporter(request_context) {}
scoped_ptr<net::URLRequest> CreateURLRequest(
- net::URLRequestContext* context) override {
+ net::URLRequestContext* context,
+ const GURL& upload_url) override {
return context->CreateRequest(GURL(std::string()),
net::DEFAULT_PRIORITY,
NULL,
NULL);
}
- void SendReport(const std::string& hostname,
- const net::SSLInfo& ssl_info) override {
+ void SendPinningViolationReport(const std::string& hostname,
+ const net::SSLInfo& ssl_info) override {
DCHECK(!hostname.empty());
DCHECK(ssl_info.is_valid());
- ChromeFraudulentCertificateReporter::SendReport(hostname, ssl_info);
+ ChromeFraudulentCertificateReporter::SendPinningViolationReport(hostname,
+ ssl_info);
}
};
@@ -139,21 +141,21 @@ static void DoReportIsSent() {
net::TestURLRequestContext context;
SendingTestReporter reporter(&context);
SSLInfo info = GetGoodSSLInfo();
- reporter.SendReport("mail.google.com", info);
+ reporter.SendPinningViolationReport("mail.google.com", info);
}
static void DoReportIsNotSent() {
net::TestURLRequestContext context;
NotSendingTestReporter reporter(&context);
SSLInfo info = GetBadSSLInfo();
- reporter.SendReport("www.example.com", info);
+ reporter.SendPinningViolationReport("www.example.com", info);
}
static void DoMockReportIsSent() {
net::TestURLRequestContext context;
MockReporter reporter(&context);
SSLInfo info = GetGoodSSLInfo();
- reporter.SendReport("mail.google.com", info);
+ reporter.SendPinningViolationReport("mail.google.com", info);
}
TEST(ChromeFraudulentCertificateReporterTest, GoodBadInfo) {

Powered by Google App Engine
This is Rietveld 408576698