OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_safebrowsing_test_server.h" | 5 #include "chrome/browser/safe_browsing/local_safebrowsing_test_server.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/test_server.h" | 12 #include "net/test/test_server.h" |
13 | 13 |
14 LocalSafeBrowsingTestServer::LocalSafeBrowsingTestServer( | 14 LocalSafeBrowsingTestServer::LocalSafeBrowsingTestServer( |
15 const base::FilePath& data_file) | 15 const base::FilePath& data_file) |
16 : net::LocalTestServer(net::TestServer::TYPE_HTTP, | 16 : net::LocalTestServer(net::TestServer::TYPE_HTTP, |
17 net::TestServer::kLocalhost, | 17 net::TestServer::kLocalhost, |
18 base::FilePath()), | 18 GetSourcePath()), |
19 data_file_(data_file) { | 19 data_file_(data_file) { |
20 } | 20 } |
21 | 21 |
22 LocalSafeBrowsingTestServer::~LocalSafeBrowsingTestServer() {} | 22 LocalSafeBrowsingTestServer::~LocalSafeBrowsingTestServer() {} |
23 | 23 |
24 bool LocalSafeBrowsingTestServer::GetTestServerPath( | 24 bool LocalSafeBrowsingTestServer::GetTestServerPath( |
25 base::FilePath* testserver_path) const { | 25 base::FilePath* testserver_path) const { |
26 base::FilePath testserver_dir; | 26 base::FilePath testserver_dir; |
27 if (!PathService::Get(base::DIR_SOURCE_ROOT, &testserver_dir)) { | 27 if (!PathService::Get(base::DIR_SOURCE_ROOT, &testserver_dir)) { |
28 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; | 28 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; |
(...skipping 23 matching lines...) Expand all Loading... |
52 | 52 |
53 AppendToPythonPath(pyproto_dir.AppendASCII("google")); | 53 AppendToPythonPath(pyproto_dir.AppendASCII("google")); |
54 return true; | 54 return true; |
55 } | 55 } |
56 | 56 |
57 bool LocalSafeBrowsingTestServer::GenerateAdditionalArguments( | 57 bool LocalSafeBrowsingTestServer::GenerateAdditionalArguments( |
58 base::DictionaryValue* arguments) const { | 58 base::DictionaryValue* arguments) const { |
59 arguments->SetString("data-file", data_file_.value()); | 59 arguments->SetString("data-file", data_file_.value()); |
60 return true; | 60 return true; |
61 } | 61 } |
OLD | NEW |