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

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

Issue 793823002: Let prefetched resources skip cache revalidation once for a short duration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from PS2 Created 6 years 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 <string> 10 #include <string>
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 void ClearLastTransaction() { 284 void ClearLastTransaction() {
285 last_transaction_.reset(); 285 last_transaction_.reset();
286 } 286 }
287 287
288 // net::HttpTransactionFactory: 288 // net::HttpTransactionFactory:
289 int CreateTransaction(net::RequestPriority priority, 289 int CreateTransaction(net::RequestPriority priority,
290 scoped_ptr<net::HttpTransaction>* trans) override; 290 scoped_ptr<net::HttpTransaction>* trans) override;
291 net::HttpCache* GetCache() override; 291 net::HttpCache* GetCache() override;
292 net::HttpNetworkSession* GetSession() override; 292 net::HttpNetworkSession* GetSession() override;
293 293
294 // The caller must guarantee that |clock| will outlive this object.
295 void SetClock(base::Clock* clock);
296 base::Clock* clock() const { return clock_; }
297
294 private: 298 private:
295 int transaction_count_; 299 int transaction_count_;
296 bool done_reading_called_; 300 bool done_reading_called_;
297 bool stop_caching_called_; 301 bool stop_caching_called_;
298 net::RequestPriority last_create_transaction_priority_; 302 net::RequestPriority last_create_transaction_priority_;
303
304 scoped_ptr<base::Clock> default_clock_;
305
306 // Normally clock_ points to default_clock_ but it can be overridden to point
307 // to a custom
308 // clock set by test_clock().
309 base::Clock* clock_;
310
299 base::WeakPtr<MockNetworkTransaction> last_transaction_; 311 base::WeakPtr<MockNetworkTransaction> last_transaction_;
300 }; 312 };
301 313
302 //----------------------------------------------------------------------------- 314 //-----------------------------------------------------------------------------
303 // helpers 315 // helpers
304 316
305 // read the transaction completely 317 // read the transaction completely
306 int ReadTransaction(net::HttpTransaction* trans, std::string* result); 318 int ReadTransaction(net::HttpTransaction* trans, std::string* result);
307 319
308 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ 320 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698