| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 virtual const net::HttpResponseInfo* GetResponseInfo() const OVERRIDE; | 183 virtual const net::HttpResponseInfo* GetResponseInfo() const OVERRIDE; |
| 184 | 184 |
| 185 virtual net::LoadState GetLoadState() const OVERRIDE; | 185 virtual net::LoadState GetLoadState() const OVERRIDE; |
| 186 | 186 |
| 187 virtual net::UploadProgress GetUploadProgress() const OVERRIDE; | 187 virtual net::UploadProgress GetUploadProgress() const OVERRIDE; |
| 188 | 188 |
| 189 virtual bool GetLoadTimingInfo( | 189 virtual bool GetLoadTimingInfo( |
| 190 net::LoadTimingInfo* load_timing_info) const OVERRIDE; | 190 net::LoadTimingInfo* load_timing_info) const OVERRIDE; |
| 191 | 191 |
| 192 virtual void SetPriority(net::RequestPriority priority) OVERRIDE; |
| 193 |
| 194 net::RequestPriority priority() const { return priority_; } |
| 195 |
| 192 private: | 196 private: |
| 193 void CallbackLater(const net::CompletionCallback& callback, int result); | 197 void CallbackLater(const net::CompletionCallback& callback, int result); |
| 194 void RunCallback(const net::CompletionCallback& callback, int result); | 198 void RunCallback(const net::CompletionCallback& callback, int result); |
| 195 | 199 |
| 196 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_; | 200 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_; |
| 197 net::HttpResponseInfo response_; | 201 net::HttpResponseInfo response_; |
| 198 std::string data_; | 202 std::string data_; |
| 199 int data_cursor_; | 203 int data_cursor_; |
| 200 int test_mode_; | 204 int test_mode_; |
| 205 net::RequestPriority priority_; |
| 201 base::WeakPtr<MockNetworkLayer> transaction_factory_; | 206 base::WeakPtr<MockNetworkLayer> transaction_factory_; |
| 202 }; | 207 }; |
| 203 | 208 |
| 204 class MockNetworkLayer : public net::HttpTransactionFactory, | 209 class MockNetworkLayer : public net::HttpTransactionFactory, |
| 205 public base::SupportsWeakPtr<MockNetworkLayer> { | 210 public base::SupportsWeakPtr<MockNetworkLayer> { |
| 206 public: | 211 public: |
| 207 MockNetworkLayer(); | 212 MockNetworkLayer(); |
| 208 virtual ~MockNetworkLayer(); | 213 virtual ~MockNetworkLayer(); |
| 209 | 214 |
| 210 int transaction_count() const { return transaction_count_; } | 215 int transaction_count() const { return transaction_count_; } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 223 bool done_reading_called_; | 228 bool done_reading_called_; |
| 224 }; | 229 }; |
| 225 | 230 |
| 226 //----------------------------------------------------------------------------- | 231 //----------------------------------------------------------------------------- |
| 227 // helpers | 232 // helpers |
| 228 | 233 |
| 229 // read the transaction completely | 234 // read the transaction completely |
| 230 int ReadTransaction(net::HttpTransaction* trans, std::string* result); | 235 int ReadTransaction(net::HttpTransaction* trans, std::string* result); |
| 231 | 236 |
| 232 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 237 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
| OLD | NEW |