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

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

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 MockHttpStream(CloseResultWaiter* result_waiter) 67 MockHttpStream(CloseResultWaiter* result_waiter)
68 : result_waiter_(result_waiter), 68 : result_waiter_(result_waiter),
69 buf_len_(0), 69 buf_len_(0),
70 closed_(false), 70 closed_(false),
71 stall_reads_forever_(false), 71 stall_reads_forever_(false),
72 num_chunks_(0), 72 num_chunks_(0),
73 is_sync_(false), 73 is_sync_(false),
74 is_last_chunk_zero_size_(false), 74 is_last_chunk_zero_size_(false),
75 is_complete_(false), 75 is_complete_(false),
76 weak_factory_(this) {} 76 weak_factory_(this) {}
77 virtual ~MockHttpStream() {} 77 ~MockHttpStream() override {}
78 78
79 // HttpStream implementation. 79 // HttpStream implementation.
80 virtual int InitializeStream(const HttpRequestInfo* request_info, 80 int InitializeStream(const HttpRequestInfo* request_info,
81 RequestPriority priority, 81 RequestPriority priority,
82 const BoundNetLog& net_log, 82 const BoundNetLog& net_log,
83 const CompletionCallback& callback) override { 83 const CompletionCallback& callback) override {
84 return ERR_UNEXPECTED; 84 return ERR_UNEXPECTED;
85 } 85 }
86 virtual int SendRequest(const HttpRequestHeaders& request_headers, 86 int SendRequest(const HttpRequestHeaders& request_headers,
87 HttpResponseInfo* response, 87 HttpResponseInfo* response,
88 const CompletionCallback& callback) override { 88 const CompletionCallback& callback) override {
89 return ERR_UNEXPECTED; 89 return ERR_UNEXPECTED;
90 } 90 }
91 virtual UploadProgress GetUploadProgress() const override { 91 UploadProgress GetUploadProgress() const override { return UploadProgress(); }
92 return UploadProgress(); 92 int ReadResponseHeaders(const CompletionCallback& callback) override {
93 }
94 virtual int ReadResponseHeaders(const CompletionCallback& callback) override {
95 return ERR_UNEXPECTED; 93 return ERR_UNEXPECTED;
96 } 94 }
97 95
98 virtual bool CanFindEndOfResponse() const override { return true; } 96 bool CanFindEndOfResponse() const override { return true; }
99 virtual bool IsConnectionReused() const override { return false; } 97 bool IsConnectionReused() const override { return false; }
100 virtual void SetConnectionReused() override {} 98 void SetConnectionReused() override {}
101 virtual bool IsConnectionReusable() const override { return false; } 99 bool IsConnectionReusable() const override { return false; }
102 virtual int64 GetTotalReceivedBytes() const override { return 0; } 100 int64 GetTotalReceivedBytes() const override { return 0; }
103 virtual void GetSSLInfo(SSLInfo* ssl_info) override {} 101 void GetSSLInfo(SSLInfo* ssl_info) override {}
104 virtual void GetSSLCertRequestInfo( 102 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override {}
105 SSLCertRequestInfo* cert_request_info) override {}
106 103
107 // Mocked API 104 // Mocked API
108 virtual int ReadResponseBody(IOBuffer* buf, int buf_len, 105 int ReadResponseBody(IOBuffer* buf,
109 const CompletionCallback& callback) override; 106 int buf_len,
110 virtual void Close(bool not_reusable) override { 107 const CompletionCallback& callback) override;
108 void Close(bool not_reusable) override {
111 CHECK(!closed_); 109 CHECK(!closed_);
112 closed_ = true; 110 closed_ = true;
113 result_waiter_->set_result(not_reusable); 111 result_waiter_->set_result(not_reusable);
114 } 112 }
115 113
116 virtual HttpStream* RenewStreamForAuth() override { 114 HttpStream* RenewStreamForAuth() override { return NULL; }
117 return NULL; 115
116 bool IsResponseBodyComplete() const override { return is_complete_; }
117
118 bool IsSpdyHttpStream() const override { return false; }
119
120 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override {
121 return false;
118 } 122 }
119 123
120 virtual bool IsResponseBodyComplete() const override { return is_complete_; } 124 void Drain(HttpNetworkSession*) override {}
121 125
122 virtual bool IsSpdyHttpStream() const override { return false; } 126 void SetPriority(RequestPriority priority) override {}
123
124 virtual bool GetLoadTimingInfo(
125 LoadTimingInfo* load_timing_info) const override { return false; }
126
127 virtual void Drain(HttpNetworkSession*) override {}
128
129 virtual 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; }
133 130
134 void set_num_chunks(int num_chunks) { num_chunks_ = num_chunks; } 131 void set_num_chunks(int num_chunks) { num_chunks_ = num_chunks; }
135 132
136 void set_sync() { is_sync_ = true; } 133 void set_sync() { is_sync_ = true; }
137 134
138 void set_is_last_chunk_zero_size() { is_last_chunk_zero_size_ = true; } 135 void set_is_last_chunk_zero_size() { is_last_chunk_zero_size_ = true; }
139 136
(...skipping 162 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
« no previous file with comments | « net/http/http_proxy_client_socket_pool_unittest.cc ('k') | net/http/http_server_properties_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698