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 "content/test/layout_test_http_server.h" | 5 #include "content/test/layout_test_http_server.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "content/public/common/content_paths.h" | 12 #include "content/public/common/content_paths.h" |
13 #include "net/test/python_utils.h" | 13 #include "net/test/python_utils.h" |
14 | 14 |
15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
16 #include "base/win/windows_version.h" | 16 #include "base/win/windows_version.h" |
17 #endif | 17 #endif |
18 | 18 |
| 19 namespace content { |
19 namespace { | 20 namespace { |
20 | 21 |
21 bool PrepareCommandLine(CommandLine* cmd_line) { | 22 bool PrepareCommandLine(CommandLine* cmd_line) { |
22 FilePath src_path; | 23 FilePath src_path; |
23 if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_path)) | 24 if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_path)) |
24 return false; | 25 return false; |
25 | 26 |
26 if (!GetPythonCommand(cmd_line)) | 27 if (!GetPythonCommand(cmd_line)) |
27 return false; | 28 return false; |
28 | 29 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 CommandLine cmd_line(CommandLine::NO_PROGRAM); | 61 CommandLine cmd_line(CommandLine::NO_PROGRAM); |
61 if (!PrepareCommandLine(&cmd_line)) | 62 if (!PrepareCommandLine(&cmd_line)) |
62 return false; | 63 return false; |
63 cmd_line.AppendArg("--server=start"); | 64 cmd_line.AppendArg("--server=start"); |
64 cmd_line.AppendArg("--register_cygwin"); | 65 cmd_line.AppendArg("--register_cygwin"); |
65 cmd_line.AppendArgNative(FILE_PATH_LITERAL("--root=") + | 66 cmd_line.AppendArgNative(FILE_PATH_LITERAL("--root=") + |
66 root_directory_.value()); | 67 root_directory_.value()); |
67 cmd_line.AppendArg("--port=" + base::IntToString(port_)); | 68 cmd_line.AppendArg("--port=" + base::IntToString(port_)); |
68 | 69 |
69 FilePath layout_tests_dir; | 70 FilePath layout_tests_dir; |
70 if (!PathService::Get(content::DIR_LAYOUT_TESTS, &layout_tests_dir)) | 71 if (!PathService::Get(DIR_LAYOUT_TESTS, &layout_tests_dir)) |
71 return false; | 72 return false; |
72 cmd_line.AppendArgNative(FILE_PATH_LITERAL("--layout_tests_dir=") + | 73 cmd_line.AppendArgNative(FILE_PATH_LITERAL("--layout_tests_dir=") + |
73 layout_tests_dir.value()); | 74 layout_tests_dir.value()); |
74 | 75 |
75 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
76 // For Windows 7, if we start the lighttpd server on the foreground mode, | 77 // For Windows 7, if we start the lighttpd server on the foreground mode, |
77 // it will mess up with the command window and cause conhost.exe to crash. To | 78 // it will mess up with the command window and cause conhost.exe to crash. To |
78 // work around this, we start the http server on the background mode. | 79 // work around this, we start the http server on the background mode. |
79 if (base::win::GetVersion() >= base::win::VERSION_WIN7) | 80 if (base::win::GetVersion() >= base::win::VERSION_WIN7) |
80 cmd_line.AppendArg("--run_background"); | 81 cmd_line.AppendArg("--run_background"); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 running_ = !stopped; | 124 running_ = !stopped; |
124 | 125 |
125 #if defined(OS_WIN) | 126 #if defined(OS_WIN) |
126 // Close the job object handle now. This should clean up | 127 // Close the job object handle now. This should clean up |
127 // any orphaned processes. | 128 // any orphaned processes. |
128 job_handle_.Close(); | 129 job_handle_.Close(); |
129 #endif | 130 #endif |
130 | 131 |
131 return stopped; | 132 return stopped; |
132 } | 133 } |
| 134 |
| 135 } // namespace content |
OLD | NEW |