| 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 CHROME_FRAME_TEST_TEST_SERVER_H_ | 5 #ifndef CHROME_FRAME_TEST_TEST_SERVER_H_ |
| 6 #define CHROME_FRAME_TEST_TEST_SERVER_H_ | 6 #define CHROME_FRAME_TEST_TEST_SERVER_H_ |
| 7 | 7 |
| 8 // Implementation of an HTTP server for tests. | 8 // Implementation of an HTTP server for tests. |
| 9 // To instantiate the server, make sure you have a message loop on the | 9 // To instantiate the server, make sure you have a message loop on the |
| 10 // current thread and then create an instance of the SimpleWebServer class. | 10 // current thread and then create an instance of the SimpleWebServer class. |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 int cur_pos_; | 367 int cur_pos_; |
| 368 | 368 |
| 369 DISALLOW_COPY_AND_ASSIGN(ConfigurableConnection); | 369 DISALLOW_COPY_AND_ASSIGN(ConfigurableConnection); |
| 370 }; | 370 }; |
| 371 | 371 |
| 372 // Simple class used as a base class for mock webserver. | 372 // Simple class used as a base class for mock webserver. |
| 373 // Override virtual functions Get and Post and use passed ConfigurableConnection | 373 // Override virtual functions Get and Post and use passed ConfigurableConnection |
| 374 // instance to send the response. | 374 // instance to send the response. |
| 375 class HTTPTestServer : public net::ListenSocket::ListenSocketDelegate { | 375 class HTTPTestServer : public net::ListenSocket::ListenSocketDelegate { |
| 376 public: | 376 public: |
| 377 explicit HTTPTestServer(int port, const std::wstring& address, | 377 HTTPTestServer(int port, const std::wstring& address, FilePath root_dir); |
| 378 FilePath root_dir); | |
| 379 virtual ~HTTPTestServer(); | 378 virtual ~HTTPTestServer(); |
| 380 | 379 |
| 381 // HTTP GET request is received. Override in derived classes. | 380 // HTTP GET request is received. Override in derived classes. |
| 382 // |connection| can be used to send the response. | 381 // |connection| can be used to send the response. |
| 383 virtual void Get(ConfigurableConnection* connection, | 382 virtual void Get(ConfigurableConnection* connection, |
| 384 const std::wstring& path, const Request& r) = 0; | 383 const std::wstring& path, const Request& r) = 0; |
| 385 | 384 |
| 386 // HTTP POST request is received. Override in derived classes. | 385 // HTTP POST request is received. Override in derived classes. |
| 387 // |connection| can be used to send the response | 386 // |connection| can be used to send the response |
| 388 virtual void Post(ConfigurableConnection* connection, | 387 virtual void Post(ConfigurableConnection* connection, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 411 | 410 |
| 412 scoped_refptr<net::ListenSocket> server_; | 411 scoped_refptr<net::ListenSocket> server_; |
| 413 ConnectionList connection_list_; | 412 ConnectionList connection_list_; |
| 414 | 413 |
| 415 DISALLOW_COPY_AND_ASSIGN(HTTPTestServer); | 414 DISALLOW_COPY_AND_ASSIGN(HTTPTestServer); |
| 416 }; | 415 }; |
| 417 | 416 |
| 418 } // namespace test_server | 417 } // namespace test_server |
| 419 | 418 |
| 420 #endif // CHROME_FRAME_TEST_TEST_SERVER_H_ | 419 #endif // CHROME_FRAME_TEST_TEST_SERVER_H_ |
| OLD | NEW |