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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 bool RemoteTestServer::Init(const base::FilePath& document_root) { | 163 bool RemoteTestServer::Init(const base::FilePath& document_root) { |
164 if (document_root.IsAbsolute()) | 164 if (document_root.IsAbsolute()) |
165 return false; | 165 return false; |
166 | 166 |
167 // Gets ports information used by test server spawner and Python test server. | 167 // Gets ports information used by test server spawner and Python test server. |
168 int test_server_port = 0; | 168 int test_server_port = 0; |
169 | 169 |
170 // Parse file to extract the ports information. | 170 // Parse file to extract the ports information. |
171 std::string port_info; | 171 std::string port_info; |
172 if (!file_util::ReadFileToString(GetTestServerPortInfoFile(), | 172 if (!base::ReadFileToString(GetTestServerPortInfoFile(), &port_info) || |
173 &port_info) || | |
174 port_info.empty()) { | 173 port_info.empty()) { |
175 return false; | 174 return false; |
176 } | 175 } |
177 | 176 |
178 std::vector<std::string> ports; | 177 std::vector<std::string> ports; |
179 base::SplitString(port_info, ':', &ports); | 178 base::SplitString(port_info, ':', &ports); |
180 if (ports.size() != 2u) | 179 if (ports.size() != 2u) |
181 return false; | 180 return false; |
182 | 181 |
183 // Verify the ports information. | 182 // Verify the ports information. |
(...skipping 11 matching lines...) Expand all Loading... |
195 | 194 |
196 SetResourcePath(document_root, base::FilePath().AppendASCII("net") | 195 SetResourcePath(document_root, base::FilePath().AppendASCII("net") |
197 .AppendASCII("data") | 196 .AppendASCII("data") |
198 .AppendASCII("ssl") | 197 .AppendASCII("ssl") |
199 .AppendASCII("certificates")); | 198 .AppendASCII("certificates")); |
200 return true; | 199 return true; |
201 } | 200 } |
202 | 201 |
203 } // namespace net | 202 } // namespace net |
204 | 203 |
OLD | NEW |