| 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/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 : ChromeFraudulentCertificateReporter(request_context) {} | 137 : ChromeFraudulentCertificateReporter(request_context) {} |
| 138 | 138 |
| 139 virtual net::URLRequest* CreateURLRequest( | 139 virtual net::URLRequest* CreateURLRequest( |
| 140 net::URLRequestContext* context) OVERRIDE { | 140 net::URLRequestContext* context) OVERRIDE { |
| 141 return new MockURLRequest(context); | 141 return new MockURLRequest(context); |
| 142 } | 142 } |
| 143 | 143 |
| 144 virtual void SendReport( | 144 virtual void SendReport( |
| 145 const std::string& hostname, | 145 const std::string& hostname, |
| 146 const net::SSLInfo& ssl_info, | 146 const net::SSLInfo& ssl_info, |
| 147 bool sni_available) { | 147 bool sni_available) OVERRIDE { |
| 148 DCHECK(!hostname.empty()); | 148 DCHECK(!hostname.empty()); |
| 149 DCHECK(ssl_info.is_valid()); | 149 DCHECK(ssl_info.is_valid()); |
| 150 ChromeFraudulentCertificateReporter::SendReport(hostname, ssl_info, | 150 ChromeFraudulentCertificateReporter::SendReport(hostname, ssl_info, |
| 151 sni_available); | 151 sni_available); |
| 152 } | 152 } |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 static void DoReportIsSent() { | 155 static void DoReportIsSent() { |
| 156 ChromeURLRequestContext context(ChromeURLRequestContext::CONTEXT_TYPE_MAIN, | 156 ChromeURLRequestContext context(ChromeURLRequestContext::CONTEXT_TYPE_MAIN, |
| 157 NULL); | 157 NULL); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 TEST(ChromeFraudulentCertificateReporterTest, ReportIsNotSent) { | 201 TEST(ChromeFraudulentCertificateReporterTest, ReportIsNotSent) { |
| 202 MessageLoop loop(MessageLoop::TYPE_IO); | 202 MessageLoop loop(MessageLoop::TYPE_IO); |
| 203 content::TestBrowserThread io_thread(BrowserThread::IO, &loop); | 203 content::TestBrowserThread io_thread(BrowserThread::IO, &loop); |
| 204 loop.PostTask(FROM_HERE, base::Bind(&DoReportIsNotSent)); | 204 loop.PostTask(FROM_HERE, base::Bind(&DoReportIsNotSent)); |
| 205 loop.RunUntilIdle(); | 205 loop.RunUntilIdle(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace chrome_browser_net | 208 } // namespace chrome_browser_net |
| OLD | NEW |