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

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

Issue 848006: Generalize the net module's LoadLog facility from a passive container, to an event stream (NetLog). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Split up RequestTracker into ConnectJobTracker+RequestTracker+RequestTrackerBase, address comments Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_transaction.h ('k') | net/net.gyp » ('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 (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 <algorithm> 10 #include <algorithm>
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 trans_(NULL), 112 trans_(NULL),
113 error_(net::OK) { 113 error_(net::OK) {
114 // Disregard the error code. 114 // Disregard the error code.
115 factory->CreateTransaction(&trans_); 115 factory->CreateTransaction(&trans_);
116 ++quit_counter_; 116 ++quit_counter_;
117 } 117 }
118 118
119 ~TestTransactionConsumer() { 119 ~TestTransactionConsumer() {
120 } 120 }
121 121
122 void Start(const net::HttpRequestInfo* request, net::LoadLog* load_log) { 122 void Start(const net::HttpRequestInfo* request,
123 const net::BoundNetLog& net_log) {
123 state_ = STARTING; 124 state_ = STARTING;
124 int result = trans_->Start(request, this, load_log); 125 int result = trans_->Start(request, this, net_log);
125 if (result != net::ERR_IO_PENDING) 126 if (result != net::ERR_IO_PENDING)
126 DidStart(result); 127 DidStart(result);
127 } 128 }
128 129
129 bool is_done() const { return state_ == DONE; } 130 bool is_done() const { return state_ == DONE; }
130 int error() const { return error_; } 131 int error() const { return error_; }
131 132
132 const net::HttpResponseInfo* response_info() const { 133 const net::HttpResponseInfo* response_info() const {
133 return trans_->GetResponseInfo(); 134 return trans_->GetResponseInfo();
134 } 135 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // synchronously or asynchronously to help exercise different code paths in the 206 // synchronously or asynchronously to help exercise different code paths in the
206 // HttpCache implementation. 207 // HttpCache implementation.
207 class MockNetworkTransaction : public net::HttpTransaction { 208 class MockNetworkTransaction : public net::HttpTransaction {
208 public: 209 public:
209 MockNetworkTransaction() : 210 MockNetworkTransaction() :
210 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), data_cursor_(0) { 211 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), data_cursor_(0) {
211 } 212 }
212 213
213 virtual int Start(const net::HttpRequestInfo* request, 214 virtual int Start(const net::HttpRequestInfo* request,
214 net::CompletionCallback* callback, 215 net::CompletionCallback* callback,
215 net::LoadLog* load_log) { 216 const net::BoundNetLog& net_log) {
216 const MockTransaction* t = FindMockTransaction(request->url); 217 const MockTransaction* t = FindMockTransaction(request->url);
217 if (!t) 218 if (!t)
218 return net::ERR_FAILED; 219 return net::ERR_FAILED;
219 220
220 std::string resp_status = t->status; 221 std::string resp_status = t->status;
221 std::string resp_headers = t->response_headers; 222 std::string resp_headers = t->response_headers;
222 std::string resp_data = t->data; 223 std::string resp_data = t->data;
223 if (t->handler) 224 if (t->handler)
224 (t->handler)(request, &resp_status, &resp_headers, &resp_data); 225 (t->handler)(request, &resp_status, &resp_headers, &resp_data);
225 226
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 }; 343 };
343 344
344 345
345 //----------------------------------------------------------------------------- 346 //-----------------------------------------------------------------------------
346 // helpers 347 // helpers
347 348
348 // read the transaction completely 349 // read the transaction completely
349 int ReadTransaction(net::HttpTransaction* trans, std::string* result); 350 int ReadTransaction(net::HttpTransaction* trans, std::string* result);
350 351
351 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ 352 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_
OLDNEW
« no previous file with comments | « net/http/http_transaction.h ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698