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

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

Issue 14625012: net: Return LoadTiming information in the case of a cache hit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix tests, add tests Created 7 years, 7 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
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 #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 <string> 10 #include <string>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
17 #include "net/base/load_flags.h" 17 #include "net/base/load_flags.h"
18 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
19 #include "net/base/net_log.h"
19 #include "net/base/request_priority.h" 20 #include "net/base/request_priority.h"
20 #include "net/base/test_completion_callback.h" 21 #include "net/base/test_completion_callback.h"
21 #include "net/disk_cache/disk_cache.h" 22 #include "net/disk_cache/disk_cache.h"
22 #include "net/http/http_cache.h" 23 #include "net/http/http_cache.h"
23 #include "net/http/http_request_info.h" 24 #include "net/http/http_request_info.h"
24 #include "net/http/http_response_headers.h" 25 #include "net/http/http_response_headers.h"
25 #include "net/http/http_response_info.h" 26 #include "net/http/http_response_info.h"
26 27
27 namespace net { 28 namespace net {
28 class IOBuffer; 29 class IOBuffer;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 void CallbackLater(const net::CompletionCallback& callback, int result); 207 void CallbackLater(const net::CompletionCallback& callback, int result);
207 void RunCallback(const net::CompletionCallback& callback, int result); 208 void RunCallback(const net::CompletionCallback& callback, int result);
208 209
209 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_; 210 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_;
210 net::HttpResponseInfo response_; 211 net::HttpResponseInfo response_;
211 std::string data_; 212 std::string data_;
212 int data_cursor_; 213 int data_cursor_;
213 int test_mode_; 214 int test_mode_;
214 net::RequestPriority priority_; 215 net::RequestPriority priority_;
215 base::WeakPtr<MockNetworkLayer> transaction_factory_; 216 base::WeakPtr<MockNetworkLayer> transaction_factory_;
217
218 // NetLog ID of the fake / non-existent underlying socket used by the
219 // connection. Requires Start() be passed a BoundNetLog with a real NetLog to
220 // be initialized.
221 unsigned int socket_log_id_;
216 }; 222 };
217 223
218 class MockNetworkLayer : public net::HttpTransactionFactory, 224 class MockNetworkLayer : public net::HttpTransactionFactory,
219 public base::SupportsWeakPtr<MockNetworkLayer> { 225 public base::SupportsWeakPtr<MockNetworkLayer> {
220 public: 226 public:
221 MockNetworkLayer(); 227 MockNetworkLayer();
222 virtual ~MockNetworkLayer(); 228 virtual ~MockNetworkLayer();
223 229
224 int transaction_count() const { return transaction_count_; } 230 int transaction_count() const { return transaction_count_; }
225 bool done_reading_called() const { return done_reading_called_; } 231 bool done_reading_called() const { return done_reading_called_; }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 base::WeakPtr<MockNetworkTransaction> last_transaction_; 267 base::WeakPtr<MockNetworkTransaction> last_transaction_;
262 }; 268 };
263 269
264 //----------------------------------------------------------------------------- 270 //-----------------------------------------------------------------------------
265 // helpers 271 // helpers
266 272
267 // read the transaction completely 273 // read the transaction completely
268 int ReadTransaction(net::HttpTransaction* trans, std::string* result); 274 int ReadTransaction(net::HttpTransaction* trans, std::string* result);
269 275
270 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ 276 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698