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

Side by Side Diff: net/test/url_request/url_request_hanging_read_job.cc

Issue 2595723002: Allow CertNetFetcher to be shutdown from the network thread (Closed)
Patch Set: update comments Created 3 years, 11 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 "net/test/url_request/url_request_hanging_read_job.h" 5 #include "net/test/url_request/url_request_hanging_read_job.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 raw_headers.append( 85 raw_headers.append(
86 "HTTP/1.1 200 OK\n" 86 "HTTP/1.1 200 OK\n"
87 "Content-type: text/plain\n"); 87 "Content-type: text/plain\n");
88 raw_headers.append( 88 raw_headers.append(
89 base::StringPrintf("Content-Length: %1d\n", content_length_)); 89 base::StringPrintf("Content-Length: %1d\n", content_length_));
90 info->headers = new HttpResponseHeaders(HttpUtil::AssembleRawHeaders( 90 info->headers = new HttpResponseHeaders(HttpUtil::AssembleRawHeaders(
91 raw_headers.c_str(), static_cast<int>(raw_headers.length()))); 91 raw_headers.c_str(), static_cast<int>(raw_headers.length())));
92 } 92 }
93 93
94 void URLRequestHangingReadJob::StartAsync() { 94 void URLRequestHangingReadJob::StartAsync() {
95 if (is_done())
96 return;
95 set_expected_content_size(content_length_); 97 set_expected_content_size(content_length_);
96 NotifyHeadersComplete(); 98 NotifyHeadersComplete();
97 } 99 }
98 100
99 // static 101 // static
100 void URLRequestHangingReadJob::AddUrlHandler() { 102 void URLRequestHangingReadJob::AddUrlHandler() {
101 // Add |hostname| to URLRequestFilter for HTTP and HTTPS. 103 // Add |hostname| to URLRequestFilter for HTTP and HTTPS.
102 URLRequestFilter* filter = URLRequestFilter::GetInstance(); 104 URLRequestFilter* filter = URLRequestFilter::GetInstance();
103 filter->AddHostnameInterceptor("http", kMockHostname, 105 filter->AddHostnameInterceptor("http", kMockHostname,
104 base::MakeUnique<MockJobInterceptor>()); 106 base::MakeUnique<MockJobInterceptor>());
105 filter->AddHostnameInterceptor("https", kMockHostname, 107 filter->AddHostnameInterceptor("https", kMockHostname,
106 base::MakeUnique<MockJobInterceptor>()); 108 base::MakeUnique<MockJobInterceptor>());
107 } 109 }
108 110
109 // static 111 // static
110 GURL URLRequestHangingReadJob::GetMockHttpUrl() { 112 GURL URLRequestHangingReadJob::GetMockHttpUrl() {
111 return GetMockUrl("http", kMockHostname); 113 return GetMockUrl("http", kMockHostname);
112 } 114 }
113 115
114 // static 116 // static
115 GURL URLRequestHangingReadJob::GetMockHttpsUrl() { 117 GURL URLRequestHangingReadJob::GetMockHttpsUrl() {
116 return GetMockUrl("https", kMockHostname); 118 return GetMockUrl("https", kMockHostname);
117 } 119 }
118 120
119 } // namespace net 121 } // namespace net
OLDNEW
« no previous file with comments | « net/cert_net/cert_net_fetcher_impl_unittest.cc ('k') | net/tools/cert_verify_tool/verify_using_path_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698