Chromium Code Reviews| Index: net/http/http_transaction_unittest.h |
| diff --git a/net/http/http_transaction_unittest.h b/net/http/http_transaction_unittest.h |
| index 693b72089be4c4b695423725b71035eb5c692cb1..6b34d92cc33b1adc75c86f324bb87086d0b11024 100644 |
| --- a/net/http/http_transaction_unittest.h |
| +++ b/net/http/http_transaction_unittest.h |
| @@ -11,6 +11,7 @@ |
| #include "base/callback.h" |
| #include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/string16.h" |
| #include "net/base/io_buffer.h" |
| #include "net/base/load_flags.h" |
| @@ -192,6 +193,10 @@ class MockNetworkTransaction : public net::HttpTransaction { |
| virtual bool GetLoadTimingInfo( |
| net::LoadTimingInfo* load_timing_info) const OVERRIDE; |
| + virtual void SetPriority(net::RequestPriority priority) OVERRIDE; |
| + |
| + net::RequestPriority priority() const { return priority_; } |
| + |
| private: |
| void CallbackLater(const net::CompletionCallback& callback, int result); |
| void RunCallback(const net::CompletionCallback& callback, int result); |
| @@ -201,6 +206,7 @@ class MockNetworkTransaction : public net::HttpTransaction { |
| std::string data_; |
| int data_cursor_; |
| int test_mode_; |
| + net::RequestPriority priority_; |
| base::WeakPtr<MockNetworkLayer> transaction_factory_; |
| }; |
| @@ -214,6 +220,18 @@ class MockNetworkLayer : public net::HttpTransactionFactory, |
| bool done_reading_called() const { return done_reading_called_; } |
| void TransactionDoneReading(); |
| + // Returns the last transaction created by CreateTransaction, or |
| + // NULL if one has not been created yet. |
|
mmenke
2013/03/21 15:39:23
Think it's worth noting that this owns a reference
akalin
2013/03/21 23:43:48
Turns out the DelegatingTransaction approach doesn
|
| + MockNetworkTransaction* last_transaction() { |
| + return last_transaction_.get(); |
| + } |
| + |
| + // Makes last_transaction() return NULL until the next transaction |
| + // is created. |
| + void ClearLastTransaction() { |
| + last_transaction_.reset(); |
| + } |
| + |
| // net::HttpTransactionFactory: |
| virtual int CreateTransaction( |
| net::RequestPriority priority, |
| @@ -225,6 +243,7 @@ class MockNetworkLayer : public net::HttpTransactionFactory, |
| private: |
| int transaction_count_; |
| bool done_reading_called_; |
| + scoped_ptr<MockNetworkTransaction> last_transaction_; |
| }; |
| //----------------------------------------------------------------------------- |