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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 HttpCache* GetCache() override; | 311 HttpCache* GetCache() override; |
312 HttpNetworkSession* GetSession() override; | 312 HttpNetworkSession* GetSession() override; |
313 | 313 |
314 // The caller must guarantee that |clock| will outlive this object. | 314 // The caller must guarantee that |clock| will outlive this object. |
315 void SetClock(base::Clock* clock); | 315 void SetClock(base::Clock* clock); |
316 base::Clock* clock() const { return clock_; } | 316 base::Clock* clock() const { return clock_; } |
317 | 317 |
318 // The current time (will use clock_ if it is non NULL). | 318 // The current time (will use clock_ if it is non NULL). |
319 base::Time Now(); | 319 base::Time Now(); |
320 | 320 |
| 321 void set_network_session(HttpNetworkSession* session) { session_ = session; } |
| 322 |
321 private: | 323 private: |
322 int transaction_count_; | 324 int transaction_count_; |
323 bool done_reading_called_; | 325 bool done_reading_called_; |
324 bool stop_caching_called_; | 326 bool stop_caching_called_; |
325 RequestPriority last_create_transaction_priority_; | 327 RequestPriority last_create_transaction_priority_; |
326 | 328 |
327 // By default clock_ is NULL but it can be set to a custom clock by test | 329 // By default clock_ is NULL but it can be set to a custom clock by test |
328 // frameworks using SetClock. | 330 // frameworks using SetClock. |
329 base::Clock* clock_; | 331 base::Clock* clock_; |
330 | 332 |
331 base::WeakPtr<MockNetworkTransaction> last_transaction_; | 333 base::WeakPtr<MockNetworkTransaction> last_transaction_; |
| 334 |
| 335 HttpNetworkSession* session_; |
332 }; | 336 }; |
333 | 337 |
334 //----------------------------------------------------------------------------- | 338 //----------------------------------------------------------------------------- |
335 // helpers | 339 // helpers |
336 | 340 |
337 // read the transaction completely | 341 // read the transaction completely |
338 int ReadTransaction(HttpTransaction* trans, std::string* result); | 342 int ReadTransaction(HttpTransaction* trans, std::string* result); |
339 | 343 |
340 } // namespace net | 344 } // namespace net |
341 | 345 |
342 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 346 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
OLD | NEW |