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
3 // found in the LICENSE file.
5 #include "chrome/browser/safe_browsing/local_two_phase_testserver.h"
7 #include "base/command_line.h"
8 #include "base/path_service.h"
9 #include "base/strings/string_number_conversions.h"
10 #include "base/values.h"
11 #include "chrome/common/chrome_paths.h"
12 #include "net/test/python_utils.h"
13 #include "net/test/spawned_test_server/spawned_test_server.h"
15 LocalTwoPhaseTestServer::LocalTwoPhaseTestServer()
16 : net::LocalTestServer(net::SpawnedTestServer::TYPE_HTTP
,
17 net::SpawnedTestServer::kLocalhost
,
21 LocalTwoPhaseTestServer::~LocalTwoPhaseTestServer() {}
23 bool LocalTwoPhaseTestServer::GetTestServerPath(
24 base::FilePath
* testserver_path
) const {
25 base::FilePath testserver_dir
;
26 if (!PathService::Get(chrome::DIR_TEST_DATA
, &testserver_dir
)) {
27 LOG(ERROR
) << "Failed to get DIR_TEST_DATA";
31 testserver_dir
= testserver_dir
32 .Append(FILE_PATH_LITERAL("safe_browsing"));
34 *testserver_path
= testserver_dir
.Append(FILE_PATH_LITERAL(
35 "two_phase_testserver.py"));