Chromium Code Reviews| Index: net/test/test_server.cc |
| diff --git a/net/test/test_server.cc b/net/test/test_server.cc |
| index f38abfaccd421ad07d0a6cc738ccf8684961a182..1a9c3f9d72dfc1d3006975d541154c355521636a 100644 |
| --- a/net/test/test_server.cc |
| +++ b/net/test/test_server.cc |
| @@ -98,23 +98,32 @@ TestServer::~TestServer() { |
| Stop(); |
| } |
| +FilePath TestServer::GetTestServerDirectory() { |
| + // Get path to python server script. |
| + FilePath testserver_dir; |
| + if (!PathService::Get(base::DIR_SOURCE_ROOT, &testserver_dir)) { |
| + LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; |
| + return FilePath(); |
|
Paweł Hajdan Jr.
2012/03/13 17:15:23
I don't like potentially ambiguous return types. M
tim (not reviewing)
2012/03/15 00:41:40
Done.
|
| + } |
| + |
| + testserver_dir = testserver_dir |
| + .Append(FILE_PATH_LITERAL("net")) |
| + .Append(FILE_PATH_LITERAL("tools")) |
| + .Append(FILE_PATH_LITERAL("testserver")); |
| + return testserver_dir; |
| +} |
| + |
| bool TestServer::Start() { |
| if (type_ == TYPE_HTTPS) { |
| if (!LoadTestRootCert()) |
| return false; |
| } |
| - // Get path to python server script |
| - FilePath testserver_path; |
| - if (!PathService::Get(base::DIR_SOURCE_ROOT, &testserver_path)) { |
| - LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; |
| + FilePath testserver_path(GetTestServerDirectory()); |
| + if (testserver_path.empty()) |
| return false; |
| - } |
| - testserver_path = testserver_path |
| - .Append(FILE_PATH_LITERAL("net")) |
| - .Append(FILE_PATH_LITERAL("tools")) |
| - .Append(FILE_PATH_LITERAL("testserver")) |
| - .Append(FILE_PATH_LITERAL("testserver.py")); |
| + testserver_path = |
| + testserver_path.Append(FILE_PATH_LITERAL("testserver.py")); |
| if (!SetPythonPath()) |
| return false; |