Chromium Code Reviews| 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 <stdint.h> | 10 #include <stdint.h> |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 HttpCache* GetCache() override; | 313 HttpCache* GetCache() override; |
| 314 HttpNetworkSession* GetSession() override; | 314 HttpNetworkSession* GetSession() override; |
| 315 | 315 |
| 316 // The caller must guarantee that |clock| will outlive this object. | 316 // The caller must guarantee that |clock| will outlive this object. |
| 317 void SetClock(base::Clock* clock); | 317 void SetClock(base::Clock* clock); |
| 318 base::Clock* clock() const { return clock_; } | 318 base::Clock* clock() const { return clock_; } |
| 319 | 319 |
| 320 // The current time (will use clock_ if it is non NULL). | 320 // The current time (will use clock_ if it is non NULL). |
| 321 base::Time Now(); | 321 base::Time Now(); |
| 322 | 322 |
| 323 void set_network_session(HttpNetworkSession* session) { session_ = session; } | |
|
xunjieli
2015/12/02 18:26:31
I don't think we want to do this, see the comment
eustas
2015/12/03 12:32:07
Acknowledged.
| |
| 324 | |
| 323 private: | 325 private: |
| 324 int transaction_count_; | 326 int transaction_count_; |
| 325 bool done_reading_called_; | 327 bool done_reading_called_; |
| 326 bool stop_caching_called_; | 328 bool stop_caching_called_; |
| 327 RequestPriority last_create_transaction_priority_; | 329 RequestPriority last_create_transaction_priority_; |
| 328 | 330 |
| 329 // By default clock_ is NULL but it can be set to a custom clock by test | 331 // By default clock_ is NULL but it can be set to a custom clock by test |
| 330 // frameworks using SetClock. | 332 // frameworks using SetClock. |
| 331 base::Clock* clock_; | 333 base::Clock* clock_; |
| 332 | 334 |
| 333 base::WeakPtr<MockNetworkTransaction> last_transaction_; | 335 base::WeakPtr<MockNetworkTransaction> last_transaction_; |
| 336 | |
| 337 HttpNetworkSession* session_; | |
| 334 }; | 338 }; |
| 335 | 339 |
| 336 //----------------------------------------------------------------------------- | 340 //----------------------------------------------------------------------------- |
| 337 // helpers | 341 // helpers |
| 338 | 342 |
| 339 // read the transaction completely | 343 // read the transaction completely |
| 340 int ReadTransaction(HttpTransaction* trans, std::string* result); | 344 int ReadTransaction(HttpTransaction* trans, std::string* result); |
| 341 | 345 |
| 342 } // namespace net | 346 } // namespace net |
| 343 | 347 |
| 344 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 348 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
| OLD | NEW |