diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-25 22:45:39 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-25 22:45:39 +0000 |
commit | d8375fdbe8d32ad3562152ecd53378383e393971 (patch) | |
tree | 8c8f3e524fb5e600095368e982e5730916259453 /chrome/test | |
parent | ec9f22cd4e7151ab3c3eb6ba47885bd75d342ae3 (diff) | |
download | chromium_src-d8375fdbe8d32ad3562152ecd53378383e393971.zip chromium_src-d8375fdbe8d32ad3562152ecd53378383e393971.tar.gz chromium_src-d8375fdbe8d32ad3562152ecd53378383e393971.tar.bz2 |
Changes tab restore service to handle restoring closed windows as a
single unit. Sadly I've written another ui test. Lets hope it isn't
flakey. Glen is going to change the NTP to deal with this appropriately.
BUG=4686
TEST=Try closing a window (with more than one window open), hitting
control-shift-t, and make sure the window and all it's tabs comes
back.
Review URL: http://codereview.chromium.org/11377
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/automation/browser_proxy.cc | 18 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.h | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index ce47335..faead8f 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -286,6 +286,24 @@ bool BrowserProxy::WaitForTabCountToChange(int count, int* new_count, 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(); diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h index b2c92ca..3cc681e 100644 --- a/chrome/test/automation/browser_proxy.h +++ b/chrome/test/automation/browser_proxy.h @@ -122,6 +122,9 @@ class BrowserProxy : public AutomationResourceProxy { // Returns false if the tab count does not change. bool WaitForTabCountToChange(int count, int* new_count, int wait_timeout); + // Block the thread until the tab count is |count|. + bool WaitForTabCountToBecome(int count, int wait_timeout); + // Block the thread until the specified tab is the active tab. // |wait_timeout| is the timeout, in milliseconds, for waiting. // Returns false if the tab does not become active. |