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