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

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

Issue 3126034: GTTF: Retry launching the browser a few times in UITest. (Closed)
Patch Set: Created 10 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 265 }
266 266
267 AutomationProxy* UITestBase::CreateAutomationProxy(int execution_timeout) { 267 AutomationProxy* UITestBase::CreateAutomationProxy(int execution_timeout) {
268 return new AutomationProxy(execution_timeout, false); 268 return new AutomationProxy(execution_timeout, false);
269 } 269 }
270 270
271 void UITestBase::LaunchBrowserAndServer() { 271 void UITestBase::LaunchBrowserAndServer() {
272 // Set up IPC testing interface server. 272 // Set up IPC testing interface server.
273 server_.reset(CreateAutomationProxy(command_execution_timeout_ms_)); 273 server_.reset(CreateAutomationProxy(command_execution_timeout_ms_));
274 274
275 LaunchBrowser(launch_arguments_, clear_profile_); 275 const int kTries = 3;
276 server_->WaitForAppLaunch(); 276 for (int i = 0; i < kTries; i++) {
277 if (wait_for_initial_loads_) 277 if (i > 0) {
278 ASSERT_TRUE(server_->WaitForInitialLoads()); 278 LOG(ERROR) << "Launching browser again, retry #" << i;
279 else 279 }
280 PlatformThread::Sleep(sleep_timeout_ms());
281 280
282 EXPECT_TRUE(automation()->SetFilteredInet(ShouldFilterInet())); 281 LaunchBrowser(launch_arguments_, clear_profile_);
282 AutomationLaunchResult launch_result = server_->WaitForAppLaunch();
283 if (launch_result == AUTOMATION_SUCCESS) {
284 bool initial_loads_result = false;
285 if (wait_for_initial_loads_) {
286 initial_loads_result = server_->WaitForInitialLoads();
287 } else {
288 PlatformThread::Sleep(sleep_timeout_ms());
289 initial_loads_result = true;
290 }
291
292 if (initial_loads_result) {
293 if (automation()->SetFilteredInet(ShouldFilterInet())) {
294 return;
295 } else {
296 LOG(ERROR) << "SetFilteredInet failed";
297 }
298 } else {
299 LOG(ERROR) << "WaitForInitialLoadsFailed";
300 }
301 } else {
302 LOG(ERROR) << "WaitForAppLaunch failed: " << launch_result;
303 }
304
305 // The browser is likely hosed or already down at this point. Do not wait
306 // for it, just kill anything that is still running, preparing a clean
307 // environment for the next retry.
308 CleanupAppProcesses();
309 }
310
311 FAIL() << "Failed to launch browser";
283 } 312 }
284 313
285 void UITestBase::CloseBrowserAndServer() { 314 void UITestBase::CloseBrowserAndServer() {
286 QuitBrowser(); 315 QuitBrowser();
287 CleanupAppProcesses(); 316 CleanupAppProcesses();
288 317
289 // Suppress spammy failures that seem to be occurring when running 318 // Suppress spammy failures that seem to be occurring when running
290 // the UI tests in single-process mode. 319 // the UI tests in single-process mode.
291 // TODO(jhughes): figure out why this is necessary at all, and fix it 320 // TODO(jhughes): figure out why this is necessary at all, and fix it
292 if (!in_process_renderer_) 321 if (!in_process_renderer_)
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 PlatformTest::TearDown(); 1253 PlatformTest::TearDown();
1225 } 1254 }
1226 1255
1227 AutomationProxy* UITest::CreateAutomationProxy(int execution_timeout) { 1256 AutomationProxy* UITest::CreateAutomationProxy(int execution_timeout) {
1228 // Make the AutomationProxy disconnect the channel on the first error, 1257 // Make the AutomationProxy disconnect the channel on the first error,
1229 // so that we avoid spending a lot of time in timeouts. The browser is likely 1258 // so that we avoid spending a lot of time in timeouts. The browser is likely
1230 // hosed if we hit those errors. 1259 // hosed if we hit those errors.
1231 return new AutomationProxy(execution_timeout, true); 1260 return new AutomationProxy(execution_timeout, true);
1232 } 1261 }
1233 1262
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698