| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace net { |
| 16 class ScopedTestRoot; |
| 17 } |
| 18 |
| 15 namespace chromeos { | 19 namespace chromeos { |
| 16 | 20 |
| 17 class ForwardingServer; | 21 class ForwardingServer; |
| 18 | 22 |
| 19 // An https test server that forwards all requests to another server. This | 23 // An https test server that forwards all requests to another server. This |
| 20 // allows a server that supports http only to be accessed over https. | 24 // allows a server that supports http only to be accessed over https. |
| 21 // | 25 // |
| 22 // The server will bind to |127.0.0.1| but will present a certificate issued to | 26 // The server will bind to |127.0.0.1| but will present a certificate issued to |
| 23 // |ssl_host|. | 27 // |ssl_host|. |
| 24 class HTTPSForwarder { | 28 class HTTPSForwarder { |
| 25 public: | 29 public: |
| 26 HTTPSForwarder(); | 30 HTTPSForwarder(); |
| 27 ~HTTPSForwarder(); | 31 ~HTTPSForwarder(); |
| 28 | 32 |
| 29 // Returns a URL that uses |ssl_host_| as the host. | 33 // Returns a URL that uses |ssl_host_| as the host. |
| 30 GURL GetURLForSSLHost(const std::string& path) const; | 34 GURL GetURLForSSLHost(const std::string& path) const; |
| 31 | 35 |
| 32 bool Initialize(const std::string& ssl_host, | 36 bool Initialize(const std::string& ssl_host, |
| 33 const GURL& forward_target) WARN_UNUSED_RESULT; | 37 const GURL& forward_target) WARN_UNUSED_RESULT; |
| 34 | 38 |
| 35 private: | 39 private: |
| 36 std::string ssl_host_; | 40 std::string ssl_host_; |
| 37 | 41 |
| 42 std::unique_ptr<net::ScopedTestRoot> test_root_; |
| 38 std::unique_ptr<ForwardingServer> forwarding_server_; | 43 std::unique_ptr<ForwardingServer> forwarding_server_; |
| 39 | 44 |
| 40 DISALLOW_COPY_AND_ASSIGN(HTTPSForwarder); | 45 DISALLOW_COPY_AND_ASSIGN(HTTPSForwarder); |
| 41 }; | 46 }; |
| 42 | 47 |
| 43 } // namespace chromeos | 48 } // namespace chromeos |
| 44 | 49 |
| 45 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ | 50 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ |
| OLD | NEW |