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

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

Issue 2886483002: Adds a new class HttpCache::Writers for multiple cache transactions reading from the network. (Closed)
Patch Set: Fix test class memory leak Created 3 years, 5 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 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_TEST_UTIL_H_ 5 #ifndef NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_
6 #define NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_ 6 #define NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_
7 7
8 #include "net/http/http_transaction.h" 8 #include "net/http/http_transaction.h"
9 9
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 void SetBeforeHeadersSentCallback( 234 void SetBeforeHeadersSentCallback(
235 const BeforeHeadersSentCallback& callback) override; 235 const BeforeHeadersSentCallback& callback) override;
236 236
237 int ResumeNetworkStart() override; 237 int ResumeNetworkStart() override;
238 238
239 void GetConnectionAttempts(ConnectionAttempts* out) const override; 239 void GetConnectionAttempts(ConnectionAttempts* out) const override;
240 240
241 CreateHelper* websocket_handshake_stream_create_helper() { 241 CreateHelper* websocket_handshake_stream_create_helper() {
242 return websocket_handshake_stream_create_helper_; 242 return websocket_handshake_stream_create_helper_;
243 } 243 }
244
245 // Error to return on a future Read call.
246 void SetReadError(int error);
jkarlin 2017/06/28 15:50:11 What calls this? I don't see anything in the CL.
247
244 RequestPriority priority() const { return priority_; } 248 RequestPriority priority() const { return priority_; }
245 const HttpRequestInfo* request() const { return request_; } 249 const HttpRequestInfo* request() const { return request_; }
246 250
247 // Bogus value that will be returned by GetTotalReceivedBytes() if the 251 // Bogus value that will be returned by GetTotalReceivedBytes() if the
248 // MockNetworkTransaction was started. 252 // MockNetworkTransaction was started.
249 static const int64_t kTotalReceivedBytes; 253 static const int64_t kTotalReceivedBytes;
250 // Bogus value that will be returned by GetTotalSentBytes() if the 254 // Bogus value that will be returned by GetTotalSentBytes() if the
251 // MockNetworkTransaction was started. 255 // MockNetworkTransaction was started.
252 static const int64_t kTotalSentBytes; 256 static const int64_t kTotalSentBytes;
253 257
(...skipping 21 matching lines...) Expand all
275 // NetLog ID of the fake / non-existent underlying socket used by the 279 // NetLog ID of the fake / non-existent underlying socket used by the
276 // connection. Requires Start() be passed a NetLogWithSource with a real 280 // connection. Requires Start() be passed a NetLogWithSource with a real
277 // NetLog to 281 // NetLog to
278 // be initialized. 282 // be initialized.
279 unsigned int socket_log_id_; 283 unsigned int socket_log_id_;
280 284
281 bool done_reading_called_; 285 bool done_reading_called_;
282 286
283 CompletionCallback resume_start_callback_; // used for pause and restart. 287 CompletionCallback resume_start_callback_; // used for pause and restart.
284 288
289 // Error to be returned from Read. If set it will override all Read logic and
290 // simply return the error code (synchronously/asynchronously based on test
291 // mode).
Randy Smith (Not in Mondays) 2017/06/27 18:49:38 This is part of the interface, not the implementat
shivanisha 2017/06/28 18:02:33 Added the error code in MockTransaction and now it
292 int read_error_;
293
285 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_; 294 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_;
286 295
287 }; 296 };
288 297
289 class MockNetworkLayer : public HttpTransactionFactory, 298 class MockNetworkLayer : public HttpTransactionFactory,
290 public base::SupportsWeakPtr<MockNetworkLayer> { 299 public base::SupportsWeakPtr<MockNetworkLayer> {
291 public: 300 public:
292 MockNetworkLayer(); 301 MockNetworkLayer();
293 ~MockNetworkLayer() override; 302 ~MockNetworkLayer() override;
294 303
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 360
352 //----------------------------------------------------------------------------- 361 //-----------------------------------------------------------------------------
353 // helpers 362 // helpers
354 363
355 // read the transaction completely 364 // read the transaction completely
356 int ReadTransaction(HttpTransaction* trans, std::string* result); 365 int ReadTransaction(HttpTransaction* trans, std::string* result);
357 366
358 } // namespace net 367 } // namespace net
359 368
360 #endif // NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_ 369 #endif // NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698