| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // otherwise normal: reports are constructed and sent in the usual way. | 116 // otherwise normal: reports are constructed and sent in the usual way. |
| 117 class MockReporter : public ChromeFraudulentCertificateReporter { | 117 class MockReporter : public ChromeFraudulentCertificateReporter { |
| 118 public: | 118 public: |
| 119 explicit MockReporter(net::URLRequestContext* request_context) | 119 explicit MockReporter(net::URLRequestContext* request_context) |
| 120 : ChromeFraudulentCertificateReporter(request_context) {} | 120 : ChromeFraudulentCertificateReporter(request_context) {} |
| 121 | 121 |
| 122 scoped_ptr<net::URLRequest> CreateURLRequest( | 122 scoped_ptr<net::URLRequest> CreateURLRequest( |
| 123 net::URLRequestContext* context) override { | 123 net::URLRequestContext* context) override { |
| 124 return context->CreateRequest(GURL(std::string()), | 124 return context->CreateRequest(GURL(std::string()), |
| 125 net::DEFAULT_PRIORITY, | 125 net::DEFAULT_PRIORITY, |
| 126 NULL, | |
| 127 NULL); | 126 NULL); |
| 128 } | 127 } |
| 129 | 128 |
| 130 void SendReport(const std::string& hostname, | 129 void SendReport(const std::string& hostname, |
| 131 const net::SSLInfo& ssl_info) override { | 130 const net::SSLInfo& ssl_info) override { |
| 132 DCHECK(!hostname.empty()); | 131 DCHECK(!hostname.empty()); |
| 133 DCHECK(ssl_info.is_valid()); | 132 DCHECK(ssl_info.is_valid()); |
| 134 ChromeFraudulentCertificateReporter::SendReport(hostname, ssl_info); | 133 ChromeFraudulentCertificateReporter::SendReport(hostname, ssl_info); |
| 135 } | 134 } |
| 136 }; | 135 }; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 178 } |
| 180 | 179 |
| 181 TEST(ChromeFraudulentCertificateReporterTest, ReportIsNotSent) { | 180 TEST(ChromeFraudulentCertificateReporterTest, ReportIsNotSent) { |
| 182 base::MessageLoopForIO loop; | 181 base::MessageLoopForIO loop; |
| 183 content::TestBrowserThread io_thread(BrowserThread::IO, &loop); | 182 content::TestBrowserThread io_thread(BrowserThread::IO, &loop); |
| 184 loop.PostTask(FROM_HERE, base::Bind(&DoReportIsNotSent)); | 183 loop.PostTask(FROM_HERE, base::Bind(&DoReportIsNotSent)); |
| 185 loop.RunUntilIdle(); | 184 loop.RunUntilIdle(); |
| 186 } | 185 } |
| 187 | 186 |
| 188 } // namespace chrome_browser_net | 187 } // namespace chrome_browser_net |
| OLD | NEW |