| 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/local_test_server.h" | 5 #include "net/test/local_test_server.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 base::CloseProcessHandle(process_handle_); | 133 base::CloseProcessHandle(process_handle_); |
| 134 process_handle_ = base::kNullProcessHandle; | 134 process_handle_ = base::kNullProcessHandle; |
| 135 } else { | 135 } else { |
| 136 VLOG(1) << "Kill failed?"; | 136 VLOG(1) << "Kill failed?"; |
| 137 } | 137 } |
| 138 | 138 |
| 139 return ret; | 139 return ret; |
| 140 } | 140 } |
| 141 | 141 |
| 142 bool LocalTestServer::Init(const base::FilePath& document_root) { | 142 bool LocalTestServer::Init(const base::FilePath& document_root) { |
| 143 if (document_root.IsAbsolute()) | 143 if (!document_root.IsAbsolute()) |
| 144 return false; | 144 return false; |
| 145 | 145 |
| 146 // At this point, the port that the test server will listen on is unknown. | 146 // At this point, the port that the test server will listen on is unknown. |
| 147 // The test server will listen on an ephemeral port, and write the port | 147 // The test server will listen on an ephemeral port, and write the port |
| 148 // number out over a pipe that this TestServer object will read from. Once | 148 // number out over a pipe that this TestServer object will read from. Once |
| 149 // that is complete, the host port pair will contain the actual port. | 149 // that is complete, the host port pair will contain the actual port. |
| 150 DCHECK(!GetPort()); | 150 DCHECK(!GetPort()); |
| 151 process_handle_ = base::kNullProcessHandle; | 151 process_handle_ = base::kNullProcessHandle; |
| 152 | 152 |
| 153 base::FilePath src_dir; | 153 base::FilePath src_dir; |
| 154 if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)) | 154 if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)) |
| 155 return false; | 155 return false; |
| 156 SetResourcePath(src_dir.Append(document_root), | 156 SetResourcePath(document_root, |
| 157 src_dir.AppendASCII("net") | 157 src_dir.AppendASCII("net") |
| 158 .AppendASCII("data") | 158 .AppendASCII("data") |
| 159 .AppendASCII("ssl") | 159 .AppendASCII("ssl") |
| 160 .AppendASCII("certificates")); | 160 .AppendASCII("certificates")); |
| 161 return true; | 161 return true; |
| 162 } | 162 } |
| 163 | 163 |
| 164 bool LocalTestServer::SetPythonPath() const { | 164 bool LocalTestServer::SetPythonPath() const { |
| 165 base::FilePath third_party_dir; | 165 base::FilePath third_party_dir; |
| 166 if (!PathService::Get(base::DIR_SOURCE_ROOT, &third_party_dir)) { | 166 if (!PathService::Get(base::DIR_SOURCE_ROOT, &third_party_dir)) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 break; | 250 break; |
| 251 default: | 251 default: |
| 252 NOTREACHED(); | 252 NOTREACHED(); |
| 253 return false; | 253 return false; |
| 254 } | 254 } |
| 255 | 255 |
| 256 return true; | 256 return true; |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace net | 259 } // namespace net |
| OLD | NEW |