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

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: Nits fixed; homepage_ moved to UITestBase; process_, process_id_ moved to ProxyLauncher. 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_);
113 } 96 }
114 97
115 UITestBase::UITestBase(MessageLoop::Type msg_loop_type) 98 UITestBase::UITestBase(MessageLoop::Type msg_loop_type)
116 : launch_arguments_(CommandLine::NO_PROGRAM), 99 : launch_arguments_(CommandLine::NO_PROGRAM),
117 expected_errors_(0), 100 expected_errors_(0),
118 expected_crashes_(0), 101 expected_crashes_(0),
119 homepage_(chrome::kAboutBlankURL),
120 wait_for_initial_loads_(true), 102 wait_for_initial_loads_(true),
121 dom_automation_enabled_(false), 103 dom_automation_enabled_(false),
122 process_(base::kNullProcessHandle),
123 process_id_(-1),
124 show_window_(false), 104 show_window_(false),
125 clear_profile_(true), 105 clear_profile_(true),
126 include_testing_id_(true), 106 include_testing_id_(true),
127 enable_file_cookies_(true), 107 enable_file_cookies_(true),
128 profile_type_(UITestBase::DEFAULT_THEME), 108 profile_type_(ProxyLauncher::DEFAULT_THEME),
129 shutdown_type_(UITestBase::WINDOW_CLOSE) { 109 shutdown_type_(ProxyLauncher::WINDOW_CLOSE) {
130 PathService::Get(chrome::DIR_APP, &browser_directory_); 110 PathService::Get(chrome::DIR_APP, &browser_directory_);
131 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); 111 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_);
132 } 112 }
133 113
134 UITestBase::~UITestBase() { 114 UITestBase::~UITestBase() {
135 } 115 }
136 116
137 void UITestBase::SetUp() { 117 void UITestBase::SetUp() {
138 AssertAppNotRunning(L"Please close any other instances " 118 launcher_->AssertAppNotRunning(L"Please close any other instances "
139 L"of the app before testing."); 119 L"of the app before testing.");
140 120
141 JavaScriptExecutionController::set_timeout( 121 JavaScriptExecutionController::set_timeout(
142 TestTimeouts::action_max_timeout_ms()); 122 TestTimeouts::action_max_timeout_ms());
143 test_start_time_ = Time::NowFromSystemTime(); 123 test_start_time_ = Time::NowFromSystemTime();
144 124
125 SetLaunchSwitches();
126
145 launcher_.reset(CreateProxyLauncher()); 127 launcher_.reset(CreateProxyLauncher());
146 launcher_->InitializeConnection(this); 128 launcher_->InitializeConnection(launch_arguments_, include_testing_id_,
129 clear_profile_, template_user_data_,
130 profile_type_, browser_directory_,
131 show_window_, wait_for_initial_loads_,
132 &browser_launch_time_);
147 } 133 }
148 134
149 void UITestBase::TearDown() { 135 void UITestBase::TearDown() {
150 CloseBrowserAndServer(); 136 CloseBrowserAndServer();
151 137
152 // Make sure that we didn't encounter any assertion failures 138 // Make sure that we didn't encounter any assertion failures
153 logging::AssertionList assertions; 139 logging::AssertionList assertions;
154 logging::GetFatalAssertions(&assertions); 140 logging::GetFatalAssertions(&assertions);
155 141
156 // If there were errors, get all the error strings for display. 142 // 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."; 157 L"Encountered an unexpected crash in the program during this test.";
172 if (expected_crashes_ > 0 && actual_crashes == 0) { 158 if (expected_crashes_ > 0 && actual_crashes == 0) {
173 error_msg += L" "; 159 error_msg += L" ";
174 error_msg += kFailedNoCrashService; 160 error_msg += kFailedNoCrashService;
175 } 161 }
176 EXPECT_EQ(expected_crashes_, actual_crashes) << error_msg; 162 EXPECT_EQ(expected_crashes_, actual_crashes) << error_msg;
177 } 163 }
178 164
179 // TODO(phajdan.jr): get rid of set_command_execution_timeout_ms. 165 // TODO(phajdan.jr): get rid of set_command_execution_timeout_ms.
180 void UITestBase::set_command_execution_timeout_ms(int timeout) { 166 void UITestBase::set_command_execution_timeout_ms(int timeout) {
181 automation_proxy_->set_command_execution_timeout_ms(timeout); 167 automation()->set_command_execution_timeout_ms(timeout);
182 VLOG(1) << "Automation command execution timeout set to " << timeout << " ms"; 168 VLOG(1) << "Automation command execution timeout set to " << timeout << " ms";
183 } 169 }
184 170
185 ProxyLauncher* UITestBase::CreateProxyLauncher() { 171 ProxyLauncher* UITestBase::CreateProxyLauncher() {
186 return new AnonymousProxyLauncher(false); 172 return new AnonymousProxyLauncher(false);
187 } 173 }
188 174
175 void UITestBase::SetLaunchSwitches() {
176 // We need cookies on file:// for things like the page cycler.
177 if (enable_file_cookies_)
178 launch_arguments_.AppendSwitch(switches::kEnableFileCookies);
179 if (dom_automation_enabled_)
180 launch_arguments_.AppendSwitch(switches::kDomAutomationController);
181 if (!homepage_.empty())
182 launch_arguments_.AppendSwitchASCII(switches::kHomePage, homepage_);
183 }
184
189 void UITestBase::LaunchBrowser() { 185 void UITestBase::LaunchBrowser() {
190 LaunchBrowser(launch_arguments_, clear_profile_); 186 LaunchBrowser(launch_arguments_, clear_profile_);
191 } 187 }
192 188
193 void UITestBase::LaunchBrowserAndServer() { 189 void UITestBase::LaunchBrowserAndServer() {
194 // Set up IPC testing interface as a server. 190 launcher_->LaunchBrowserAndServer(launch_arguments_, include_testing_id_,
195 automation_proxy_.reset(launcher_->CreateAutomationProxy( 191 clear_profile_, template_user_data_,
196 TestTimeouts::command_execution_timeout_ms())); 192 profile_type_, browser_directory_,
197 193 show_window_, wait_for_initial_loads_,
198 LaunchBrowser(launch_arguments_, clear_profile_); 194 &browser_launch_time_);
199 WaitForBrowserLaunch();
200 } 195 }
201 196
202 void UITestBase::ConnectToRunningBrowser() { 197 void UITestBase::ConnectToRunningBrowser() {
203 // Set up IPC testing interface as a client. 198 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 } 199 }
219 200
220 void UITestBase::CloseBrowserAndServer() { 201 void UITestBase::CloseBrowserAndServer() {
221 QuitBrowser(); 202 launcher_->CloseBrowserAndServer(shutdown_type_, &browser_quit_time_);
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 } 203 }
233 204
234 void UITestBase::LaunchBrowser(const CommandLine& arguments, 205 void UITestBase::LaunchBrowser(const CommandLine& arguments,
235 bool clear_profile) { 206 bool clear_profile) {
236 if (clear_profile || !temp_profile_dir_->IsValid()) { 207 launcher_->LaunchBrowser(arguments, include_testing_id_, clear_profile,
237 temp_profile_dir_.reset(new ScopedTempDir()); 208 template_user_data_, profile_type_,
238 ASSERT_TRUE(temp_profile_dir_->CreateUniqueTempDir()); 209 browser_directory_, show_window_,
239 210 &browser_launch_time_);
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 } 211 }
262 212
263 #if !defined(OS_MACOSX) 213 #if !defined(OS_MACOSX)
264 bool UITestBase::LaunchAnotherBrowserBlockUntilClosed( 214 bool UITestBase::LaunchAnotherBrowserBlockUntilClosed(
265 const CommandLine& cmdline) { 215 const CommandLine& cmdline) {
266 return LaunchBrowserHelper(cmdline, true, NULL); 216 return launcher_->LaunchAnotherBrowserBlockUntilClosed(
217 cmdline, include_testing_id_, browser_directory_,
218 show_window_, &browser_launch_time_);
267 } 219 }
268 #endif 220 #endif
269 221
270 void UITestBase::QuitBrowser() { 222 void UITestBase::QuitBrowser() {
271 if (SESSION_ENDING == shutdown_type_) { 223 launcher_->QuitBrowser(shutdown_type_, &browser_quit_time_);
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 } 224 }
343 225
344 void UITestBase::TerminateBrowser() { 226 void UITestBase::TerminateBrowser() {
345 if (IsBrowserRunning()) { 227 launcher_->TerminateBrowser(&browser_quit_time_);
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 } 228 }
390 229
391 void UITestBase::CleanupAppProcesses() { 230 void UITestBase::CleanupAppProcesses() {
392 TerminateAllChromeProcesses(process_id_); 231 TerminateAllChromeProcesses(browser_process_id());
393 } 232 }
394 233
395 scoped_refptr<TabProxy> UITestBase::GetActiveTab(int window_index) { 234 scoped_refptr<TabProxy> UITestBase::GetActiveTab(int window_index) {
396 EXPECT_GE(window_index, 0); 235 EXPECT_GE(window_index, 0);
397 int window_count = -1; 236 int window_count = -1;
398 // We have to use EXPECT rather than ASSERT here because ASSERT_* only works 237 // We have to use EXPECT rather than ASSERT here because ASSERT_* only works
399 // in functions that return void. 238 // in functions that return void.
400 EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count)); 239 EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count));
401 if (window_count == -1) 240 if (window_count == -1)
402 return NULL; 241 return NULL;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 automation()->GetBrowserWindow(window_index); 297 automation()->GetBrowserWindow(window_index);
459 ASSERT_TRUE(window.get()); 298 ASSERT_TRUE(window.get());
460 scoped_refptr<TabProxy> tab_proxy(window->GetTab(tab_index)); 299 scoped_refptr<TabProxy> tab_proxy(window->GetTab(tab_index));
461 ASSERT_TRUE(tab_proxy.get()); 300 ASSERT_TRUE(tab_proxy.get());
462 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 301 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
463 tab_proxy->NavigateToURLBlockUntilNavigationsComplete( 302 tab_proxy->NavigateToURLBlockUntilNavigationsComplete(
464 url, number_of_navigations)) << url.spec(); 303 url, number_of_navigations)) << url.spec();
465 } 304 }
466 305
467 bool UITestBase::WaitForBrowserProcessToQuit() { 306 bool UITestBase::WaitForBrowserProcessToQuit() {
468 // Wait for the browser process to quit. 307 return launcher_->WaitForBrowserProcessToQuit();
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 } 308 }
475 309
476 bool UITestBase::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, 310 bool UITestBase::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser,
477 bool wait_for_open) { 311 bool wait_for_open) {
478 const int kCycles = 10; 312 const int kCycles = 10;
479 for (int i = 0; i < kCycles; i++) { 313 for (int i = 0; i < kCycles; i++) {
480 bool visible = false; 314 bool visible = false;
481 bool animating = true; 315 bool animating = true;
482 if (!browser->GetBookmarkBarVisibility(&visible, &animating)) 316 if (!browser->GetBookmarkBarVisibility(&visible, &animating))
483 return false; // Some error. 317 return false; // Some error.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 EXPECT_TRUE(window_proxy.get()); 360 EXPECT_TRUE(window_proxy.get());
527 if (!window_proxy.get()) 361 if (!window_proxy.get())
528 return -1; 362 return -1;
529 363
530 int active_tab_index = -1; 364 int active_tab_index = -1;
531 EXPECT_TRUE(window_proxy->GetActiveTabIndex(&active_tab_index)); 365 EXPECT_TRUE(window_proxy->GetActiveTabIndex(&active_tab_index));
532 return active_tab_index; 366 return active_tab_index;
533 } 367 }
534 368
535 bool UITestBase::IsBrowserRunning() { 369 bool UITestBase::IsBrowserRunning() {
536 return CrashAwareSleep(0); 370 return launcher_->IsBrowserRunning();
537 } 371 }
538 372
539 bool UITestBase::CrashAwareSleep(int time_out_ms) { 373 bool UITestBase::CrashAwareSleep(int timeout_ms) {
540 return base::CrashAwareSleep(process_, time_out_ms); 374 return launcher_->CrashAwareSleep(timeout_ms);
541 } 375 }
542 376
543 int UITestBase::GetTabCount() { 377 int UITestBase::GetTabCount() {
544 return GetTabCount(0); 378 return GetTabCount(0);
545 } 379 }
546 380
547 int UITestBase::GetTabCount(int window_index) { 381 int UITestBase::GetTabCount(int window_index) {
548 scoped_refptr<BrowserProxy> window( 382 scoped_refptr<BrowserProxy> window(
549 automation()->GetBrowserWindow(window_index)); 383 automation()->GetBrowserWindow(window_index));
550 EXPECT_TRUE(window.get()); 384 EXPECT_TRUE(window.get());
(...skipping 27 matching lines...) Expand all
578 EXPECT_TRUE(tab_proxy.get()); 412 EXPECT_TRUE(tab_proxy.get());
579 if (!tab_proxy.get()) 413 if (!tab_proxy.get())
580 return FilePath(); 414 return FilePath();
581 415
582 FilePath download_directory; 416 FilePath download_directory;
583 EXPECT_TRUE(tab_proxy->GetDownloadDirectory(&download_directory)); 417 EXPECT_TRUE(tab_proxy->GetDownloadDirectory(&download_directory));
584 return download_directory; 418 return download_directory;
585 } 419 }
586 420
587 void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const { 421 void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const {
588 ASSERT_TRUE(automation_proxy_->Send( 422 ASSERT_TRUE(automation()->Send(
589 new AutomationMsg_CloseBrowserRequestAsync(browser->handle()))); 423 new AutomationMsg_CloseBrowserRequestAsync(browser->handle())));
590 } 424 }
591 425
592 bool UITestBase::CloseBrowser(BrowserProxy* browser, 426 bool UITestBase::CloseBrowser(BrowserProxy* browser,
593 bool* application_closed) const { 427 bool* application_closed) const {
594 DCHECK(application_closed); 428 DCHECK(application_closed);
595 if (!browser->is_valid() || !browser->handle()) 429 if (!browser->is_valid() || !browser->handle())
596 return false; 430 return false;
597 431
598 bool result = true; 432 bool result = true;
599 433
600 bool succeeded = automation_proxy_->Send(new AutomationMsg_CloseBrowser( 434 bool succeeded = automation()->Send(new AutomationMsg_CloseBrowser(
601 browser->handle(), &result, application_closed)); 435 browser->handle(), &result, application_closed));
602 436
603 if (!succeeded) 437 if (!succeeded)
604 return false; 438 return false;
605 439
606 if (*application_closed) { 440 if (*application_closed) {
607 // Let's wait until the process dies (if it is not gone already). 441 // Let's wait until the process dies (if it is not gone already).
608 bool success = base::WaitForSingleProcess(process_, base::kNoTimeout); 442 bool success = base::WaitForSingleProcess(process(), base::kNoTimeout);
609 EXPECT_TRUE(success); 443 EXPECT_TRUE(success);
610 } 444 }
611 445
612 return result; 446 return result;
613 } 447 }
614 448
615 // static 449 // static
616 void UITestBase::RewritePreferencesFile(const FilePath& user_data_dir) { 450 FilePath UITestBase::ComputeTypicalUserDataSource(
617 const FilePath pref_template_path( 451 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; 452 FilePath source_history_file;
656 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, 453 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA,
657 &source_history_file)); 454 &source_history_file));
658 source_history_file = source_history_file.AppendASCII("profiles"); 455 source_history_file = source_history_file.AppendASCII("profiles");
659 switch (profile_type) { 456 switch (profile_type) {
660 case UITestBase::DEFAULT_THEME: 457 case ProxyLauncher::DEFAULT_THEME:
661 source_history_file = source_history_file.AppendASCII("typical_history"); 458 source_history_file = source_history_file.AppendASCII("typical_history");
662 break; 459 break;
663 case UITestBase::COMPLEX_THEME: 460 case ProxyLauncher::COMPLEX_THEME:
664 source_history_file = source_history_file.AppendASCII("complex_theme"); 461 source_history_file = source_history_file.AppendASCII("complex_theme");
665 break; 462 break;
666 case UITestBase::NATIVE_THEME: 463 case ProxyLauncher::NATIVE_THEME:
667 source_history_file = source_history_file.AppendASCII("gtk_theme"); 464 source_history_file = source_history_file.AppendASCII("gtk_theme");
668 break; 465 break;
669 case UITestBase::CUSTOM_FRAME: 466 case ProxyLauncher::CUSTOM_FRAME:
670 source_history_file = source_history_file.AppendASCII("custom_frame"); 467 source_history_file = source_history_file.AppendASCII("custom_frame");
671 break; 468 break;
672 case UITestBase::CUSTOM_FRAME_NATIVE_THEME: 469 case ProxyLauncher::CUSTOM_FRAME_NATIVE_THEME:
673 source_history_file = 470 source_history_file =
674 source_history_file.AppendASCII("custom_frame_gtk_theme"); 471 source_history_file.AppendASCII("custom_frame_gtk_theme");
675 break; 472 break;
676 default: 473 default:
677 NOTREACHED(); 474 NOTREACHED();
678 } 475 }
679 return source_history_file; 476 return source_history_file;
680 } 477 }
681 478
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() { 479 int UITestBase::GetCrashCount() {
840 FilePath crash_dump_path; 480 FilePath crash_dump_path;
841 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_path); 481 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_path);
842 int actual_crashes = file_util::CountFilesCreatedAfter( 482 int actual_crashes = file_util::CountFilesCreatedAfter(
843 crash_dump_path, test_start_time_); 483 crash_dump_path, test_start_time_);
844 484
845 #if defined(OS_WIN) 485 #if defined(OS_WIN)
846 // Each crash creates two dump files, so we divide by two here. 486 // Each crash creates two dump files, so we divide by two here.
847 actual_crashes /= 2; 487 actual_crashes /= 2;
848 #endif 488 #endif
849 489
850 return actual_crashes; 490 return actual_crashes;
851 } 491 }
852 492
853 void UITestBase::SetBrowserDirectory(const FilePath& dir) { 493 void UITestBase::SetBrowserDirectory(const FilePath& dir) {
854 browser_directory_ = dir; 494 browser_directory_ = dir;
855 } 495 }
856 496
857 // UITest methods 497 // UITest methods
858 498
859 void UITest::SetUp() { 499 void UITest::SetUp() {
860 // Pass the test case name to chrome.exe on the command line to help with 500 // Pass the test case name to chrome.exe on the command line to help with
861 // parsing Purify output. 501 // parsing Purify output.
862 const testing::TestInfo* const test_info = 502 const testing::TestInfo* const test_info =
863 testing::UnitTest::GetInstance()->current_test_info(); 503 testing::UnitTest::GetInstance()->current_test_info();
864 if (test_info) { 504 if (test_info) {
865 set_ui_test_name(test_info->test_case_name() + std::string(".") + 505 set_test_name(test_info->test_case_name() + std::string(".") +
866 test_info->name()); 506 test_info->name());
867 } 507 }
868 508
869 // Force tests to use OSMesa if they launch the GPU process. This is in 509 // 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 510 // UITest::SetUp so that it does not affect pyautolib, which runs tests that
871 // do not work with OSMesa. 511 // do not work with OSMesa.
872 launch_arguments_.AppendSwitchASCII(switches::kUseGL, 512 launch_arguments_.AppendSwitchASCII(switches::kUseGL,
873 gfx::kGLImplementationOSMesaName); 513 gfx::kGLImplementationOSMesaName);
874 514
875 // Mac does not support accelerated compositing with OSMesa. Disable on all 515 // Mac does not support accelerated compositing with OSMesa. Disable on all
876 // platforms so it is consistent. http://crbug.com/58343 516 // 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(), 597 base::LaunchAppWithHandleInheritance(cmd_line->command_line_string(),
958 true, 598 true,
959 false, 599 false,
960 NULL); 600 NULL);
961 #else 601 #else
962 base::LaunchApp(*cmd_line.get(), true, false, NULL); 602 base::LaunchApp(*cmd_line.get(), true, false, NULL);
963 #endif 603 #endif
964 } 604 }
965 605
966 int UITest::GetBrowserProcessCount() { 606 int UITest::GetBrowserProcessCount() {
967 return GetRunningChromeProcesses(process_id_).size(); 607 return GetRunningChromeProcesses(browser_process_id()).size();
968 } 608 }
969 609
970 static DictionaryValue* LoadDictionaryValueFromPath(const FilePath& path) { 610 static DictionaryValue* LoadDictionaryValueFromPath(const FilePath& path) {
971 if (path.empty()) 611 if (path.empty())
972 return NULL; 612 return NULL;
973 613
974 JSONFileValueSerializer serializer(path); 614 JSONFileValueSerializer serializer(path);
975 scoped_ptr<Value> root_value(serializer.Deserialize(NULL, NULL)); 615 scoped_ptr<Value> root_value(serializer.Deserialize(NULL, NULL));
976 if (!root_value.get() || root_value->GetType() != Value::TYPE_DICTIONARY) 616 if (!root_value.get() || root_value->GetType() != Value::TYPE_DICTIONARY)
977 return NULL; 617 return NULL;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 EXPECT_FALSE(file_util::ContentsEqual(generated_file, original_file)); 706 EXPECT_FALSE(file_util::ContentsEqual(generated_file, original_file));
1067 } 707 }
1068 } 708 }
1069 if (delete_generated_file) 709 if (delete_generated_file)
1070 EXPECT_TRUE(file_util::DieFileDie(generated_file, false)); 710 EXPECT_TRUE(file_util::DieFileDie(generated_file, false));
1071 } 711 }
1072 712
1073 bool UITest::WaitUntilJavaScriptCondition(TabProxy* tab, 713 bool UITest::WaitUntilJavaScriptCondition(TabProxy* tab,
1074 const std::wstring& frame_xpath, 714 const std::wstring& frame_xpath,
1075 const std::wstring& jscript, 715 const std::wstring& jscript,
1076 int time_out_ms) { 716 int timeout_ms) {
1077 const int kIntervalMs = 250; 717 const int kIntervalMs = 250;
1078 const int kMaxIntervals = time_out_ms / kIntervalMs; 718 const int kMaxIntervals = timeout_ms / kIntervalMs;
1079 719
1080 // Wait until the test signals it has completed. 720 // Wait until the test signals it has completed.
1081 for (int i = 0; i < kMaxIntervals; ++i) { 721 for (int i = 0; i < kMaxIntervals; ++i) {
1082 bool browser_survived = CrashAwareSleep(kIntervalMs); 722 bool browser_survived = CrashAwareSleep(kIntervalMs);
1083 EXPECT_TRUE(browser_survived); 723 EXPECT_TRUE(browser_survived);
1084 if (!browser_survived) 724 if (!browser_survived)
1085 return false; 725 return false;
1086 726
1087 bool done_value = false; 727 bool done_value = false;
1088 bool success = tab->ExecuteAndExtractBool(frame_xpath, jscript, 728 bool success = tab->ExecuteAndExtractBool(frame_xpath, jscript,
1089 &done_value); 729 &done_value);
1090 EXPECT_TRUE(success); 730 EXPECT_TRUE(success);
1091 if (!success) 731 if (!success)
1092 return false; 732 return false;
1093 if (done_value) 733 if (done_value)
1094 return true; 734 return true;
1095 } 735 }
1096 736
1097 ADD_FAILURE() << "Timeout reached in WaitUntilJavaScriptCondition"; 737 ADD_FAILURE() << "Timeout reached in WaitUntilJavaScriptCondition";
1098 return false; 738 return false;
1099 } 739 }
1100 740
1101 bool UITest::WaitUntilCookieValue(TabProxy* tab, 741 bool UITest::WaitUntilCookieValue(TabProxy* tab,
1102 const GURL& url, 742 const GURL& url,
1103 const char* cookie_name, 743 const char* cookie_name,
1104 int time_out_ms, 744 int timeout_ms,
1105 const char* expected_value) { 745 const char* expected_value) {
1106 const int kIntervalMs = 250; 746 const int kIntervalMs = 250;
1107 const int kMaxIntervals = time_out_ms / kIntervalMs; 747 const int kMaxIntervals = timeout_ms / kIntervalMs;
1108 748
1109 std::string cookie_value; 749 std::string cookie_value;
1110 for (int i = 0; i < kMaxIntervals; ++i) { 750 for (int i = 0; i < kMaxIntervals; ++i) {
1111 bool browser_survived = CrashAwareSleep(kIntervalMs); 751 bool browser_survived = CrashAwareSleep(kIntervalMs);
1112 EXPECT_TRUE(browser_survived); 752 EXPECT_TRUE(browser_survived);
1113 if (!browser_survived) 753 if (!browser_survived)
1114 return false; 754 return false;
1115 755
1116 EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value)); 756 EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value));
1117 if (cookie_value == expected_value) 757 if (cookie_value == expected_value)
1118 return true; 758 return true;
1119 } 759 }
1120 760
1121 ADD_FAILURE() << "Timeout reached in WaitUntilCookieValue"; 761 ADD_FAILURE() << "Timeout reached in WaitUntilCookieValue";
1122 return false; 762 return false;
1123 } 763 }
1124 764
1125 std::string UITest::WaitUntilCookieNonEmpty(TabProxy* tab, 765 std::string UITest::WaitUntilCookieNonEmpty(TabProxy* tab,
1126 const GURL& url, 766 const GURL& url,
1127 const char* cookie_name, 767 const char* cookie_name,
1128 int time_out_ms) { 768 int timeout_ms) {
1129 const int kIntervalMs = 250; 769 const int kIntervalMs = 250;
1130 const int kMaxIntervals = time_out_ms / kIntervalMs; 770 const int kMaxIntervals = timeout_ms / kIntervalMs;
1131 771
1132 for (int i = 0; i < kMaxIntervals; ++i) { 772 for (int i = 0; i < kMaxIntervals; ++i) {
1133 bool browser_survived = CrashAwareSleep(kIntervalMs); 773 bool browser_survived = CrashAwareSleep(kIntervalMs);
1134 EXPECT_TRUE(browser_survived); 774 EXPECT_TRUE(browser_survived);
1135 if (!browser_survived) 775 if (!browser_survived)
1136 return std::string(); 776 return std::string();
1137 777
1138 std::string cookie_value; 778 std::string cookie_value;
1139 EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value)); 779 EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value));
1140 if (!cookie_value.empty()) 780 if (!cookie_value.empty())
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 incorrect_state_count++; 848 incorrect_state_count++;
1209 } 849 }
1210 850
1211 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() 851 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF()
1212 << " seconds" 852 << " seconds"
1213 << " call failed " << fail_count << " times" 853 << " call failed " << fail_count << " times"
1214 << " state was incorrect " << incorrect_state_count << " times"; 854 << " state was incorrect " << incorrect_state_count << " times";
1215 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; 855 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__;
1216 return false; 856 return false;
1217 } 857 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698