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

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

Issue 3404001: Revert 57897 - GTTF: Retry launching the browser a few times in UITest.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 3 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
« 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 AutomationProxy* UITestBase::CreateAutomationProxy(int execution_timeout) { 189 AutomationProxy* UITestBase::CreateAutomationProxy(int execution_timeout) {
190 return new AutomationProxy(execution_timeout, false); 190 return new AutomationProxy(execution_timeout, false);
191 } 191 }
192 192
193 void UITestBase::LaunchBrowserAndServer() { 193 void UITestBase::LaunchBrowserAndServer() {
194 // Set up IPC testing interface server. 194 // Set up IPC testing interface server.
195 server_.reset(CreateAutomationProxy( 195 server_.reset(CreateAutomationProxy(
196 TestTimeouts::command_execution_timeout_ms())); 196 TestTimeouts::command_execution_timeout_ms()));
197 197
198 const int kTries = 3; 198 LaunchBrowser(launch_arguments_, clear_profile_);
199 for (int i = 0; i < kTries; i++) { 199 server_->WaitForAppLaunch();
200 if (i > 0) { 200 if (wait_for_initial_loads_)
201 LOG(ERROR) << "Launching browser again, retry #" << i; 201 ASSERT_TRUE(server_->WaitForInitialLoads());
202 } 202 else
203 PlatformThread::Sleep(sleep_timeout_ms());
203 204
204 LaunchBrowser(launch_arguments_, clear_profile_); 205 EXPECT_TRUE(automation()->SetFilteredInet(ShouldFilterInet()));
205 AutomationLaunchResult launch_result = server_->WaitForAppLaunch();
206 if (launch_result == AUTOMATION_SUCCESS) {
207 bool initial_loads_result = false;
208 if (wait_for_initial_loads_) {
209 initial_loads_result = server_->WaitForInitialLoads();
210 } else {
211 PlatformThread::Sleep(sleep_timeout_ms());
212 initial_loads_result = true;
213 }
214
215 if (initial_loads_result) {
216 if (automation()->SetFilteredInet(ShouldFilterInet())) {
217 return;
218 } else {
219 LOG(ERROR) << "SetFilteredInet failed";
220 }
221 } else {
222 LOG(ERROR) << "WaitForInitialLoadsFailed";
223 }
224 } else {
225 LOG(ERROR) << "WaitForAppLaunch failed: " << launch_result;
226 }
227
228 // The browser is likely hosed or already down at this point. Do not wait
229 // for it, just kill anything that is still running, preparing a clean
230 // environment for the next retry.
231 CleanupAppProcesses();
232 }
233
234 FAIL() << "Failed to launch browser";
235 } 206 }
236 207
237 void UITestBase::CloseBrowserAndServer() { 208 void UITestBase::CloseBrowserAndServer() {
238 QuitBrowser(); 209 QuitBrowser();
239 CleanupAppProcesses(); 210 CleanupAppProcesses();
240 211
241 // Suppress spammy failures that seem to be occurring when running 212 // Suppress spammy failures that seem to be occurring when running
242 // the UI tests in single-process mode. 213 // the UI tests in single-process mode.
243 // TODO(jhughes): figure out why this is necessary at all, and fix it 214 // TODO(jhughes): figure out why this is necessary at all, and fix it
244 if (!in_process_renderer_) 215 if (!in_process_renderer_)
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 UITestBase::TearDown(); 1163 UITestBase::TearDown();
1193 PlatformTest::TearDown(); 1164 PlatformTest::TearDown();
1194 } 1165 }
1195 1166
1196 AutomationProxy* UITest::CreateAutomationProxy(int execution_timeout) { 1167 AutomationProxy* UITest::CreateAutomationProxy(int execution_timeout) {
1197 // Make the AutomationProxy disconnect the channel on the first error, 1168 // Make the AutomationProxy disconnect the channel on the first error,
1198 // so that we avoid spending a lot of time in timeouts. The browser is likely 1169 // so that we avoid spending a lot of time in timeouts. The browser is likely
1199 // hosed if we hit those errors. 1170 // hosed if we hit those errors.
1200 return new AutomationProxy(execution_timeout, true); 1171 return new AutomationProxy(execution_timeout, true);
1201 } 1172 }
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