| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include <sstream> | 10 #include <sstream> |
| 11 #include <string> | 11 #include <string> |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 std::string data_received_; | 232 std::string data_received_; |
| 233 | 233 |
| 234 // our read buffer | 234 // our read buffer |
| 235 scoped_refptr<net::IOBuffer> buf_; | 235 scoped_refptr<net::IOBuffer> buf_; |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 // This object bounds the lifetime of an external python-based HTTP/FTP server | 238 // This object bounds the lifetime of an external python-based HTTP/FTP server |
| 239 // that can provide various responses useful for testing. | 239 // that can provide various responses useful for testing. |
| 240 class BaseTestServer : public base::RefCounted<BaseTestServer> { | 240 class BaseTestServer : public base::RefCounted<BaseTestServer> { |
| 241 protected: | 241 protected: |
| 242 BaseTestServer() {} | 242 BaseTestServer() { } |
| 243 BaseTestServer(int connection_attempts, int connection_timeout) | 243 BaseTestServer(int connection_attempts, int connection_timeout) |
| 244 : launcher_(connection_attempts, connection_timeout) {} | 244 : launcher_(connection_attempts, connection_timeout) { } |
| 245 | 245 |
| 246 public: | 246 public: |
| 247 virtual ~BaseTestServer() {} | |
| 248 | |
| 249 void set_forking(bool forking) { | 247 void set_forking(bool forking) { |
| 250 launcher_.set_forking(forking); | 248 launcher_.set_forking(forking); |
| 251 } | 249 } |
| 252 | 250 |
| 253 // Used with e.g. HTTPTestServer::SendQuit() | 251 // Used with e.g. HTTPTestServer::SendQuit() |
| 254 bool WaitToFinish(int milliseconds) { | 252 bool WaitToFinish(int milliseconds) { |
| 255 return launcher_.WaitToFinish(milliseconds); | 253 return launcher_.WaitToFinish(milliseconds); |
| 256 } | 254 } |
| 257 | 255 |
| 258 bool Stop() { | 256 bool Stop() { |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 | 607 |
| 610 MessageLoop::current()->Run(); | 608 MessageLoop::current()->Run(); |
| 611 if (request.is_pending()) | 609 if (request.is_pending()) |
| 612 return false; | 610 return false; |
| 613 | 611 |
| 614 return true; | 612 return true; |
| 615 } | 613 } |
| 616 }; | 614 }; |
| 617 | 615 |
| 618 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 616 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| OLD | NEW |