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" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 bool UITest::enable_dcheck_ = false; | 70 bool UITest::enable_dcheck_ = false; |
71 bool UITest::silent_dump_on_dcheck_ = false; | 71 bool UITest::silent_dump_on_dcheck_ = false; |
72 bool UITest::disable_breakpad_ = false; | 72 bool UITest::disable_breakpad_ = false; |
73 int UITest::timeout_ms_ = 20 * 60 * 1000; | 73 int UITest::timeout_ms_ = 20 * 60 * 1000; |
74 std::wstring UITest::js_flags_ = L""; | 74 std::wstring UITest::js_flags_ = L""; |
75 std::wstring UITest::log_level_ = L""; | 75 std::wstring UITest::log_level_ = L""; |
76 | 76 |
77 // Specify the time (in milliseconds) that the ui_tests should wait before | 77 // Specify the time (in milliseconds) that the ui_tests should wait before |
78 // timing out. This is used to specify longer timeouts when running under Purify | 78 // timing out. This is used to specify longer timeouts when running under Purify |
79 // which requires much more time. | 79 // which requires much more time. |
80 const wchar_t kUiTestTimeout[] = L"ui-test-timeout"; | 80 const char kUiTestTimeout[] = "ui-test-timeout"; |
81 const wchar_t kUiTestActionTimeout[] = L"ui-test-action-timeout"; | 81 const char kUiTestActionTimeout[] = "ui-test-action-timeout"; |
82 const wchar_t kUiTestActionMaxTimeout[] = L"ui-test-action-max-timeout"; | 82 const char kUiTestActionMaxTimeout[] = "ui-test-action-max-timeout"; |
83 const wchar_t kUiTestSleepTimeout[] = L"ui-test-sleep-timeout"; | 83 const char kUiTestSleepTimeout[] = "ui-test-sleep-timeout"; |
84 const wchar_t kUiTestTerminateTimeout[] = L"ui-test-terminate-timeout"; | 84 const char kUiTestTerminateTimeout[] = "ui-test-terminate-timeout"; |
85 | 85 |
86 const wchar_t kExtraChromeFlagsSwitch[] = L"extra-chrome-flags"; | 86 const char kExtraChromeFlagsSwitch[] = "extra-chrome-flags"; |
87 | 87 |
88 // By default error dialogs are hidden, which makes debugging failures in the | 88 // By default error dialogs are hidden, which makes debugging failures in the |
89 // slave process frustrating. By passing this in error dialogs are enabled. | 89 // slave process frustrating. By passing this in error dialogs are enabled. |
90 const wchar_t kEnableErrorDialogs[] = L"enable-errdialogs"; | 90 const char kEnableErrorDialogs[] = "enable-errdialogs"; |
91 | 91 |
92 // Uncomment this line to have the spawned process wait for the debugger to | 92 // Uncomment this line to have the spawned process wait for the debugger to |
93 // attach. This only works on Windows. On posix systems, you can set the | 93 // attach. This only works on Windows. On posix systems, you can set the |
94 // BROWSER_WRAPPER env variable to wrap the browser process. | 94 // BROWSER_WRAPPER env variable to wrap the browser process. |
95 // #define WAIT_FOR_DEBUGGER_ON_OPEN 1 | 95 // #define WAIT_FOR_DEBUGGER_ON_OPEN 1 |
96 | 96 |
97 UITest::UITest() | 97 UITest::UITest() |
98 : testing::Test(), | 98 : testing::Test(), |
99 launch_arguments_(L""), | 99 launch_arguments_(L""), |
100 expected_errors_(0), | 100 expected_errors_(0), |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 WaitForSingleObject(process_info.hProcess, INFINITE); | 301 WaitForSingleObject(process_info.hProcess, INFINITE); |
302 CloseHandle(process_info.hProcess); | 302 CloseHandle(process_info.hProcess); |
303 #else | 303 #else |
304 base::LaunchApp(cmd_line, true, false, NULL); | 304 base::LaunchApp(cmd_line, true, false, NULL); |
305 #endif | 305 #endif |
306 } | 306 } |
307 | 307 |
308 void UITest::StartHttpServer(const FilePath& root_directory) { | 308 void UITest::StartHttpServer(const FilePath& root_directory) { |
309 scoped_ptr<CommandLine> cmd_line(CreateHttpServerCommandLine()); | 309 scoped_ptr<CommandLine> cmd_line(CreateHttpServerCommandLine()); |
310 ASSERT_TRUE(cmd_line.get()); | 310 ASSERT_TRUE(cmd_line.get()); |
311 cmd_line->AppendSwitchWithValue(L"server", L"start"); | 311 cmd_line->AppendSwitchWithValue("server", "start"); |
312 cmd_line->AppendSwitch(L"register_cygwin"); | 312 cmd_line->AppendSwitch("register_cygwin"); |
313 cmd_line->AppendSwitchWithValue(L"root", root_directory.ToWStringHack()); | 313 cmd_line->AppendSwitchWithValue("root", root_directory.ToWStringHack()); |
314 | 314 |
315 // For Windows 7, if we start the lighttpd server on the foreground mode, | 315 // For Windows 7, if we start the lighttpd server on the foreground mode, |
316 // it will mess up with the command window and cause conhost.exe to crash. To | 316 // it will mess up with the command window and cause conhost.exe to crash. To |
317 // work around this, we start the http server on the background mode. | 317 // work around this, we start the http server on the background mode. |
318 #if defined(OS_WIN) | 318 #if defined(OS_WIN) |
319 if (win_util::GetWinVersion() >= win_util::WINVERSION_WIN7) | 319 if (win_util::GetWinVersion() >= win_util::WINVERSION_WIN7) |
320 cmd_line->AppendSwitch(L"run_background"); | 320 cmd_line->AppendSwitch("run_background"); |
321 #endif | 321 #endif |
322 | 322 |
323 RunCommand(*cmd_line.get()); | 323 RunCommand(*cmd_line.get()); |
324 } | 324 } |
325 | 325 |
326 void UITest::StopHttpServer() { | 326 void UITest::StopHttpServer() { |
327 scoped_ptr<CommandLine> cmd_line(CreateHttpServerCommandLine()); | 327 scoped_ptr<CommandLine> cmd_line(CreateHttpServerCommandLine()); |
328 ASSERT_TRUE(cmd_line.get()); | 328 ASSERT_TRUE(cmd_line.get()); |
329 cmd_line->AppendSwitchWithValue(L"server", L"stop"); | 329 cmd_line->AppendSwitchWithValue("server", "stop"); |
330 RunCommand(*cmd_line.get()); | 330 RunCommand(*cmd_line.get()); |
331 } | 331 } |
332 | 332 |
333 void UITest::LaunchBrowser(const CommandLine& arguments, bool clear_profile) { | 333 void UITest::LaunchBrowser(const CommandLine& arguments, bool clear_profile) { |
334 #if defined(OS_POSIX) | 334 #if defined(OS_POSIX) |
335 const char* alternative_userdir = getenv("CHROME_UI_TESTS_USER_DATA_DIR"); | 335 const char* alternative_userdir = getenv("CHROME_UI_TESTS_USER_DATA_DIR"); |
336 #else | 336 #else |
337 const FilePath::StringType::value_type* const alternative_userdir = NULL; | 337 const FilePath::StringType::value_type* const alternative_userdir = NULL; |
338 #endif | 338 #endif |
339 | 339 |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 #else | 1133 #else |
1134 // TODO(port): above code is very Windows-specific; we need to | 1134 // TODO(port): above code is very Windows-specific; we need to |
1135 // figure out and abstract out how we'll handle finding any existing | 1135 // figure out and abstract out how we'll handle finding any existing |
1136 // running process, etc. on other platforms. | 1136 // running process, etc. on other platforms. |
1137 NOTIMPLEMENTED(); | 1137 NOTIMPLEMENTED(); |
1138 #endif | 1138 #endif |
1139 } | 1139 } |
1140 | 1140 |
1141 return true; | 1141 return true; |
1142 } | 1142 } |
OLD | NEW |