Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/platform_thread.h" | 14 #include "base/platform_thread.h" |
| 15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
| 16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/test_file_util.h" | 18 #include "base/test_file_util.h" |
| 19 #include "base/time.h" | 19 #include "base/time.h" |
| 20 #if defined(OS_WIN) | |
|
jam
2009/10/05 19:31:28
nit: I believe we always put the OS specific defin
| |
| 21 #include "base/win_util.h" | |
| 22 #endif | |
| 20 #include "chrome/app/chrome_dll_resource.h" | 23 #include "chrome/app/chrome_dll_resource.h" |
| 21 #include "chrome/browser/net/url_fixer_upper.h" | 24 #include "chrome/browser/net/url_fixer_upper.h" |
| 22 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
| 23 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
| 24 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/debug_flags.h" | 28 #include "chrome/common/debug_flags.h" |
| 26 #include "chrome/common/logging_chrome.h" | 29 #include "chrome/common/logging_chrome.h" |
| 27 #include "chrome/common/json_value_serializer.h" | 30 #include "chrome/common/json_value_serializer.h" |
| 28 #include "chrome/test/automation/automation_messages.h" | 31 #include "chrome/test/automation/automation_messages.h" |
| 29 #include "chrome/test/automation/automation_proxy.h" | 32 #include "chrome/test/automation/automation_proxy.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 base::LaunchApp(cmd_line, true, false, NULL); | 303 base::LaunchApp(cmd_line, true, false, NULL); |
| 301 #endif | 304 #endif |
| 302 } | 305 } |
| 303 | 306 |
| 304 void UITest::StartHttpServer(const FilePath& root_directory) { | 307 void UITest::StartHttpServer(const FilePath& root_directory) { |
| 305 scoped_ptr<CommandLine> cmd_line(CreateHttpServerCommandLine()); | 308 scoped_ptr<CommandLine> cmd_line(CreateHttpServerCommandLine()); |
| 306 ASSERT_TRUE(cmd_line.get()); | 309 ASSERT_TRUE(cmd_line.get()); |
| 307 cmd_line->AppendSwitchWithValue(L"server", L"start"); | 310 cmd_line->AppendSwitchWithValue(L"server", L"start"); |
| 308 cmd_line->AppendSwitch(L"register_cygwin"); | 311 cmd_line->AppendSwitch(L"register_cygwin"); |
| 309 cmd_line->AppendSwitchWithValue(L"root", root_directory.ToWStringHack()); | 312 cmd_line->AppendSwitchWithValue(L"root", root_directory.ToWStringHack()); |
| 313 | |
| 314 // For Windows 7, if we start the lighttpd server on the foreground mode, | |
| 315 // it will mess up with the command window and cause conhost.exe to crash. To | |
| 316 // work around this, we start the http server on the background mode. | |
| 317 #if defined(OS_WIN) | |
| 318 if (win_util::GetWinVersion() >= win_util::WINVERSION_WIN7) | |
| 319 cmd_line->AppendSwitch(L"run_background"); | |
| 320 #endif | |
| 321 | |
| 310 RunCommand(*cmd_line.get()); | 322 RunCommand(*cmd_line.get()); |
| 311 } | 323 } |
| 312 | 324 |
| 313 void UITest::StopHttpServer() { | 325 void UITest::StopHttpServer() { |
| 314 scoped_ptr<CommandLine> cmd_line(CreateHttpServerCommandLine()); | 326 scoped_ptr<CommandLine> cmd_line(CreateHttpServerCommandLine()); |
| 315 ASSERT_TRUE(cmd_line.get()); | 327 ASSERT_TRUE(cmd_line.get()); |
| 316 cmd_line->AppendSwitchWithValue(L"server", L"stop"); | 328 cmd_line->AppendSwitchWithValue(L"server", L"stop"); |
| 317 RunCommand(*cmd_line.get()); | 329 RunCommand(*cmd_line.get()); |
| 318 } | 330 } |
| 319 | 331 |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1123 #else | 1135 #else |
| 1124 // TODO(port): above code is very Windows-specific; we need to | 1136 // TODO(port): above code is very Windows-specific; we need to |
| 1125 // figure out and abstract out how we'll handle finding any existing | 1137 // figure out and abstract out how we'll handle finding any existing |
| 1126 // running process, etc. on other platforms. | 1138 // running process, etc. on other platforms. |
| 1127 NOTIMPLEMENTED(); | 1139 NOTIMPLEMENTED(); |
| 1128 #endif | 1140 #endif |
| 1129 } | 1141 } |
| 1130 | 1142 |
| 1131 return true; | 1143 return true; |
| 1132 } | 1144 } |
| OLD | NEW |