| OLD | NEW | 
|---|
| 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  Loading... | 
| 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 | 
|  | 298   // The current time (will use clock_ if it is non NULL). | 
|  | 299   base::Time Now(); | 
|  | 300 | 
| 294  private: | 301  private: | 
| 295   int transaction_count_; | 302   int transaction_count_; | 
| 296   bool done_reading_called_; | 303   bool done_reading_called_; | 
| 297   bool stop_caching_called_; | 304   bool stop_caching_called_; | 
| 298   net::RequestPriority last_create_transaction_priority_; | 305   net::RequestPriority last_create_transaction_priority_; | 
|  | 306 | 
|  | 307   // By default clock_ is NULL but it can be set to a custom clock by test | 
|  | 308   // frameworks using SetClock. | 
|  | 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_ | 
| OLD | NEW | 
|---|