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

Side by Side Diff: chrome/browser/safe_browsing/certificate_reporting_service_test_utils.cc

Issue 2648713002: Add response code to the success callback of ReportSender (Closed)
Patch Set: Move http_response_code to error callback Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/safe_browsing/certificate_reporting_service_test_utils. h" 5 #include "chrome/browser/safe_browsing/certificate_reporting_service_test_utils. h"
6 6
7 #include "base/threading/thread_task_runner_handle.h" 7 #include "base/threading/thread_task_runner_handle.h"
8 #include "components/certificate_reporting/encrypted_cert_logger.pb.h" 8 #include "components/certificate_reporting/encrypted_cert_logger.pb.h"
9 #include "components/certificate_reporting/error_report.h" 9 #include "components/certificate_reporting/error_report.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/test/test_utils.h" 11 #include "content/public/test/test_utils.h"
12 #include "net/base/upload_bytes_element_reader.h" 12 #include "net/base/upload_bytes_element_reader.h"
13 #include "net/base/upload_data_stream.h" 13 #include "net/base/upload_data_stream.h"
14 #include "net/http/http_response_headers.h"
14 #include "net/url_request/url_request_filter.h" 15 #include "net/url_request/url_request_filter.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "third_party/boringssl/src/include/openssl/curve25519.h" 17 #include "third_party/boringssl/src/include/openssl/curve25519.h"
17 18
18 namespace { 19 namespace {
19 20
20 const uint32_t kServerPublicKeyTestVersion = 16; 21 const uint32_t kServerPublicKeyTestVersion = 16;
21 22
22 void SetUpURLHandlersOnIOThread( 23 void SetUpURLHandlersOnIOThread(
23 std::unique_ptr<net::URLRequestInterceptor> url_request_interceptor) { 24 std::unique_ptr<net::URLRequestInterceptor> url_request_interceptor) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 183
183 int DelayableCertReportURLRequestJob::ReadRawData(net::IOBuffer* buf, 184 int DelayableCertReportURLRequestJob::ReadRawData(net::IOBuffer* buf,
184 int buf_size) { 185 int buf_size) {
185 // Report sender ignores responses. Return empty response. 186 // Report sender ignores responses. Return empty response.
186 return 0; 187 return 0;
187 } 188 }
188 189
189 void DelayableCertReportURLRequestJob::GetResponseInfo( 190 void DelayableCertReportURLRequestJob::GetResponseInfo(
190 net::HttpResponseInfo* info) { 191 net::HttpResponseInfo* info) {
191 // Report sender ignores responses. Return empty response. 192 // Report sender ignores responses. Return empty response.
193 if (!should_fail_) {
194 info->headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK");
195 }
192 } 196 }
193 197
194 void DelayableCertReportURLRequestJob::Resume() { 198 void DelayableCertReportURLRequestJob::Resume() {
195 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 199 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
196 if (!started_) { 200 if (!started_) {
197 // If Start() hasn't been called yet, then unset |delayed_| so that when 201 // If Start() hasn't been called yet, then unset |delayed_| so that when
198 // Start() is called, the request will begin immediately. 202 // Start() is called, the request will begin immediately.
199 delayed_ = false; 203 delayed_ = false;
200 return; 204 return;
201 } 205 }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 437
434 if (service->GetReporterForTesting()) { 438 if (service->GetReporterForTesting()) {
435 // Reporter can be null if reporting is disabled. 439 // Reporter can be null if reporting is disabled.
436 EXPECT_EQ( 440 EXPECT_EQ(
437 0u, 441 0u,
438 service->GetReporterForTesting()->inflight_report_count_for_testing()); 442 service->GetReporterForTesting()->inflight_report_count_for_testing());
439 } 443 }
440 } 444 }
441 445
442 } // namespace certificate_reporting_test_utils 446 } // namespace certificate_reporting_test_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698