Index: chrome/test/automation/browser_proxy.cc |
=================================================================== |
--- chrome/test/automation/browser_proxy.cc (revision 5928) |
+++ chrome/test/automation/browser_proxy.cc (working copy) |
@@ -286,6 +286,24 @@ |
return false; |
} |
+bool BrowserProxy::WaitForTabCountToBecome(int count, int wait_timeout) { |
+ const TimeTicks start = TimeTicks::Now(); |
+ const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout); |
+ while (TimeTicks::Now() - start < timeout) { |
+ Sleep(automation::kSleepTime); |
+ bool is_timeout; |
+ int new_count; |
+ bool succeeded = GetTabCountWithTimeout(&new_count, wait_timeout, |
+ &is_timeout); |
+ if (!succeeded) |
+ return false; |
+ if (count == new_count) |
+ return true; |
+ } |
+ // If we get here, the tab count doesn't match. |
+ return false; |
+} |
+ |
bool BrowserProxy::WaitForTabToBecomeActive(int tab, |
int wait_timeout) { |
const TimeTicks start = TimeTicks::Now(); |