| 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 "chrome/browser/safe_browsing/local_two_phase_testserver.h" | 5 #include "chrome/browser/safe_browsing/local_two_phase_testserver.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "net/test/python_utils.h" | 11 #include "net/test/python_utils.h" |
| 12 #include "net/test/spawned_test_server.h" | 12 #include "net/test/spawned_test_server/spawned_test_server.h" |
| 13 | 13 |
| 14 LocalTwoPhaseTestServer::LocalTwoPhaseTestServer() | 14 LocalTwoPhaseTestServer::LocalTwoPhaseTestServer() |
| 15 : net::LocalTestServer(net::SpawnedTestServer::TYPE_HTTP, | 15 : net::LocalTestServer(net::SpawnedTestServer::TYPE_HTTP, |
| 16 net::SpawnedTestServer::kLocalhost, | 16 net::SpawnedTestServer::kLocalhost, |
| 17 base::FilePath()) { | 17 base::FilePath()) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 LocalTwoPhaseTestServer::~LocalTwoPhaseTestServer() {} | 20 LocalTwoPhaseTestServer::~LocalTwoPhaseTestServer() {} |
| 21 | 21 |
| 22 bool LocalTwoPhaseTestServer::GetTestServerPath( | 22 bool LocalTwoPhaseTestServer::GetTestServerPath( |
| 23 base::FilePath* testserver_path) const { | 23 base::FilePath* testserver_path) const { |
| 24 base::FilePath testserver_dir; | 24 base::FilePath testserver_dir; |
| 25 if (!PathService::Get(base::DIR_SOURCE_ROOT, &testserver_dir)) { | 25 if (!PathService::Get(base::DIR_SOURCE_ROOT, &testserver_dir)) { |
| 26 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; | 26 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; |
| 27 return false; | 27 return false; |
| 28 } | 28 } |
| 29 | 29 |
| 30 testserver_dir = testserver_dir | 30 testserver_dir = testserver_dir |
| 31 .Append(FILE_PATH_LITERAL("chrome")) | 31 .Append(FILE_PATH_LITERAL("chrome")) |
| 32 .Append(FILE_PATH_LITERAL("browser")) | 32 .Append(FILE_PATH_LITERAL("browser")) |
| 33 .Append(FILE_PATH_LITERAL("safe_browsing")); | 33 .Append(FILE_PATH_LITERAL("safe_browsing")); |
| 34 | 34 |
| 35 *testserver_path = testserver_dir.Append(FILE_PATH_LITERAL( | 35 *testserver_path = testserver_dir.Append(FILE_PATH_LITERAL( |
| 36 "two_phase_testserver.py")); | 36 "two_phase_testserver.py")); |
| 37 return true; | 37 return true; |
| 38 } | 38 } |
| OLD | NEW |