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

Side by Side Diff: chrome/test/automation/browser_proxy.cc

Issue 11377: Changes tab restore service to handle restoring closed windows as a... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years 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 | « chrome/test/automation/browser_proxy.h ('k') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/automation/browser_proxy.h" 5 #include "chrome/test/automation/browser_proxy.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 &is_timeout); 279 &is_timeout);
280 if (!succeeded) 280 if (!succeeded)
281 return false; 281 return false;
282 if (count != *new_count) 282 if (count != *new_count)
283 return true; 283 return true;
284 } 284 }
285 // If we get here, the tab count hasn't changed. 285 // If we get here, the tab count hasn't changed.
286 return false; 286 return false;
287 } 287 }
288 288
289 bool BrowserProxy::WaitForTabCountToBecome(int count, int wait_timeout) {
290 const TimeTicks start = TimeTicks::Now();
291 const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout);
292 while (TimeTicks::Now() - start < timeout) {
293 Sleep(automation::kSleepTime);
294 bool is_timeout;
295 int new_count;
296 bool succeeded = GetTabCountWithTimeout(&new_count, wait_timeout,
297 &is_timeout);
298 if (!succeeded)
299 return false;
300 if (count == new_count)
301 return true;
302 }
303 // If we get here, the tab count doesn't match.
304 return false;
305 }
306
289 bool BrowserProxy::WaitForTabToBecomeActive(int tab, 307 bool BrowserProxy::WaitForTabToBecomeActive(int tab,
290 int wait_timeout) { 308 int wait_timeout) {
291 const TimeTicks start = TimeTicks::Now(); 309 const TimeTicks start = TimeTicks::Now();
292 const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout); 310 const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout);
293 while (TimeTicks::Now() - start < timeout) { 311 while (TimeTicks::Now() - start < timeout) {
294 Sleep(automation::kSleepTime); 312 Sleep(automation::kSleepTime);
295 int active_tab; 313 int active_tab;
296 if (GetActiveTabIndex(&active_tab) && active_tab == tab) 314 if (GetActiveTabIndex(&active_tab) && active_tab == tab)
297 return true; 315 return true;
298 } 316 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 scoped_ptr<IPC::Message> response_deleter(response); // Delete on return. 406 scoped_ptr<IPC::Message> response_deleter(response); // Delete on return.
389 if (!success) 407 if (!success)
390 return false; 408 return false;
391 409
392 if (AutomationMsg_SetIntPreferenceResponse::Read(response, &success)) 410 if (AutomationMsg_SetIntPreferenceResponse::Read(response, &success))
393 return success; 411 return success;
394 412
395 // We failed to deserialize the returned value. 413 // We failed to deserialize the returned value.
396 return false; 414 return false;
397 } 415 }
OLDNEW
« no previous file with comments | « chrome/test/automation/browser_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698