Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: chrome/test/ui/ui_test.cc

Issue 5967003: Refactor UITestBase/ProxyLauncher. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add POD struct to hold some launcher variables. Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #include <signal.h> 8 #include <signal.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #endif 10 #endif
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 #if defined(OS_WIN) 55 #if defined(OS_WIN)
56 #include "base/win/windows_version.h" 56 #include "base/win/windows_version.h"
57 #endif 57 #endif
58 58
59 59
60 using base::Time; 60 using base::Time;
61 using base::TimeDelta; 61 using base::TimeDelta;
62 using base::TimeTicks; 62 using base::TimeTicks;
63 63
64 // Passed as value of kTestType.
65 static const char kUITestType[] = "ui";
66
67 const wchar_t UITestBase::kFailedNoCrashService[] = 64 const wchar_t UITestBase::kFailedNoCrashService[] =
68 #if defined(OS_WIN) 65 #if defined(OS_WIN)
69 L"NOTE: This test is expected to fail if crash_service.exe is not " 66 L"NOTE: This test is expected to fail if crash_service.exe is not "
70 L"running. Start it manually before running this test (see the build " 67 L"running. Start it manually before running this test (see the build "
71 L"output directory)."; 68 L"output directory).";
72 #elif defined(OS_LINUX) 69 #elif defined(OS_LINUX)
73 L"NOTE: This test is expected to fail if breakpad is not built in " 70 L"NOTE: This test is expected to fail if breakpad is not built in "
74 L"or if chromium is not running headless (try CHROME_HEADLESS=1)."; 71 L"or if chromium is not running headless (try CHROME_HEADLESS=1).";
75 #else 72 #else
76 L"NOTE: Crash service not ported to this platform!"; 73 L"NOTE: Crash service not ported to this platform!";
77 #endif 74 #endif
78 bool UITestBase::in_process_renderer_ = false;
79 bool UITestBase::no_sandbox_ = false;
80 bool UITestBase::full_memory_dump_ = false;
81 bool UITestBase::safe_plugins_ = false;
82 bool UITestBase::show_error_dialogs_ = true;
83 bool UITestBase::dump_histograms_on_exit_ = false;
84 bool UITestBase::enable_dcheck_ = false;
85 bool UITestBase::silent_dump_on_dcheck_ = false;
86 bool UITestBase::disable_breakpad_ = false;
87 std::string UITestBase::js_flags_ = "";
88 std::string UITestBase::log_level_ = "";
89 75
90 // Uncomment this line to have the spawned process wait for the debugger to 76 // Uncomment this line to have the spawned process wait for the debugger to
91 // attach. This only works on Windows. On posix systems, you can set the 77 // attach. This only works on Windows. On posix systems, you can set the
92 // BROWSER_WRAPPER env variable to wrap the browser process. 78 // BROWSER_WRAPPER env variable to wrap the browser process.
93 // #define WAIT_FOR_DEBUGGER_ON_OPEN 1 79 // #define WAIT_FOR_DEBUGGER_ON_OPEN 1
94 80
95 UITestBase::UITestBase() 81 UITestBase::UITestBase()
96 : launch_arguments_(CommandLine::NO_PROGRAM), 82 : launch_arguments_(CommandLine::NO_PROGRAM),
97 expected_errors_(0), 83 expected_errors_(0),
98 expected_crashes_(0), 84 expected_crashes_(0),
99 homepage_(chrome::kAboutBlankURL), 85 homepage_(chrome::kAboutBlankURL),
100 wait_for_initial_loads_(true), 86 wait_for_initial_loads_(true),
101 dom_automation_enabled_(false), 87 dom_automation_enabled_(false),
102 process_(base::kNullProcessHandle),
103 process_id_(-1),
104 show_window_(false), 88 show_window_(false),
105 clear_profile_(true), 89 clear_profile_(true),
106 include_testing_id_(true), 90 include_testing_id_(true),
107 enable_file_cookies_(true), 91 enable_file_cookies_(true),
108 profile_type_(UITestBase::DEFAULT_THEME), 92 profile_type_(ProxyLauncher::DEFAULT_THEME),
109 shutdown_type_(UITestBase::WINDOW_CLOSE), 93 shutdown_type_(ProxyLauncher::WINDOW_CLOSE) {
110 temp_profile_dir_(new ScopedTempDir()) {
111 PathService::Get(chrome::DIR_APP, &browser_directory_); 94 PathService::Get(chrome::DIR_APP, &browser_directory_);
112 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); 95 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_);
96 launcher_.reset(CreateProxyLauncher());
113 } 97 }
114 98
115 UITestBase::UITestBase(MessageLoop::Type msg_loop_type) 99 UITestBase::UITestBase(MessageLoop::Type msg_loop_type)
116 : launch_arguments_(CommandLine::NO_PROGRAM), 100 : launch_arguments_(CommandLine::NO_PROGRAM),
117 expected_errors_(0), 101 expected_errors_(0),
118 expected_crashes_(0), 102 expected_crashes_(0),
119 homepage_(chrome::kAboutBlankURL),
120 wait_for_initial_loads_(true), 103 wait_for_initial_loads_(true),
121 dom_automation_enabled_(false), 104 dom_automation_enabled_(false),
122 process_(base::kNullProcessHandle),
123 process_id_(-1),
124 show_window_(false), 105 show_window_(false),
125 clear_profile_(true), 106 clear_profile_(true),
126 include_testing_id_(true), 107 include_testing_id_(true),
127 enable_file_cookies_(true), 108 enable_file_cookies_(true),
128 profile_type_(UITestBase::DEFAULT_THEME), 109 profile_type_(ProxyLauncher::DEFAULT_THEME),
129 shutdown_type_(UITestBase::WINDOW_CLOSE) { 110 shutdown_type_(ProxyLauncher::WINDOW_CLOSE) {
130 PathService::Get(chrome::DIR_APP, &browser_directory_); 111 PathService::Get(chrome::DIR_APP, &browser_directory_);
131 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); 112 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_);
113 launcher_.reset(CreateProxyLauncher());
132 } 114 }
133 115
134 UITestBase::~UITestBase() { 116 UITestBase::~UITestBase() {}
135 }
136 117
137 void UITestBase::SetUp() { 118 void UITestBase::SetUp() {
138 AssertAppNotRunning(L"Please close any other instances " 119 launcher_->AssertAppNotRunning(L"Please close any other instances "
139 L"of the app before testing."); 120 L"of the app before testing.");
140 121
141 JavaScriptExecutionController::set_timeout( 122 JavaScriptExecutionController::set_timeout(
142 TestTimeouts::action_max_timeout_ms()); 123 TestTimeouts::action_max_timeout_ms());
143 test_start_time_ = Time::NowFromSystemTime(); 124 test_start_time_ = Time::NowFromSystemTime();
144 125
145 launcher_.reset(CreateProxyLauncher()); 126 SetLaunchSwitches();
146 launcher_->InitializeConnection(this); 127 launcher_->InitializeConnection(DefaultLaunchState(),
128 wait_for_initial_loads_);
147 } 129 }
148 130
149 void UITestBase::TearDown() { 131 void UITestBase::TearDown() {
150 CloseBrowserAndServer(); 132 CloseBrowserAndServer();
151 133
152 // Make sure that we didn't encounter any assertion failures 134 // Make sure that we didn't encounter any assertion failures
153 logging::AssertionList assertions; 135 logging::AssertionList assertions;
154 logging::GetFatalAssertions(&assertions); 136 logging::GetFatalAssertions(&assertions);
155 137
156 // If there were errors, get all the error strings for display. 138 // If there were errors, get all the error strings for display.
(...skipping 14 matching lines...) Expand all
171 L"Encountered an unexpected crash in the program during this test."; 153 L"Encountered an unexpected crash in the program during this test.";
172 if (expected_crashes_ > 0 && actual_crashes == 0) { 154 if (expected_crashes_ > 0 && actual_crashes == 0) {
173 error_msg += L" "; 155 error_msg += L" ";
174 error_msg += kFailedNoCrashService; 156 error_msg += kFailedNoCrashService;
175 } 157 }
176 EXPECT_EQ(expected_crashes_, actual_crashes) << error_msg; 158 EXPECT_EQ(expected_crashes_, actual_crashes) << error_msg;
177 } 159 }
178 160
179 // TODO(phajdan.jr): get rid of set_command_execution_timeout_ms. 161 // TODO(phajdan.jr): get rid of set_command_execution_timeout_ms.
180 void UITestBase::set_command_execution_timeout_ms(int timeout) { 162 void UITestBase::set_command_execution_timeout_ms(int timeout) {
181 automation_proxy_->set_command_execution_timeout_ms(timeout); 163 automation()->set_command_execution_timeout_ms(timeout);
182 VLOG(1) << "Automation command execution timeout set to " << timeout << " ms"; 164 VLOG(1) << "Automation command execution timeout set to " << timeout << " ms";
183 } 165 }
184 166
185 ProxyLauncher* UITestBase::CreateProxyLauncher() { 167 ProxyLauncher* UITestBase::CreateProxyLauncher() {
186 return new AnonymousProxyLauncher(false); 168 return new AnonymousProxyLauncher(false);
187 } 169 }
188 170
171 void UITestBase::SetLaunchSwitches() {
172 // We need cookies on file:// for things like the page cycler.
173 if (enable_file_cookies_)
174 launch_arguments_.AppendSwitch(switches::kEnableFileCookies);
175 if (dom_automation_enabled_)
176 launch_arguments_.AppendSwitch(switches::kDomAutomationController);
177 if (!homepage_.empty())
178 launch_arguments_.AppendSwitchASCII(switches::kHomePage, homepage_);
179 if (!test_name_.empty())
180 launch_arguments_.AppendSwitchASCII(switches::kTestName, test_name_);
181 }
182
189 void UITestBase::LaunchBrowser() { 183 void UITestBase::LaunchBrowser() {
190 LaunchBrowser(launch_arguments_, clear_profile_); 184 LaunchBrowser(launch_arguments_, clear_profile_);
191 } 185 }
192 186
193 void UITestBase::LaunchBrowserAndServer() { 187 void UITestBase::LaunchBrowserAndServer() {
194 // Set up IPC testing interface as a server. 188 launcher_->LaunchBrowserAndServer(DefaultLaunchState(),
195 automation_proxy_.reset(launcher_->CreateAutomationProxy( 189 wait_for_initial_loads_);
196 TestTimeouts::command_execution_timeout_ms()));
197
198 LaunchBrowser(launch_arguments_, clear_profile_);
199 WaitForBrowserLaunch();
200 } 190 }
201 191
202 void UITestBase::ConnectToRunningBrowser() { 192 void UITestBase::ConnectToRunningBrowser() {
203 // Set up IPC testing interface as a client. 193 launcher_->ConnectToRunningBrowser(wait_for_initial_loads_);
204 automation_proxy_.reset(launcher_->CreateAutomationProxy(
205 TestTimeouts::command_execution_timeout_ms()));
206 WaitForBrowserLaunch();
207 }
208
209 void UITestBase::WaitForBrowserLaunch() {
210 ASSERT_EQ(AUTOMATION_SUCCESS, automation_proxy_->WaitForAppLaunch())
211 << "Error while awaiting automation ping from browser process";
212 if (wait_for_initial_loads_)
213 ASSERT_TRUE(automation_proxy_->WaitForInitialLoads());
214 else
215 base::PlatformThread::Sleep(sleep_timeout_ms());
216
217 EXPECT_TRUE(automation()->SetFilteredInet(ShouldFilterInet()));
218 } 194 }
219 195
220 void UITestBase::CloseBrowserAndServer() { 196 void UITestBase::CloseBrowserAndServer() {
221 QuitBrowser(); 197 launcher_->CloseBrowserAndServer(shutdown_type_);
222 CleanupAppProcesses();
223
224 // Suppress spammy failures that seem to be occurring when running
225 // the UI tests in single-process mode.
226 // TODO(jhughes): figure out why this is necessary at all, and fix it
227 if (!in_process_renderer_)
228 AssertAppNotRunning(StringPrintf(
229 L"Unable to quit all browser processes. Original PID %d", process_id_));
230
231 automation_proxy_.reset(); // Shut down IPC testing interface.
232 } 198 }
233 199
234 void UITestBase::LaunchBrowser(const CommandLine& arguments, 200 void UITestBase::LaunchBrowser(const CommandLine& arguments,
235 bool clear_profile) { 201 bool clear_profile) {
236 if (clear_profile || !temp_profile_dir_->IsValid()) { 202 ProxyLauncher::LaunchState state = DefaultLaunchState();
237 temp_profile_dir_.reset(new ScopedTempDir()); 203 state.clear_profile = clear_profile;
238 ASSERT_TRUE(temp_profile_dir_->CreateUniqueTempDir()); 204 launcher_->LaunchBrowser(state);
239
240 ASSERT_TRUE(
241 test_launcher_utils::OverrideUserDataDir(temp_profile_dir_->path()));
242 }
243
244 if (!template_user_data_.empty()) {
245 // Recursively copy the template directory to the user_data_dir.
246 ASSERT_TRUE(file_util::CopyRecursiveDirNoCache(
247 template_user_data_,
248 user_data_dir()));
249 // If we're using the complex theme data, we need to write the
250 // user_data_dir_ to our preferences file.
251 if (profile_type_ == UITestBase::COMPLEX_THEME) {
252 RewritePreferencesFile(user_data_dir());
253 }
254
255 // Update the history file to include recent dates.
256 UpdateHistoryDates();
257 }
258
259 ASSERT_TRUE(LaunchBrowserHelper(arguments, false, &process_));
260 process_id_ = base::GetProcId(process_);
261 } 205 }
262 206
263 #if !defined(OS_MACOSX) 207 #if !defined(OS_MACOSX)
264 bool UITestBase::LaunchAnotherBrowserBlockUntilClosed( 208 bool UITestBase::LaunchAnotherBrowserBlockUntilClosed(
265 const CommandLine& cmdline) { 209 const CommandLine& cmdline) {
266 return LaunchBrowserHelper(cmdline, true, NULL); 210 ProxyLauncher::LaunchState state = DefaultLaunchState();
211 state.arguments = cmdline;
212 return launcher_->LaunchAnotherBrowserBlockUntilClosed(state);
267 } 213 }
268 #endif 214 #endif
269 215
270 void UITestBase::QuitBrowser() { 216 void UITestBase::QuitBrowser() {
271 if (SESSION_ENDING == shutdown_type_) { 217 launcher_->QuitBrowser(shutdown_type_);
272 TerminateBrowser();
273 return;
274 }
275
276 // There's nothing to do here if the browser is not running.
277 // WARNING: There is a race condition here where the browser may shut down
278 // after this check but before some later automation call. Your test should
279 // use WaitForBrowserProcessToQuit() if it intentionally
280 // causes the browser to shut down.
281 if (IsBrowserRunning()) {
282 TimeTicks quit_start = TimeTicks::Now();
283 EXPECT_TRUE(automation()->SetFilteredInet(false));
284
285 if (WINDOW_CLOSE == shutdown_type_) {
286 int window_count = 0;
287 EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count));
288
289 // Synchronously close all but the last browser window. Closing them
290 // one-by-one may help with stability.
291 while (window_count > 1) {
292 scoped_refptr<BrowserProxy> browser_proxy =
293 automation()->GetBrowserWindow(0);
294 EXPECT_TRUE(browser_proxy.get());
295 if (browser_proxy.get()) {
296 EXPECT_TRUE(browser_proxy->RunCommand(IDC_CLOSE_WINDOW));
297 EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count));
298 } else {
299 break;
300 }
301 }
302
303 // Close the last window asynchronously, because the browser may
304 // shutdown faster than it will be able to send a synchronous response
305 // to our message.
306 scoped_refptr<BrowserProxy> browser_proxy =
307 automation()->GetBrowserWindow(0);
308 EXPECT_TRUE(browser_proxy.get());
309 if (browser_proxy.get()) {
310 EXPECT_TRUE(browser_proxy->ApplyAccelerator(IDC_CLOSE_WINDOW));
311 browser_proxy = NULL;
312 }
313 } else if (USER_QUIT == shutdown_type_) {
314 scoped_refptr<BrowserProxy> browser_proxy =
315 automation()->GetBrowserWindow(0);
316 EXPECT_TRUE(browser_proxy.get());
317 if (browser_proxy.get()) {
318 EXPECT_TRUE(browser_proxy->RunCommandAsync(IDC_EXIT));
319 }
320 } else {
321 NOTREACHED() << "Invalid shutdown type " << shutdown_type_;
322 }
323
324 // Now, drop the automation IPC channel so that the automation provider in
325 // the browser notices and drops its reference to the browser process.
326 automation()->Disconnect();
327
328 // Wait for the browser process to quit. It should quit once all tabs have
329 // been closed.
330 if (!WaitForBrowserProcessToQuit()) {
331 // We need to force the browser to quit because it didn't quit fast
332 // enough. Take no chance and kill every chrome processes.
333 CleanupAppProcesses();
334 }
335 browser_quit_time_ = TimeTicks::Now() - quit_start;
336 }
337
338 // Don't forget to close the handle
339 base::CloseProcessHandle(process_);
340 process_ = base::kNullProcessHandle;
341 process_id_ = -1;
342 } 218 }
343 219
344 void UITestBase::TerminateBrowser() { 220 void UITestBase::TerminateBrowser() {
345 if (IsBrowserRunning()) { 221 launcher_->TerminateBrowser();
346 TimeTicks quit_start = TimeTicks::Now();
347 EXPECT_TRUE(automation()->SetFilteredInet(false));
348 #if defined(OS_WIN)
349 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
350 ASSERT_TRUE(browser.get());
351 ASSERT_TRUE(browser->TerminateSession());
352 #endif // defined(OS_WIN)
353
354 // Now, drop the automation IPC channel so that the automation provider in
355 // the browser notices and drops its reference to the browser process.
356 automation()->Disconnect();
357
358 #if defined(OS_POSIX)
359 EXPECT_EQ(kill(process_, SIGTERM), 0);
360 #endif // OS_POSIX
361
362 if (!WaitForBrowserProcessToQuit()) {
363 // We need to force the browser to quit because it didn't quit fast
364 // enough. Take no chance and kill every chrome processes.
365 CleanupAppProcesses();
366 }
367 browser_quit_time_ = TimeTicks::Now() - quit_start;
368 }
369
370 // Don't forget to close the handle
371 base::CloseProcessHandle(process_);
372 process_ = base::kNullProcessHandle;
373 process_id_ = -1;
374 }
375
376 void UITestBase::AssertAppNotRunning(const std::wstring& error_message) {
377 std::wstring final_error_message(error_message);
378
379 ChromeProcessList processes = GetRunningChromeProcesses(process_id_);
380 if (!processes.empty()) {
381 final_error_message += L" Leftover PIDs: [";
382 for (ChromeProcessList::const_iterator it = processes.begin();
383 it != processes.end(); ++it) {
384 final_error_message += StringPrintf(L" %d", *it);
385 }
386 final_error_message += L" ]";
387 }
388 ASSERT_TRUE(processes.empty()) << final_error_message;
389 } 222 }
390 223
391 void UITestBase::CleanupAppProcesses() { 224 void UITestBase::CleanupAppProcesses() {
392 TerminateAllChromeProcesses(process_id_); 225 TerminateAllChromeProcesses(browser_process_id());
393 } 226 }
394 227
395 scoped_refptr<TabProxy> UITestBase::GetActiveTab(int window_index) { 228 scoped_refptr<TabProxy> UITestBase::GetActiveTab(int window_index) {
396 EXPECT_GE(window_index, 0); 229 EXPECT_GE(window_index, 0);
397 int window_count = -1; 230 int window_count = -1;
398 // We have to use EXPECT rather than ASSERT here because ASSERT_* only works 231 // We have to use EXPECT rather than ASSERT here because ASSERT_* only works
399 // in functions that return void. 232 // in functions that return void.
400 EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count)); 233 EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count));
401 if (window_count == -1) 234 if (window_count == -1)
402 return NULL; 235 return NULL;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 scoped_refptr<BrowserProxy> window = 290 scoped_refptr<BrowserProxy> window =
458 automation()->GetBrowserWindow(window_index); 291 automation()->GetBrowserWindow(window_index);
459 ASSERT_TRUE(window.get()); 292 ASSERT_TRUE(window.get());
460 scoped_refptr<TabProxy> tab_proxy(window->GetTab(tab_index)); 293 scoped_refptr<TabProxy> tab_proxy(window->GetTab(tab_index));
461 ASSERT_TRUE(tab_proxy.get()); 294 ASSERT_TRUE(tab_proxy.get());
462 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 295 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
463 tab_proxy->NavigateToURLBlockUntilNavigationsComplete( 296 tab_proxy->NavigateToURLBlockUntilNavigationsComplete(
464 url, number_of_navigations)) << url.spec(); 297 url, number_of_navigations)) << url.spec();
465 } 298 }
466 299
467 bool UITestBase::WaitForBrowserProcessToQuit() { 300 bool UITestBase::WaitForBrowserProcessToQuit(int timeout) {
468 // Wait for the browser process to quit. 301 return launcher_->WaitForBrowserProcessToQuit(timeout);
469 int timeout = TestTimeouts::wait_for_terminate_timeout_ms();
470 #ifdef WAIT_FOR_DEBUGGER_ON_OPEN
471 timeout = 500000;
472 #endif
473 return base::WaitForSingleProcess(process_, timeout);
474 } 302 }
475 303
476 bool UITestBase::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, 304 bool UITestBase::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser,
477 bool wait_for_open) { 305 bool wait_for_open) {
478 const int kCycles = 10; 306 const int kCycles = 10;
479 for (int i = 0; i < kCycles; i++) { 307 for (int i = 0; i < kCycles; i++) {
480 bool visible = false; 308 bool visible = false;
481 bool animating = true; 309 bool animating = true;
482 if (!browser->GetBookmarkBarVisibility(&visible, &animating)) 310 if (!browser->GetBookmarkBarVisibility(&visible, &animating))
483 return false; // Some error. 311 return false; // Some error.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 EXPECT_TRUE(window_proxy.get()); 354 EXPECT_TRUE(window_proxy.get());
527 if (!window_proxy.get()) 355 if (!window_proxy.get())
528 return -1; 356 return -1;
529 357
530 int active_tab_index = -1; 358 int active_tab_index = -1;
531 EXPECT_TRUE(window_proxy->GetActiveTabIndex(&active_tab_index)); 359 EXPECT_TRUE(window_proxy->GetActiveTabIndex(&active_tab_index));
532 return active_tab_index; 360 return active_tab_index;
533 } 361 }
534 362
535 bool UITestBase::IsBrowserRunning() { 363 bool UITestBase::IsBrowserRunning() {
536 return CrashAwareSleep(0); 364 return launcher_->IsBrowserRunning();
537 } 365 }
538 366
539 bool UITestBase::CrashAwareSleep(int time_out_ms) { 367 bool UITestBase::CrashAwareSleep(int timeout_ms) {
540 return base::CrashAwareSleep(process_, time_out_ms); 368 return launcher_->CrashAwareSleep(timeout_ms);
541 } 369 }
542 370
543 int UITestBase::GetTabCount() { 371 int UITestBase::GetTabCount() {
544 return GetTabCount(0); 372 return GetTabCount(0);
545 } 373 }
546 374
547 int UITestBase::GetTabCount(int window_index) { 375 int UITestBase::GetTabCount(int window_index) {
548 scoped_refptr<BrowserProxy> window( 376 scoped_refptr<BrowserProxy> window(
549 automation()->GetBrowserWindow(window_index)); 377 automation()->GetBrowserWindow(window_index));
550 EXPECT_TRUE(window.get()); 378 EXPECT_TRUE(window.get());
(...skipping 27 matching lines...) Expand all
578 EXPECT_TRUE(tab_proxy.get()); 406 EXPECT_TRUE(tab_proxy.get());
579 if (!tab_proxy.get()) 407 if (!tab_proxy.get())
580 return FilePath(); 408 return FilePath();
581 409
582 FilePath download_directory; 410 FilePath download_directory;
583 EXPECT_TRUE(tab_proxy->GetDownloadDirectory(&download_directory)); 411 EXPECT_TRUE(tab_proxy->GetDownloadDirectory(&download_directory));
584 return download_directory; 412 return download_directory;
585 } 413 }
586 414
587 void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const { 415 void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const {
588 ASSERT_TRUE(automation_proxy_->Send( 416 ASSERT_TRUE(automation()->Send(
589 new AutomationMsg_CloseBrowserRequestAsync(browser->handle()))); 417 new AutomationMsg_CloseBrowserRequestAsync(browser->handle())));
590 } 418 }
591 419
592 bool UITestBase::CloseBrowser(BrowserProxy* browser, 420 bool UITestBase::CloseBrowser(BrowserProxy* browser,
593 bool* application_closed) const { 421 bool* application_closed) const {
594 DCHECK(application_closed); 422 DCHECK(application_closed);
595 if (!browser->is_valid() || !browser->handle()) 423 if (!browser->is_valid() || !browser->handle())
596 return false; 424 return false;
597 425
598 bool result = true; 426 bool result = true;
599 427
600 bool succeeded = automation_proxy_->Send(new AutomationMsg_CloseBrowser( 428 bool succeeded = automation()->Send(new AutomationMsg_CloseBrowser(
601 browser->handle(), &result, application_closed)); 429 browser->handle(), &result, application_closed));
602 430
603 if (!succeeded) 431 if (!succeeded)
604 return false; 432 return false;
605 433
606 if (*application_closed) { 434 if (*application_closed) {
607 // Let's wait until the process dies (if it is not gone already). 435 // Let's wait until the process dies (if it is not gone already).
608 bool success = base::WaitForSingleProcess(process_, base::kNoTimeout); 436 bool success = base::WaitForSingleProcess(process(), base::kNoTimeout);
609 EXPECT_TRUE(success); 437 EXPECT_TRUE(success);
610 } 438 }
611 439
612 return result; 440 return result;
613 } 441 }
614 442
615 // static 443 // static
616 void UITestBase::RewritePreferencesFile(const FilePath& user_data_dir) { 444 FilePath UITestBase::ComputeTypicalUserDataSource(
617 const FilePath pref_template_path( 445 ProxyLauncher::ProfileType profile_type) {
618 user_data_dir.AppendASCII("Default").AppendASCII("PreferencesTemplate"));
619 const FilePath pref_path(
620 user_data_dir.AppendASCII("Default").AppendASCII("Preferences"));
621
622 // Read in preferences template.
623 std::string pref_string;
624 EXPECT_TRUE(file_util::ReadFileToString(pref_template_path, &pref_string));
625 string16 format_string = ASCIIToUTF16(pref_string);
626
627 // Make sure temp directory has the proper format for writing to prefs file.
628 #if defined(OS_POSIX)
629 std::wstring user_data_dir_w(ASCIIToWide(user_data_dir.value()));
630 #elif defined(OS_WIN)
631 std::wstring user_data_dir_w(user_data_dir.value());
632 // In Windows, the FilePath will write '\' for the path separators; change
633 // these to a separator that won't trigger escapes.
634 std::replace(user_data_dir_w.begin(),
635 user_data_dir_w.end(), '\\', '/');
636 #endif
637
638 // Rewrite prefs file.
639 std::vector<string16> subst;
640 subst.push_back(WideToUTF16(user_data_dir_w));
641 const std::string prefs_string =
642 UTF16ToASCII(ReplaceStringPlaceholders(format_string, subst, NULL));
643 EXPECT_TRUE(file_util::WriteFile(pref_path, prefs_string.c_str(),
644 prefs_string.size()));
645 file_util::EvictFileFromSystemCache(pref_path);
646 }
647
648 FilePath UITestBase::user_data_dir() const {
649 EXPECT_TRUE(temp_profile_dir_->IsValid());
650 return temp_profile_dir_->path();
651 }
652
653 // static
654 FilePath UITestBase::ComputeTypicalUserDataSource(ProfileType profile_type) {
655 FilePath source_history_file; 446 FilePath source_history_file;
656 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, 447 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA,
657 &source_history_file)); 448 &source_history_file));
658 source_history_file = source_history_file.AppendASCII("profiles"); 449 source_history_file = source_history_file.AppendASCII("profiles");
659 switch (profile_type) { 450 switch (profile_type) {
660 case UITestBase::DEFAULT_THEME: 451 case ProxyLauncher::DEFAULT_THEME:
661 source_history_file = source_history_file.AppendASCII("typical_history"); 452 source_history_file = source_history_file.AppendASCII("typical_history");
662 break; 453 break;
663 case UITestBase::COMPLEX_THEME: 454 case ProxyLauncher::COMPLEX_THEME:
664 source_history_file = source_history_file.AppendASCII("complex_theme"); 455 source_history_file = source_history_file.AppendASCII("complex_theme");
665 break; 456 break;
666 case UITestBase::NATIVE_THEME: 457 case ProxyLauncher::NATIVE_THEME:
667 source_history_file = source_history_file.AppendASCII("gtk_theme"); 458 source_history_file = source_history_file.AppendASCII("gtk_theme");
668 break; 459 break;
669 case UITestBase::CUSTOM_FRAME: 460 case ProxyLauncher::CUSTOM_FRAME:
670 source_history_file = source_history_file.AppendASCII("custom_frame"); 461 source_history_file = source_history_file.AppendASCII("custom_frame");
671 break; 462 break;
672 case UITestBase::CUSTOM_FRAME_NATIVE_THEME: 463 case ProxyLauncher::CUSTOM_FRAME_NATIVE_THEME:
673 source_history_file = 464 source_history_file =
674 source_history_file.AppendASCII("custom_frame_gtk_theme"); 465 source_history_file.AppendASCII("custom_frame_gtk_theme");
675 break; 466 break;
676 default: 467 default:
677 NOTREACHED(); 468 NOTREACHED();
678 } 469 }
679 return source_history_file; 470 return source_history_file;
680 } 471 }
681 472
682 void UITestBase::PrepareTestCommandline(CommandLine* command_line) {
683 // Propagate commandline settings from test_launcher_utils.
684 test_launcher_utils::PrepareBrowserCommandLineForTests(command_line);
685
686 // Add any explicit command line flags passed to the process.
687 CommandLine::StringType extra_chrome_flags =
688 CommandLine::ForCurrentProcess()->GetSwitchValueNative(
689 switches::kExtraChromeFlags);
690 if (!extra_chrome_flags.empty()) {
691 // Split by spaces and append to command line
692 std::vector<CommandLine::StringType> flags;
693 base::SplitString(extra_chrome_flags, ' ', &flags);
694 for (size_t i = 0; i < flags.size(); ++i)
695 command_line->AppendArgNative(flags[i]);
696 }
697
698 // No default browser check, it would create an info-bar (if we are not the
699 // default browser) that could conflicts with some tests expectations.
700 command_line->AppendSwitch(switches::kNoDefaultBrowserCheck);
701
702 // This is a UI test.
703 command_line->AppendSwitchASCII(switches::kTestType, kUITestType);
704
705 // Tell the browser to use a temporary directory just for this test.
706 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir());
707
708 // We need cookies on file:// for things like the page cycler.
709 if (enable_file_cookies_)
710 command_line->AppendSwitch(switches::kEnableFileCookies);
711
712 if (dom_automation_enabled_)
713 command_line->AppendSwitch(switches::kDomAutomationController);
714
715 if (include_testing_id_)
716 command_line->AppendSwitchASCII(switches::kTestingChannelID,
717 launcher_->PrefixedChannelID());
718
719 if (!show_error_dialogs_ &&
720 !CommandLine::ForCurrentProcess()->HasSwitch(
721 switches::kEnableErrorDialogs)) {
722 command_line->AppendSwitch(switches::kNoErrorDialogs);
723 }
724 if (in_process_renderer_)
725 command_line->AppendSwitch(switches::kSingleProcess);
726 if (no_sandbox_)
727 command_line->AppendSwitch(switches::kNoSandbox);
728 if (full_memory_dump_)
729 command_line->AppendSwitch(switches::kFullMemoryCrashReport);
730 if (safe_plugins_)
731 command_line->AppendSwitch(switches::kSafePlugins);
732 if (enable_dcheck_)
733 command_line->AppendSwitch(switches::kEnableDCHECK);
734 if (silent_dump_on_dcheck_)
735 command_line->AppendSwitch(switches::kSilentDumpOnDCHECK);
736 if (disable_breakpad_)
737 command_line->AppendSwitch(switches::kDisableBreakpad);
738 if (!homepage_.empty())
739 command_line->AppendSwitchASCII(switches::kHomePage, homepage_);
740
741 if (!js_flags_.empty())
742 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, js_flags_);
743 if (!log_level_.empty())
744 command_line->AppendSwitchASCII(switches::kLoggingLevel, log_level_);
745
746 command_line->AppendSwitch(switches::kMetricsRecordingOnly);
747
748 if (!CommandLine::ForCurrentProcess()->HasSwitch(
749 switches::kEnableErrorDialogs))
750 command_line->AppendSwitch(switches::kEnableLogging);
751
752 if (dump_histograms_on_exit_)
753 command_line->AppendSwitch(switches::kDumpHistogramsOnExit);
754
755 #ifdef WAIT_FOR_DEBUGGER_ON_OPEN
756 command_line->AppendSwitch(switches::kDebugOnStart);
757 #endif
758
759 if (!ui_test_name_.empty())
760 command_line->AppendSwitchASCII(switches::kTestName, ui_test_name_);
761
762 // The tests assume that file:// URIs can freely access other file:// URIs.
763 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles);
764
765 // Disable TabCloseableStateWatcher for tests.
766 command_line->AppendSwitch(switches::kDisableTabCloseableStateWatcher);
767
768 // Allow file:// access on ChromeOS.
769 command_line->AppendSwitch(switches::kAllowFileAccess);
770 }
771
772 bool UITestBase::LaunchBrowserHelper(const CommandLine& arguments,
773 bool wait,
774 base::ProcessHandle* process) {
775 FilePath command = browser_directory_.Append(
776 chrome::kBrowserProcessExecutablePath);
777
778 CommandLine command_line(command);
779
780 // Add command line arguments that should be applied to all UI tests.
781 PrepareTestCommandline(&command_line);
782 DebugFlags::ProcessDebugFlags(
783 &command_line, ChildProcessInfo::UNKNOWN_PROCESS, false);
784 command_line.AppendArguments(arguments, false);
785
786 // TODO(phajdan.jr): Only run it for "main" browser launch.
787 browser_launch_time_ = TimeTicks::Now();
788
789 #if defined(OS_WIN)
790 bool started = base::LaunchApp(command_line,
791 wait,
792 !show_window_,
793 process);
794 #elif defined(OS_POSIX)
795 // Sometimes one needs to run the browser under a special environment
796 // (e.g. valgrind) without also running the test harness (e.g. python)
797 // under the special environment. Provide a way to wrap the browser
798 // commandline with a special prefix to invoke the special environment.
799 const char* browser_wrapper = getenv("BROWSER_WRAPPER");
800 if (browser_wrapper) {
801 command_line.PrependWrapper(browser_wrapper);
802 VLOG(1) << "BROWSER_WRAPPER was set, prefixing command_line with "
803 << browser_wrapper;
804 }
805
806 base::file_handle_mapping_vector fds;
807 if (automation_proxy_.get())
808 fds = automation_proxy_->fds_to_map();
809
810 bool started = base::LaunchApp(command_line.argv(), fds, wait, process);
811 #endif
812
813 return started;
814 }
815
816 void UITestBase::UpdateHistoryDates() {
817 // Migrate the times in the segment_usage table to yesterday so we get
818 // actual thumbnails on the NTP.
819 sql::Connection db;
820 FilePath history =
821 user_data_dir().AppendASCII("Default").AppendASCII("History");
822 // Not all test profiles have a history file.
823 if (!file_util::PathExists(history))
824 return;
825
826 ASSERT_TRUE(db.Open(history));
827 Time yesterday = Time::Now() - TimeDelta::FromDays(1);
828 std::string yesterday_str = base::Int64ToString(yesterday.ToInternalValue());
829 std::string query = StringPrintf(
830 "UPDATE segment_usage "
831 "SET time_slot = %s "
832 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);",
833 yesterday_str.c_str());
834 ASSERT_TRUE(db.Execute(query.c_str()));
835 db.Close();
836 file_util::EvictFileFromSystemCache(history);
837 }
838
839 int UITestBase::GetCrashCount() { 473 int UITestBase::GetCrashCount() {
840 FilePath crash_dump_path; 474 FilePath crash_dump_path;
841 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_path); 475 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_path);
842 int actual_crashes = file_util::CountFilesCreatedAfter( 476 int actual_crashes = file_util::CountFilesCreatedAfter(
843 crash_dump_path, test_start_time_); 477 crash_dump_path, test_start_time_);
844 478
845 #if defined(OS_WIN) 479 #if defined(OS_WIN)
846 // Each crash creates two dump files, so we divide by two here. 480 // Each crash creates two dump files, so we divide by two here.
847 actual_crashes /= 2; 481 actual_crashes /= 2;
848 #endif 482 #endif
849 483
850 return actual_crashes; 484 return actual_crashes;
851 } 485 }
852 486
853 void UITestBase::SetBrowserDirectory(const FilePath& dir) { 487 void UITestBase::SetBrowserDirectory(const FilePath& dir) {
854 browser_directory_ = dir; 488 browser_directory_ = dir;
855 } 489 }
856 490
857 // UITest methods 491 // UITest methods
858 492
859 void UITest::SetUp() { 493 void UITest::SetUp() {
860 // Pass the test case name to chrome.exe on the command line to help with 494 // Pass the test case name to chrome.exe on the command line to help with
861 // parsing Purify output. 495 // parsing Purify output.
862 const testing::TestInfo* const test_info = 496 const testing::TestInfo* const test_info =
863 testing::UnitTest::GetInstance()->current_test_info(); 497 testing::UnitTest::GetInstance()->current_test_info();
864 if (test_info) { 498 if (test_info) {
865 set_ui_test_name(test_info->test_case_name() + std::string(".") + 499 set_test_name(test_info->test_case_name() + std::string(".") +
866 test_info->name()); 500 test_info->name());
867 } 501 }
868 502
869 // Force tests to use OSMesa if they launch the GPU process. This is in 503 // Force tests to use OSMesa if they launch the GPU process. This is in
870 // UITest::SetUp so that it does not affect pyautolib, which runs tests that 504 // UITest::SetUp so that it does not affect pyautolib, which runs tests that
871 // do not work with OSMesa. 505 // do not work with OSMesa.
872 launch_arguments_.AppendSwitchASCII(switches::kUseGL, 506 launch_arguments_.AppendSwitchASCII(switches::kUseGL,
873 gfx::kGLImplementationOSMesaName); 507 gfx::kGLImplementationOSMesaName);
874 508
875 // Mac does not support accelerated compositing with OSMesa. Disable on all 509 // Mac does not support accelerated compositing with OSMesa. Disable on all
876 // platforms so it is consistent. http://crbug.com/58343 510 // platforms so it is consistent. http://crbug.com/58343
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 base::LaunchAppWithHandleInheritance(cmd_line->command_line_string(), 591 base::LaunchAppWithHandleInheritance(cmd_line->command_line_string(),
958 true, 592 true,
959 false, 593 false,
960 NULL); 594 NULL);
961 #else 595 #else
962 base::LaunchApp(*cmd_line.get(), true, false, NULL); 596 base::LaunchApp(*cmd_line.get(), true, false, NULL);
963 #endif 597 #endif
964 } 598 }
965 599
966 int UITest::GetBrowserProcessCount() { 600 int UITest::GetBrowserProcessCount() {
967 return GetRunningChromeProcesses(process_id_).size(); 601 return GetRunningChromeProcesses(browser_process_id()).size();
968 } 602 }
969 603
970 static DictionaryValue* LoadDictionaryValueFromPath(const FilePath& path) { 604 static DictionaryValue* LoadDictionaryValueFromPath(const FilePath& path) {
971 if (path.empty()) 605 if (path.empty())
972 return NULL; 606 return NULL;
973 607
974 JSONFileValueSerializer serializer(path); 608 JSONFileValueSerializer serializer(path);
975 scoped_ptr<Value> root_value(serializer.Deserialize(NULL, NULL)); 609 scoped_ptr<Value> root_value(serializer.Deserialize(NULL, NULL));
976 if (!root_value.get() || root_value->GetType() != Value::TYPE_DICTIONARY) 610 if (!root_value.get() || root_value->GetType() != Value::TYPE_DICTIONARY)
977 return NULL; 611 return NULL;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 EXPECT_FALSE(file_util::ContentsEqual(generated_file, original_file)); 700 EXPECT_FALSE(file_util::ContentsEqual(generated_file, original_file));
1067 } 701 }
1068 } 702 }
1069 if (delete_generated_file) 703 if (delete_generated_file)
1070 EXPECT_TRUE(file_util::DieFileDie(generated_file, false)); 704 EXPECT_TRUE(file_util::DieFileDie(generated_file, false));
1071 } 705 }
1072 706
1073 bool UITest::WaitUntilJavaScriptCondition(TabProxy* tab, 707 bool UITest::WaitUntilJavaScriptCondition(TabProxy* tab,
1074 const std::wstring& frame_xpath, 708 const std::wstring& frame_xpath,
1075 const std::wstring& jscript, 709 const std::wstring& jscript,
1076 int time_out_ms) { 710 int timeout_ms) {
1077 const int kIntervalMs = 250; 711 const int kIntervalMs = 250;
1078 const int kMaxIntervals = time_out_ms / kIntervalMs; 712 const int kMaxIntervals = timeout_ms / kIntervalMs;
1079 713
1080 // Wait until the test signals it has completed. 714 // Wait until the test signals it has completed.
1081 for (int i = 0; i < kMaxIntervals; ++i) { 715 for (int i = 0; i < kMaxIntervals; ++i) {
1082 bool browser_survived = CrashAwareSleep(kIntervalMs); 716 bool browser_survived = CrashAwareSleep(kIntervalMs);
1083 EXPECT_TRUE(browser_survived); 717 EXPECT_TRUE(browser_survived);
1084 if (!browser_survived) 718 if (!browser_survived)
1085 return false; 719 return false;
1086 720
1087 bool done_value = false; 721 bool done_value = false;
1088 bool success = tab->ExecuteAndExtractBool(frame_xpath, jscript, 722 bool success = tab->ExecuteAndExtractBool(frame_xpath, jscript,
1089 &done_value); 723 &done_value);
1090 EXPECT_TRUE(success); 724 EXPECT_TRUE(success);
1091 if (!success) 725 if (!success)
1092 return false; 726 return false;
1093 if (done_value) 727 if (done_value)
1094 return true; 728 return true;
1095 } 729 }
1096 730
1097 ADD_FAILURE() << "Timeout reached in WaitUntilJavaScriptCondition"; 731 ADD_FAILURE() << "Timeout reached in WaitUntilJavaScriptCondition";
1098 return false; 732 return false;
1099 } 733 }
1100 734
1101 bool UITest::WaitUntilCookieValue(TabProxy* tab, 735 bool UITest::WaitUntilCookieValue(TabProxy* tab,
1102 const GURL& url, 736 const GURL& url,
1103 const char* cookie_name, 737 const char* cookie_name,
1104 int time_out_ms, 738 int timeout_ms,
1105 const char* expected_value) { 739 const char* expected_value) {
1106 const int kIntervalMs = 250; 740 const int kIntervalMs = 250;
1107 const int kMaxIntervals = time_out_ms / kIntervalMs; 741 const int kMaxIntervals = timeout_ms / kIntervalMs;
1108 742
1109 std::string cookie_value; 743 std::string cookie_value;
1110 for (int i = 0; i < kMaxIntervals; ++i) { 744 for (int i = 0; i < kMaxIntervals; ++i) {
1111 bool browser_survived = CrashAwareSleep(kIntervalMs); 745 bool browser_survived = CrashAwareSleep(kIntervalMs);
1112 EXPECT_TRUE(browser_survived); 746 EXPECT_TRUE(browser_survived);
1113 if (!browser_survived) 747 if (!browser_survived)
1114 return false; 748 return false;
1115 749
1116 EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value)); 750 EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value));
1117 if (cookie_value == expected_value) 751 if (cookie_value == expected_value)
1118 return true; 752 return true;
1119 } 753 }
1120 754
1121 ADD_FAILURE() << "Timeout reached in WaitUntilCookieValue"; 755 ADD_FAILURE() << "Timeout reached in WaitUntilCookieValue";
1122 return false; 756 return false;
1123 } 757 }
1124 758
1125 std::string UITest::WaitUntilCookieNonEmpty(TabProxy* tab, 759 std::string UITest::WaitUntilCookieNonEmpty(TabProxy* tab,
1126 const GURL& url, 760 const GURL& url,
1127 const char* cookie_name, 761 const char* cookie_name,
1128 int time_out_ms) { 762 int timeout_ms) {
1129 const int kIntervalMs = 250; 763 const int kIntervalMs = 250;
1130 const int kMaxIntervals = time_out_ms / kIntervalMs; 764 const int kMaxIntervals = timeout_ms / kIntervalMs;
1131 765
1132 for (int i = 0; i < kMaxIntervals; ++i) { 766 for (int i = 0; i < kMaxIntervals; ++i) {
1133 bool browser_survived = CrashAwareSleep(kIntervalMs); 767 bool browser_survived = CrashAwareSleep(kIntervalMs);
1134 EXPECT_TRUE(browser_survived); 768 EXPECT_TRUE(browser_survived);
1135 if (!browser_survived) 769 if (!browser_survived)
1136 return std::string(); 770 return std::string();
1137 771
1138 std::string cookie_value; 772 std::string cookie_value;
1139 EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value)); 773 EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value));
1140 if (!cookie_value.empty()) 774 if (!cookie_value.empty())
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 incorrect_state_count++; 842 incorrect_state_count++;
1209 } 843 }
1210 844
1211 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() 845 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF()
1212 << " seconds" 846 << " seconds"
1213 << " call failed " << fail_count << " times" 847 << " call failed " << fail_count << " times"
1214 << " state was incorrect " << incorrect_state_count << " times"; 848 << " state was incorrect " << incorrect_state_count << " times";
1215 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; 849 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__;
1216 return false; 850 return false;
1217 } 851 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698