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

Side by Side Diff: net/http/http_transaction_test_util.h

Issue 1327763003: Added and implemented URLRequest::GetTotalSentBytes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@spdy_sent_bytes_impl
Patch Set: Addressed nits 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
« no previous file with comments | « net/http/http_transaction.h ('k') | net/http/http_transaction_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ 5 #ifndef NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_
6 #define NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ 6 #define NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_
7 7
8 #include "net/http/http_transaction.h" 8 #include "net/http/http_transaction.h"
9 9
10 #include <stdint.h>
11
10 #include <string> 12 #include <string>
11 13
12 #include "base/callback.h" 14 #include "base/callback.h"
13 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
14 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
15 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
16 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
17 #include "net/base/load_flags.h" 19 #include "net/base/load_flags.h"
18 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
19 #include "net/base/request_priority.h" 21 #include "net/base/request_priority.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 int Read(IOBuffer* buf, 192 int Read(IOBuffer* buf,
191 int buf_len, 193 int buf_len,
192 const CompletionCallback& callback) override; 194 const CompletionCallback& callback) override;
193 195
194 void StopCaching() override; 196 void StopCaching() override;
195 197
196 bool GetFullRequestHeaders(HttpRequestHeaders* headers) const override; 198 bool GetFullRequestHeaders(HttpRequestHeaders* headers) const override;
197 199
198 int64 GetTotalReceivedBytes() const override; 200 int64 GetTotalReceivedBytes() const override;
199 201
202 int64_t GetTotalSentBytes() const override;
203
200 void DoneReading() override; 204 void DoneReading() override;
201 205
202 const HttpResponseInfo* GetResponseInfo() const override; 206 const HttpResponseInfo* GetResponseInfo() const override;
203 207
204 LoadState GetLoadState() const override; 208 LoadState GetLoadState() const override;
205 209
206 UploadProgress GetUploadProgress() const override; 210 UploadProgress GetUploadProgress() const override;
207 211
208 void SetQuicServerInfo(QuicServerInfo* quic_server_info) override; 212 void SetQuicServerInfo(QuicServerInfo* quic_server_info) override;
209 213
(...skipping 13 matching lines...) Expand all
223 int ResumeNetworkStart() override; 227 int ResumeNetworkStart() override;
224 228
225 void GetConnectionAttempts(ConnectionAttempts* out) const override; 229 void GetConnectionAttempts(ConnectionAttempts* out) const override;
226 230
227 CreateHelper* websocket_handshake_stream_create_helper() { 231 CreateHelper* websocket_handshake_stream_create_helper() {
228 return websocket_handshake_stream_create_helper_; 232 return websocket_handshake_stream_create_helper_;
229 } 233 }
230 RequestPriority priority() const { return priority_; } 234 RequestPriority priority() const { return priority_; }
231 const HttpRequestInfo* request() const { return request_; } 235 const HttpRequestInfo* request() const { return request_; }
232 236
237 // Bogus value that will be returned by GetTotalReceivedBytes() if the
238 // MockNetworkTransaction was started.
239 static const int64_t kTotalReceivedBytes;
240 // Bogus value that will be returned by GetTotalSentBytes() if the
241 // MockNetworkTransaction was started.
242 static const int64_t kTotalSentBytes;
243
233 private: 244 private:
234 int StartInternal(const HttpRequestInfo* request, 245 int StartInternal(const HttpRequestInfo* request,
235 const CompletionCallback& callback, 246 const CompletionCallback& callback,
236 const BoundNetLog& net_log); 247 const BoundNetLog& net_log);
237 void CallbackLater(const CompletionCallback& callback, int result); 248 void CallbackLater(const CompletionCallback& callback, int result);
238 void RunCallback(const CompletionCallback& callback, int result); 249 void RunCallback(const CompletionCallback& callback, int result);
239 250
240 const HttpRequestInfo* request_; 251 const HttpRequestInfo* request_;
241 HttpResponseInfo response_; 252 HttpResponseInfo response_;
242 std::string data_; 253 std::string data_;
243 int data_cursor_; 254 int data_cursor_;
244 int test_mode_; 255 int test_mode_;
245 RequestPriority priority_; 256 RequestPriority priority_;
246 CreateHelper* websocket_handshake_stream_create_helper_; 257 CreateHelper* websocket_handshake_stream_create_helper_;
247 base::WeakPtr<MockNetworkLayer> transaction_factory_; 258 base::WeakPtr<MockNetworkLayer> transaction_factory_;
248 int64 received_bytes_; 259 int64 received_bytes_;
260 int64_t sent_bytes_;
249 261
250 // NetLog ID of the fake / non-existent underlying socket used by the 262 // NetLog ID of the fake / non-existent underlying socket used by the
251 // connection. Requires Start() be passed a BoundNetLog with a real NetLog to 263 // connection. Requires Start() be passed a BoundNetLog with a real NetLog to
252 // be initialized. 264 // be initialized.
253 unsigned int socket_log_id_; 265 unsigned int socket_log_id_;
254 266
255 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_; 267 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_;
256 268
257 }; 269 };
258 270
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 329
318 //----------------------------------------------------------------------------- 330 //-----------------------------------------------------------------------------
319 // helpers 331 // helpers
320 332
321 // read the transaction completely 333 // read the transaction completely
322 int ReadTransaction(HttpTransaction* trans, std::string* result); 334 int ReadTransaction(HttpTransaction* trans, std::string* result);
323 335
324 } // namespace net 336 } // namespace net
325 337
326 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ 338 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_
OLDNEW
« no previous file with comments | « net/http/http_transaction.h ('k') | net/http/http_transaction_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698