Remove aura enum from DesktopMediaID to fix desktop mirroring audio (CrOS).
[chromium-blink-merge.git] / chrome / browser / safe_browsing / local_safebrowsing_test_server.cc
blob7a1ced5e9f69744b663ddf520478655b3739e50f
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
3 // found in the LICENSE file.
5 #include "chrome/browser/safe_browsing/local_safebrowsing_test_server.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 LocalSafeBrowsingTestServer::LocalSafeBrowsingTestServer(
16 const base::FilePath& data_file)
17 : net::LocalTestServer(net::SpawnedTestServer::TYPE_HTTP,
18 net::SpawnedTestServer::kLocalhost,
19 base::FilePath()),
20 data_file_(data_file) {
23 LocalSafeBrowsingTestServer::~LocalSafeBrowsingTestServer() {}
25 bool LocalSafeBrowsingTestServer::GetTestServerPath(
26 base::FilePath* testserver_path) const {
27 base::FilePath testserver_dir;
28 if (!PathService::Get(chrome::DIR_TEST_DATA, &testserver_dir)) {
29 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT";
30 return false;
33 testserver_dir = testserver_dir
34 .Append(FILE_PATH_LITERAL("safe_browsing"));
36 *testserver_path = testserver_dir.Append(FILE_PATH_LITERAL(
37 "safe_browsing_testserver.py"));
38 return true;
41 bool LocalSafeBrowsingTestServer::SetPythonPath() const {
42 if (!net::LocalTestServer::SetPythonPath())
43 return false;
45 // Locate the Python code generated by the protocol buffers compiler.
46 base::FilePath pyproto_dir;
47 if (!GetPyProtoPath(&pyproto_dir)) {
48 LOG(ERROR) << "Cannot find pyproto dir for generated code.";
49 return false;
52 AppendToPythonPath(pyproto_dir.AppendASCII("google"));
53 return true;
56 bool LocalSafeBrowsingTestServer::GenerateAdditionalArguments(
57 base::DictionaryValue* arguments) const {
58 arguments->SetString("data-file", data_file_.value());
59 return true;