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 "app/sql/connection.h" | 10 #include "app/sql/connection.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // slave process frustrating. By passing this in error dialogs are enabled. | 90 // slave process frustrating. By passing this in error dialogs are enabled. |
91 const char kEnableErrorDialogs[] = "enable-errdialogs"; | 91 const char kEnableErrorDialogs[] = "enable-errdialogs"; |
92 | 92 |
93 // Uncomment this line to have the spawned process wait for the debugger to | 93 // Uncomment this line to have the spawned process wait for the debugger to |
94 // attach. This only works on Windows. On posix systems, you can set the | 94 // attach. This only works on Windows. On posix systems, you can set the |
95 // BROWSER_WRAPPER env variable to wrap the browser process. | 95 // BROWSER_WRAPPER env variable to wrap the browser process. |
96 // #define WAIT_FOR_DEBUGGER_ON_OPEN 1 | 96 // #define WAIT_FOR_DEBUGGER_ON_OPEN 1 |
97 | 97 |
98 UITest::UITest() | 98 UITest::UITest() |
99 : testing::Test(), | 99 : testing::Test(), |
100 launch_arguments_(L""), | 100 launch_arguments_(CommandLine::ARGUMENTS_ONLY), |
101 expected_errors_(0), | 101 expected_errors_(0), |
102 expected_crashes_(0), | 102 expected_crashes_(0), |
103 homepage_(L"about:blank"), | 103 homepage_(L"about:blank"), |
104 wait_for_initial_loads_(true), | 104 wait_for_initial_loads_(true), |
105 dom_automation_enabled_(false), | 105 dom_automation_enabled_(false), |
106 process_(0), // NULL on Windows, 0 PID on POSIX. | 106 process_(0), // NULL on Windows, 0 PID on POSIX. |
107 process_id_(-1), | 107 process_id_(-1), |
108 show_window_(false), | 108 show_window_(false), |
109 clear_profile_(true), | 109 clear_profile_(true), |
110 include_testing_id_(true), | 110 include_testing_id_(true), |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 static CommandLine* CreatePythonCommandLine() { | 250 static CommandLine* CreatePythonCommandLine() { |
251 #if defined(OS_WIN) | 251 #if defined(OS_WIN) |
252 // Get path to python interpreter | 252 // Get path to python interpreter |
253 FilePath python_runtime; | 253 FilePath python_runtime; |
254 if (!PathService::Get(base::DIR_SOURCE_ROOT, &python_runtime)) | 254 if (!PathService::Get(base::DIR_SOURCE_ROOT, &python_runtime)) |
255 return NULL; | 255 return NULL; |
256 python_runtime = python_runtime | 256 python_runtime = python_runtime |
257 .Append(FILE_PATH_LITERAL("third_party")) | 257 .Append(FILE_PATH_LITERAL("third_party")) |
258 .Append(FILE_PATH_LITERAL("python_24")) | 258 .Append(FILE_PATH_LITERAL("python_24")) |
259 .Append(FILE_PATH_LITERAL("python.exe")); | 259 .Append(FILE_PATH_LITERAL("python.exe")); |
260 return new CommandLine(python_runtime.ToWStringHack()); | 260 return new CommandLine(python_runtime); |
261 #elif defined(OS_POSIX) | 261 #elif defined(OS_POSIX) |
262 return new CommandLine(L"python"); | 262 return new CommandLine(FilePath("python")); |
263 #endif | 263 #endif |
264 } | 264 } |
265 | 265 |
266 static CommandLine* CreateHttpServerCommandLine() { | 266 static CommandLine* CreateHttpServerCommandLine() { |
267 FilePath src_path; | 267 FilePath src_path; |
268 // Get to 'src' dir. | 268 // Get to 'src' dir. |
269 PathService::Get(base::DIR_SOURCE_ROOT, &src_path); | 269 PathService::Get(base::DIR_SOURCE_ROOT, &src_path); |
270 | 270 |
271 FilePath script_path(src_path); | 271 FilePath script_path(src_path); |
272 script_path = script_path.AppendASCII("webkit"); | 272 script_path = script_path.AppendASCII("webkit"); |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 } | 1003 } |
1004 } | 1004 } |
1005 if (delete_generated_file) | 1005 if (delete_generated_file) |
1006 EXPECT_TRUE(file_util::DieFileDie(generated_file, false)); | 1006 EXPECT_TRUE(file_util::DieFileDie(generated_file, false)); |
1007 } | 1007 } |
1008 | 1008 |
1009 bool UITest::LaunchBrowserHelper(const CommandLine& arguments, | 1009 bool UITest::LaunchBrowserHelper(const CommandLine& arguments, |
1010 bool use_existing_browser, | 1010 bool use_existing_browser, |
1011 bool wait, | 1011 bool wait, |
1012 base::ProcessHandle* process) { | 1012 base::ProcessHandle* process) { |
1013 FilePath command = browser_directory_; | 1013 FilePath command = browser_directory_.Append( |
1014 command = command.Append(FilePath::FromWStringHack( | 1014 FilePath::FromWStringHack(chrome::kBrowserProcessExecutablePath)); |
1015 chrome::kBrowserProcessExecutablePath)); | 1015 CommandLine command_line(command); |
1016 CommandLine command_line(command.ToWStringHack()); | |
1017 | 1016 |
1018 // Add any explicit command line flags passed to the process. | 1017 // Add any explicit command line flags passed to the process. |
1019 std::wstring extra_chrome_flags = | 1018 std::wstring extra_chrome_flags = |
1020 CommandLine::ForCurrentProcess()->GetSwitchValue(kExtraChromeFlagsSwitch); | 1019 CommandLine::ForCurrentProcess()->GetSwitchValue(kExtraChromeFlagsSwitch); |
1021 if (!extra_chrome_flags.empty()) { | 1020 if (!extra_chrome_flags.empty()) { |
1022 // Split by spaces and append to command line | 1021 // Split by spaces and append to command line |
1023 std::vector<std::wstring> flags; | 1022 std::vector<std::wstring> flags; |
1024 SplitString(extra_chrome_flags, ' ', &flags); | 1023 SplitString(extra_chrome_flags, ' ', &flags); |
1025 for (size_t i = 0; i < flags.size(); ++i) | 1024 for (size_t i = 0; i < flags.size(); ++i) |
1026 command_line.AppendLooseValue(flags[i]); | 1025 command_line.AppendLooseValue(flags[i]); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 std::string yesterday_str = Int64ToString(yesterday.ToInternalValue()); | 1171 std::string yesterday_str = Int64ToString(yesterday.ToInternalValue()); |
1173 std::string query = StringPrintf( | 1172 std::string query = StringPrintf( |
1174 "UPDATE segment_usage " | 1173 "UPDATE segment_usage " |
1175 "SET time_slot = %s " | 1174 "SET time_slot = %s " |
1176 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);", | 1175 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);", |
1177 yesterday_str.c_str()); | 1176 yesterday_str.c_str()); |
1178 ASSERT_TRUE(db.Execute(query.c_str())); | 1177 ASSERT_TRUE(db.Execute(query.c_str())); |
1179 db.Close(); | 1178 db.Close(); |
1180 file_util::EvictFileFromSystemCache(history); | 1179 file_util::EvictFileFromSystemCache(history); |
1181 } | 1180 } |
OLD | NEW |