| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "net/test/spawned_test_server/remote_test_server.h" | 5 #include "net/test/spawned_test_server/remote_test_server.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 NOTREACHED(); | 60 NOTREACHED(); |
| 61 } | 61 } |
| 62 return std::string(); | 62 return std::string(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 RemoteTestServer::RemoteTestServer(Type type, | 67 RemoteTestServer::RemoteTestServer(Type type, |
| 68 const std::string& host, | 68 const std::string& host, |
| 69 const base::FilePath& document_root) | 69 const base::FilePath& document_root) |
| 70 : BaseTestServer(type, host), | 70 : BaseTestServer(type, host), spawner_server_port_(0) { |
| 71 spawner_server_port_(0) { | |
| 72 if (!Init(document_root)) | 71 if (!Init(document_root)) |
| 73 NOTREACHED(); | 72 NOTREACHED(); |
| 74 } | 73 } |
| 75 | 74 |
| 76 RemoteTestServer::RemoteTestServer(Type type, | 75 RemoteTestServer::RemoteTestServer(Type type, |
| 77 const SSLOptions& ssl_options, | 76 const SSLOptions& ssl_options, |
| 78 const base::FilePath& document_root) | 77 const base::FilePath& document_root) |
| 79 : BaseTestServer(type, ssl_options), | 78 : BaseTestServer(type, ssl_options), spawner_server_port_(0) { |
| 80 spawner_server_port_(0) { | |
| 81 if (!Init(document_root)) | 79 if (!Init(document_root)) |
| 82 NOTREACHED(); | 80 NOTREACHED(); |
| 83 } | 81 } |
| 84 | 82 |
| 85 RemoteTestServer::~RemoteTestServer() { | 83 RemoteTestServer::~RemoteTestServer() { |
| 86 Stop(); | 84 Stop(); |
| 87 } | 85 } |
| 88 | 86 |
| 89 bool RemoteTestServer::Start() { | 87 bool RemoteTestServer::Start() { |
| 90 if (spawner_communicator_.get()) | 88 if (spawner_communicator_.get()) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 base::StringToInt(ports[1], &test_server_port); | 188 base::StringToInt(ports[1], &test_server_port); |
| 191 if (static_cast<uint32>(test_server_port) >= kuint16max) | 189 if (static_cast<uint32>(test_server_port) >= kuint16max) |
| 192 return false; | 190 return false; |
| 193 SetPort(test_server_port); | 191 SetPort(test_server_port); |
| 194 | 192 |
| 195 // Unlike LocalTestServer, RemoteTestServer passes relative paths to the test | 193 // Unlike LocalTestServer, RemoteTestServer passes relative paths to the test |
| 196 // server. The test server fails on empty strings in some configurations. | 194 // server. The test server fails on empty strings in some configurations. |
| 197 base::FilePath fixed_root = document_root; | 195 base::FilePath fixed_root = document_root; |
| 198 if (fixed_root.empty()) | 196 if (fixed_root.empty()) |
| 199 fixed_root = base::FilePath(base::FilePath::kCurrentDirectory); | 197 fixed_root = base::FilePath(base::FilePath::kCurrentDirectory); |
| 200 SetResourcePath(fixed_root, base::FilePath().AppendASCII("net") | 198 SetResourcePath(fixed_root, |
| 201 .AppendASCII("data") | 199 base::FilePath() |
| 202 .AppendASCII("ssl") | 200 .AppendASCII("net") |
| 203 .AppendASCII("certificates")); | 201 .AppendASCII("data") |
| 202 .AppendASCII("ssl") |
| 203 .AppendASCII("certificates")); |
| 204 return true; | 204 return true; |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace net | 207 } // namespace net |
| 208 | |
| OLD | NEW |