1 // Copyright 2014 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/chromeos/login/test/https_forwarder.h"
7 #include "base/base_paths.h"
8 #include "base/files/file_path.h"
9 #include "base/path_service.h"
10 #include "base/values.h"
11 #include "net/test/python_utils.h"
15 HTTPSForwarder::HTTPSForwarder(const GURL
& forward_target
)
16 : net::LocalTestServer(net::LocalTestServer::TYPE_HTTPS
,
17 net::LocalTestServer::kLocalhost
,
19 forward_target_(forward_target
) {
22 HTTPSForwarder::~HTTPSForwarder() {
25 bool HTTPSForwarder::SetPythonPath() const {
26 if (!net::LocalTestServer::SetPythonPath())
29 base::FilePath net_testserver_path
;
30 if (!LocalTestServer::GetTestServerPath(&net_testserver_path
))
32 AppendToPythonPath(net_testserver_path
.DirName());
37 bool HTTPSForwarder::GetTestServerPath(base::FilePath
* testserver_path
) const {
38 base::FilePath source_root_dir
;
39 if (!PathService::Get(base::DIR_SOURCE_ROOT
, &source_root_dir
))
42 *testserver_path
= source_root_dir
.Append("chrome")
47 .Append("https_forwarder.py");
51 bool HTTPSForwarder::GenerateAdditionalArguments(
52 base::DictionaryValue
* arguments
) const {
53 base::FilePath source_root_dir
;
54 if (!net::LocalTestServer::GenerateAdditionalArguments(arguments
) ||
55 !PathService::Get(base::DIR_SOURCE_ROOT
, &source_root_dir
))
58 arguments
->SetString("forward-target", forward_target_
.spec());
62 } // namespace chromeos