| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "net/http/http_transaction.h" | 9 #include "net/http/http_transaction.h" |
| 10 | 10 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 READING, | 126 READING, |
| 127 DONE | 127 DONE |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 void DidStart(int result); | 130 void DidStart(int result); |
| 131 void DidRead(int result); | 131 void DidRead(int result); |
| 132 void DidFinish(int result); | 132 void DidFinish(int result); |
| 133 void Read(); | 133 void Read(); |
| 134 | 134 |
| 135 // Callback implementation: | 135 // Callback implementation: |
| 136 virtual void RunWithParams(const Tuple1<int>& params); | 136 virtual void RunWithParams(const Tuple1<int>& params) OVERRIDE; |
| 137 | 137 |
| 138 State state_; | 138 State state_; |
| 139 scoped_ptr<net::HttpTransaction> trans_; | 139 scoped_ptr<net::HttpTransaction> trans_; |
| 140 std::string content_; | 140 std::string content_; |
| 141 scoped_refptr<net::IOBuffer> read_buf_; | 141 scoped_refptr<net::IOBuffer> read_buf_; |
| 142 int error_; | 142 int error_; |
| 143 | 143 |
| 144 static int quit_counter_; | 144 static int quit_counter_; |
| 145 }; | 145 }; |
| 146 | 146 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 public base::SupportsWeakPtr<MockNetworkLayer> { | 204 public base::SupportsWeakPtr<MockNetworkLayer> { |
| 205 public: | 205 public: |
| 206 MockNetworkLayer(); | 206 MockNetworkLayer(); |
| 207 virtual ~MockNetworkLayer(); | 207 virtual ~MockNetworkLayer(); |
| 208 | 208 |
| 209 int transaction_count() const { return transaction_count_; } | 209 int transaction_count() const { return transaction_count_; } |
| 210 bool done_reading_called() const { return done_reading_called_; } | 210 bool done_reading_called() const { return done_reading_called_; } |
| 211 void TransactionDoneReading(); | 211 void TransactionDoneReading(); |
| 212 | 212 |
| 213 // net::HttpTransactionFactory: | 213 // net::HttpTransactionFactory: |
| 214 virtual int CreateTransaction(scoped_ptr<net::HttpTransaction>* trans); | 214 virtual int CreateTransaction( |
| 215 virtual net::HttpCache* GetCache(); | 215 scoped_ptr<net::HttpTransaction>* trans) OVERRIDE; |
| 216 virtual net::HttpNetworkSession* GetSession(); | 216 virtual net::HttpCache* GetCache() OVERRIDE; |
| 217 virtual net::HttpNetworkSession* GetSession() OVERRIDE; |
| 217 | 218 |
| 218 private: | 219 private: |
| 219 int transaction_count_; | 220 int transaction_count_; |
| 220 bool done_reading_called_; | 221 bool done_reading_called_; |
| 221 }; | 222 }; |
| 222 | 223 |
| 223 //----------------------------------------------------------------------------- | 224 //----------------------------------------------------------------------------- |
| 224 // helpers | 225 // helpers |
| 225 | 226 |
| 226 // read the transaction completely | 227 // read the transaction completely |
| 227 int ReadTransaction(net::HttpTransaction* trans, std::string* result); | 228 int ReadTransaction(net::HttpTransaction* trans, std::string* result); |
| 228 | 229 |
| 229 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 230 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
| OLD | NEW |