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

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

Issue 2351513002: net: rename BoundNetLog to NetLogWithSource (Closed)
Patch Set: one more fix, content bound_net_log_ Created 4 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 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> 10 #include <stdint.h>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 //----------------------------------------------------------------------------- 124 //-----------------------------------------------------------------------------
125 // use this class to test completely consuming a transaction 125 // use this class to test completely consuming a transaction
126 126
127 class TestTransactionConsumer { 127 class TestTransactionConsumer {
128 public: 128 public:
129 TestTransactionConsumer(RequestPriority priority, 129 TestTransactionConsumer(RequestPriority priority,
130 HttpTransactionFactory* factory); 130 HttpTransactionFactory* factory);
131 virtual ~TestTransactionConsumer(); 131 virtual ~TestTransactionConsumer();
132 132
133 void Start(const HttpRequestInfo* request, const BoundNetLog& net_log); 133 void Start(const HttpRequestInfo* request, const NetLogWithSource& net_log);
134 134
135 bool is_done() const { return state_ == DONE; } 135 bool is_done() const { return state_ == DONE; }
136 int error() const { return error_; } 136 int error() const { return error_; }
137 137
138 const HttpResponseInfo* response_info() const { 138 const HttpResponseInfo* response_info() const {
139 return trans_->GetResponseInfo(); 139 return trans_->GetResponseInfo();
140 } 140 }
141 const HttpTransaction* transaction() const { return trans_.get(); } 141 const HttpTransaction* transaction() const { return trans_.get(); }
142 const std::string& content() const { return content_; } 142 const std::string& content() const { return content_; }
143 143
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 : public HttpTransaction, 178 : public HttpTransaction,
179 public base::SupportsWeakPtr<MockNetworkTransaction> { 179 public base::SupportsWeakPtr<MockNetworkTransaction> {
180 typedef WebSocketHandshakeStreamBase::CreateHelper CreateHelper; 180 typedef WebSocketHandshakeStreamBase::CreateHelper CreateHelper;
181 181
182 public: 182 public:
183 MockNetworkTransaction(RequestPriority priority, MockNetworkLayer* factory); 183 MockNetworkTransaction(RequestPriority priority, MockNetworkLayer* factory);
184 ~MockNetworkTransaction() override; 184 ~MockNetworkTransaction() override;
185 185
186 int Start(const HttpRequestInfo* request, 186 int Start(const HttpRequestInfo* request,
187 const CompletionCallback& callback, 187 const CompletionCallback& callback,
188 const BoundNetLog& net_log) override; 188 const NetLogWithSource& net_log) override;
189 189
190 int RestartIgnoringLastError(const CompletionCallback& callback) override; 190 int RestartIgnoringLastError(const CompletionCallback& callback) override;
191 191
192 int RestartWithCertificate(X509Certificate* client_cert, 192 int RestartWithCertificate(X509Certificate* client_cert,
193 SSLPrivateKey* client_private_key, 193 SSLPrivateKey* client_private_key,
194 const CompletionCallback& callback) override; 194 const CompletionCallback& callback) override;
195 195
196 int RestartWithAuth(const AuthCredentials& credentials, 196 int RestartWithAuth(const AuthCredentials& credentials,
197 const CompletionCallback& callback) override; 197 const CompletionCallback& callback) override;
198 198
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // Bogus value that will be returned by GetTotalReceivedBytes() if the 247 // Bogus value that will be returned by GetTotalReceivedBytes() if the
248 // MockNetworkTransaction was started. 248 // MockNetworkTransaction was started.
249 static const int64_t kTotalReceivedBytes; 249 static const int64_t kTotalReceivedBytes;
250 // Bogus value that will be returned by GetTotalSentBytes() if the 250 // Bogus value that will be returned by GetTotalSentBytes() if the
251 // MockNetworkTransaction was started. 251 // MockNetworkTransaction was started.
252 static const int64_t kTotalSentBytes; 252 static const int64_t kTotalSentBytes;
253 253
254 private: 254 private:
255 int StartInternal(const HttpRequestInfo* request, 255 int StartInternal(const HttpRequestInfo* request,
256 const CompletionCallback& callback, 256 const CompletionCallback& callback,
257 const BoundNetLog& net_log); 257 const NetLogWithSource& net_log);
258 void CallbackLater(const CompletionCallback& callback, int result); 258 void CallbackLater(const CompletionCallback& callback, int result);
259 void RunCallback(const CompletionCallback& callback, int result); 259 void RunCallback(const CompletionCallback& callback, int result);
260 260
261 const HttpRequestInfo* request_; 261 const HttpRequestInfo* request_;
262 HttpResponseInfo response_; 262 HttpResponseInfo response_;
263 std::string data_; 263 std::string data_;
264 int64_t data_cursor_; 264 int64_t data_cursor_;
265 int64_t content_length_; 265 int64_t content_length_;
266 int test_mode_; 266 int test_mode_;
267 RequestPriority priority_; 267 RequestPriority priority_;
268 MockTransactionReadHandler read_handler_; 268 MockTransactionReadHandler read_handler_;
269 CreateHelper* websocket_handshake_stream_create_helper_; 269 CreateHelper* websocket_handshake_stream_create_helper_;
270 BeforeNetworkStartCallback before_network_start_callback_; 270 BeforeNetworkStartCallback before_network_start_callback_;
271 base::WeakPtr<MockNetworkLayer> transaction_factory_; 271 base::WeakPtr<MockNetworkLayer> transaction_factory_;
272 int64_t received_bytes_; 272 int64_t received_bytes_;
273 int64_t sent_bytes_; 273 int64_t sent_bytes_;
274 274
275 // NetLog ID of the fake / non-existent underlying socket used by the 275 // NetLog ID of the fake / non-existent underlying socket used by the
276 // connection. Requires Start() be passed a BoundNetLog with a real NetLog to 276 // connection. Requires Start() be passed a NetLogWithSource with a real
277 // NetLog to
277 // be initialized. 278 // be initialized.
278 unsigned int socket_log_id_; 279 unsigned int socket_log_id_;
279 280
280 bool done_reading_called_; 281 bool done_reading_called_;
281 282
282 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_; 283 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_;
283 284
284 }; 285 };
285 286
286 class MockNetworkLayer : public HttpTransactionFactory, 287 class MockNetworkLayer : public HttpTransactionFactory,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 349
349 //----------------------------------------------------------------------------- 350 //-----------------------------------------------------------------------------
350 // helpers 351 // helpers
351 352
352 // read the transaction completely 353 // read the transaction completely
353 int ReadTransaction(HttpTransaction* trans, std::string* result); 354 int ReadTransaction(HttpTransaction* trans, std::string* result);
354 355
355 } // namespace net 356 } // namespace net
356 357
357 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ 358 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698