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 "net/test/python_utils.h"
12 #include "net/test/spawned_test_server/spawned_test_server.h"
14 LocalTwoPhaseTestServer::LocalTwoPhaseTestServer()
15 : net::LocalTestServer(net::SpawnedTestServer::TYPE_HTTP
,
16 net::SpawnedTestServer::kLocalhost
,
20 LocalTwoPhaseTestServer::~LocalTwoPhaseTestServer() {}
22 bool LocalTwoPhaseTestServer::GetTestServerPath(
23 base::FilePath
* testserver_path
) const {
24 base::FilePath testserver_dir
;
25 if (!PathService::Get(base::DIR_SOURCE_ROOT
, &testserver_dir
)) {
26 LOG(ERROR
) << "Failed to get DIR_SOURCE_ROOT";
30 testserver_dir
= testserver_dir
31 .Append(FILE_PATH_LITERAL("chrome"))
32 .Append(FILE_PATH_LITERAL("browser"))
33 .Append(FILE_PATH_LITERAL("safe_browsing"));
35 *testserver_path
= testserver_dir
.Append(FILE_PATH_LITERAL(
36 "two_phase_testserver.py"));