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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/ui/ui_test.cc
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 9b4f6459656565d499a8f77e00567ba050b88ef4..d1bd4c567ebe9826bed3df5556184f86eb726cd4 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -272,14 +272,43 @@ void UITestBase::LaunchBrowserAndServer() {
// Set up IPC testing interface server.
server_.reset(CreateAutomationProxy(command_execution_timeout_ms_));
- LaunchBrowser(launch_arguments_, clear_profile_);
- server_->WaitForAppLaunch();
- if (wait_for_initial_loads_)
- ASSERT_TRUE(server_->WaitForInitialLoads());
- else
- PlatformThread::Sleep(sleep_timeout_ms());
-
- EXPECT_TRUE(automation()->SetFilteredInet(ShouldFilterInet()));
+ const int kTries = 3;
+ for (int i = 0; i < kTries; i++) {
+ if (i > 0) {
+ LOG(ERROR) << "Launching browser again, retry #" << i;
+ }
+
+ LaunchBrowser(launch_arguments_, clear_profile_);
+ AutomationLaunchResult launch_result = server_->WaitForAppLaunch();
+ if (launch_result == AUTOMATION_SUCCESS) {
+ bool initial_loads_result = false;
+ if (wait_for_initial_loads_) {
+ initial_loads_result = server_->WaitForInitialLoads();
+ } else {
+ PlatformThread::Sleep(sleep_timeout_ms());
+ initial_loads_result = true;
+ }
+
+ if (initial_loads_result) {
+ if (automation()->SetFilteredInet(ShouldFilterInet())) {
+ return;
+ } else {
+ LOG(ERROR) << "SetFilteredInet failed";
+ }
+ } else {
+ LOG(ERROR) << "WaitForInitialLoadsFailed";
+ }
+ } else {
+ LOG(ERROR) << "WaitForAppLaunch failed: " << launch_result;
+ }
+
+ // The browser is likely hosed or already down at this point. Do not wait
+ // for it, just kill anything that is still running, preparing a clean
+ // environment for the next retry.
+ CleanupAppProcesses();
+ }
+
+ FAIL() << "Failed to launch browser";
}
void UITestBase::CloseBrowserAndServer() {
« 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