| 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/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Gets ports information used by test server spawner and Python test server. | 169 // Gets ports information used by test server spawner and Python test server. |
| 170 int test_server_port = 0; | 170 int test_server_port = 0; |
| 171 | 171 |
| 172 // Parse file to extract the ports information. | 172 // Parse file to extract the ports information. |
| 173 std::string port_info; | 173 std::string port_info; |
| 174 if (!base::ReadFileToString(GetTestServerPortInfoFile(), &port_info) || | 174 if (!base::ReadFileToString(GetTestServerPortInfoFile(), &port_info) || |
| 175 port_info.empty()) { | 175 port_info.empty()) { |
| 176 return false; | 176 return false; |
| 177 } | 177 } |
| 178 | 178 |
| 179 std::vector<std::string> ports; | 179 std::vector<std::string> ports = base::SplitString( |
| 180 base::SplitString(port_info, ':', &ports); | 180 port_info, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 181 if (ports.size() != 2u) | 181 if (ports.size() != 2u) |
| 182 return false; | 182 return false; |
| 183 | 183 |
| 184 // Verify the ports information. | 184 // Verify the ports information. |
| 185 base::StringToInt(ports[0], &spawner_server_port_); | 185 base::StringToInt(ports[0], &spawner_server_port_); |
| 186 if (!spawner_server_port_ || | 186 if (!spawner_server_port_ || |
| 187 static_cast<uint32>(spawner_server_port_) >= kuint16max) | 187 static_cast<uint32>(spawner_server_port_) >= kuint16max) |
| 188 return false; | 188 return false; |
| 189 | 189 |
| 190 // Allow the test_server_port to be 0, which means the test server spawner | 190 // Allow the test_server_port to be 0, which means the test server spawner |
| (...skipping 10 matching lines...) Expand all Loading... |
| 201 fixed_root = base::FilePath(base::FilePath::kCurrentDirectory); | 201 fixed_root = base::FilePath(base::FilePath::kCurrentDirectory); |
| 202 SetResourcePath(fixed_root, base::FilePath().AppendASCII("net") | 202 SetResourcePath(fixed_root, base::FilePath().AppendASCII("net") |
| 203 .AppendASCII("data") | 203 .AppendASCII("data") |
| 204 .AppendASCII("ssl") | 204 .AppendASCII("ssl") |
| 205 .AppendASCII("certificates")); | 205 .AppendASCII("certificates")); |
| 206 return true; | 206 return true; |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace net | 209 } // namespace net |
| 210 | 210 |
| OLD | NEW |