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

Side by Side 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: send cookies on SB requests, and use .Pass instead of .release Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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 "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" 5 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 const std::string& hostname, 124 const std::string& hostname,
125 const net::SSLInfo& ssl_info) override { 125 const net::SSLInfo& ssl_info) override {
126 EXPECT_EQ(type, REPORT_TYPE_PINNING_VIOLATION); 126 EXPECT_EQ(type, REPORT_TYPE_PINNING_VIOLATION);
127 EXPECT_FALSE(hostname.empty()); 127 EXPECT_FALSE(hostname.empty());
128 EXPECT_TRUE(ssl_info.is_valid()); 128 EXPECT_TRUE(ssl_info.is_valid());
129 CertificateErrorReporter::SendReport(type, hostname, ssl_info); 129 CertificateErrorReporter::SendReport(type, hostname, ssl_info);
130 } 130 }
131 131
132 private: 132 private:
133 scoped_ptr<net::URLRequest> CreateURLRequest( 133 scoped_ptr<net::URLRequest> CreateURLRequest(
134 net::URLRequestContext* context) override { 134 net::URLRequestContext* context,
135 CookiesPreference cookies_preference) override {
135 return context->CreateRequest(GURL(std::string()), 136 return context->CreateRequest(GURL(std::string()),
136 net::DEFAULT_PRIORITY, 137 net::DEFAULT_PRIORITY,
137 NULL, 138 NULL,
138 NULL); 139 NULL);
139 } 140 }
140 }; 141 };
141 142
142 static void DoReportIsSent() { 143 static void DoReportIsSent() {
143 net::TestURLRequestContext context; 144 net::TestURLRequestContext context;
144 SendingTestReporter reporter(&context); 145 SendingTestReporter reporter(&context);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 185 }
185 186
186 TEST(ChromeFraudulentCertificateReporterTest, ReportIsNotSent) { 187 TEST(ChromeFraudulentCertificateReporterTest, ReportIsNotSent) {
187 base::MessageLoopForIO loop; 188 base::MessageLoopForIO loop;
188 content::TestBrowserThread io_thread(BrowserThread::IO, &loop); 189 content::TestBrowserThread io_thread(BrowserThread::IO, &loop);
189 loop.PostTask(FROM_HERE, base::Bind(&DoReportIsNotSent)); 190 loop.PostTask(FROM_HERE, base::Bind(&DoReportIsNotSent));
190 loop.RunUntilIdle(); 191 loop.RunUntilIdle();
191 } 192 }
192 193
193 } // namespace chrome_browser_net 194 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698