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

Side by Side Diff: net/http/http_response_body_drainer_unittest.cc

Issue 1320683003: Move logic to figure out if a socket can be reused into HttpStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 3 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 (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 "net/http/http_response_body_drainer.h" 5 #include "net/http/http_response_body_drainer.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 int SendRequest(const HttpRequestHeaders& request_headers, 89 int SendRequest(const HttpRequestHeaders& request_headers,
90 HttpResponseInfo* response, 90 HttpResponseInfo* response,
91 const CompletionCallback& callback) override { 91 const CompletionCallback& callback) override {
92 return ERR_UNEXPECTED; 92 return ERR_UNEXPECTED;
93 } 93 }
94 UploadProgress GetUploadProgress() const override { return UploadProgress(); } 94 UploadProgress GetUploadProgress() const override { return UploadProgress(); }
95 int ReadResponseHeaders(const CompletionCallback& callback) override { 95 int ReadResponseHeaders(const CompletionCallback& callback) override {
96 return ERR_UNEXPECTED; 96 return ERR_UNEXPECTED;
97 } 97 }
98 98
99 bool CanFindEndOfResponse() const override { return true; }
100 bool IsConnectionReused() const override { return false; } 99 bool IsConnectionReused() const override { return false; }
101 void SetConnectionReused() override {} 100 void SetConnectionReused() override {}
102 bool IsConnectionReusable() const override { return false; } 101 bool CanReuseConnection() const override { return false; }
103 int64 GetTotalReceivedBytes() const override { return 0; } 102 int64 GetTotalReceivedBytes() const override { return 0; }
104 void GetSSLInfo(SSLInfo* ssl_info) override {} 103 void GetSSLInfo(SSLInfo* ssl_info) override {}
105 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override {} 104 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override {}
106 105
107 // Mocked API 106 // Mocked API
108 int ReadResponseBody(IOBuffer* buf, 107 int ReadResponseBody(IOBuffer* buf,
109 int buf_len, 108 int buf_len,
110 const CompletionCallback& callback) override; 109 const CompletionCallback& callback) override;
111 void Close(bool not_reusable) override { 110 void Close(bool not_reusable) override {
112 CHECK(!closed_); 111 CHECK(!closed_);
113 closed_ = true; 112 closed_ = true;
114 result_waiter_->set_result(not_reusable); 113 result_waiter_->set_result(not_reusable);
115 } 114 }
116 115
117 HttpStream* RenewStreamForAuth() override { return NULL; } 116 HttpStream* RenewStreamForAuth() override { return NULL; }
118 117
119 bool IsResponseBodyComplete() const override { return is_complete_; } 118 bool IsResponseBodyComplete() const override { return is_complete_; }
120 119
121 bool IsSpdyHttpStream() const override { return false; }
122
123 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override { 120 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override {
124 return false; 121 return false;
125 } 122 }
126 123
127 void Drain(HttpNetworkSession*) override {} 124 void Drain(HttpNetworkSession*) override {}
128 125
129 void SetPriority(RequestPriority priority) override {} 126 void SetPriority(RequestPriority priority) override {}
130 127
131 // Methods to tweak/observer mock behavior: 128 // Methods to tweak/observer mock behavior:
132 void set_stall_reads_forever() { stall_reads_forever_ = true; } 129 void set_stall_reads_forever() { stall_reads_forever_ = true; }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 too_many_chunks += 1; // Now it's too large. 299 too_many_chunks += 1; // Now it's too large.
303 300
304 mock_stream_->set_num_chunks(too_many_chunks); 301 mock_stream_->set_num_chunks(too_many_chunks);
305 drainer_->Start(session_.get()); 302 drainer_->Start(session_.get());
306 EXPECT_TRUE(result_waiter_.WaitForResult()); 303 EXPECT_TRUE(result_waiter_.WaitForResult());
307 } 304 }
308 305
309 } // namespace 306 } // namespace
310 307
311 } // namespace net 308 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698