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