OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |