- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / safe_browsing / local_two_phase_testserver.cc
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.
4
5 #include "chrome/browser/safe_browsing/local_two_phase_testserver.h"
6
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"
13
14 LocalTwoPhaseTestServer::LocalTwoPhaseTestServer()
15     : net::LocalTestServer(net::SpawnedTestServer::TYPE_HTTP,
16                            net::SpawnedTestServer::kLocalhost,
17                            base::FilePath()) {
18 }
19
20 LocalTwoPhaseTestServer::~LocalTwoPhaseTestServer() {}
21
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";
27     return false;
28   }
29
30   testserver_dir = testserver_dir
31       .Append(FILE_PATH_LITERAL("chrome"))
32       .Append(FILE_PATH_LITERAL("browser"))
33       .Append(FILE_PATH_LITERAL("safe_browsing"));
34
35   *testserver_path = testserver_dir.Append(FILE_PATH_LITERAL(
36       "two_phase_testserver.py"));
37   return true;
38 }