summaryrefslogtreecommitdiffstats
path: root/chrome/test/automation/tab_proxy.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-08 22:04:40 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-08 22:04:40 +0000
commite04c7eacaa5092fa740c5ac330f4b8f01755fc2d (patch)
tree1cfd82a2b49c98aa26ab83767f821726ed8ad687 /chrome/test/automation/tab_proxy.cc
parenta233a64c05fa151f0a9d1eff6839962d23d82b17 (diff)
downloadchromium_src-e04c7eacaa5092fa740c5ac330f4b8f01755fc2d.zip
chromium_src-e04c7eacaa5092fa740c5ac330f4b8f01755fc2d.tar.gz
chromium_src-e04c7eacaa5092fa740c5ac330f4b8f01755fc2d.tar.bz2
GTTF: Make WaitForInfoBarCount not Sleep.
Use an observer instead, to wait more reliably. BUG=none TEST=none Review URL: http://codereview.chromium.org/3344006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58880 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation/tab_proxy.cc')
-rw-r--r--chrome/test/automation/tab_proxy.cc18
1 files changed, 7 insertions, 11 deletions
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index cf37561..3888c79 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -658,17 +658,13 @@ bool TabProxy::GetInfoBarCount(int* count) {
return sender_->Send(new AutomationMsg_GetInfoBarCount(0, handle_, count));
}
-bool TabProxy::WaitForInfoBarCount(int target_count, int wait_timeout) {
- int intervals = std::max(wait_timeout / automation::kSleepTime, 1);
- for (int i = 0; i < intervals; ++i) {
- PlatformThread::Sleep(automation::kSleepTime);
- int new_count = -1;
- if (!GetInfoBarCount(&new_count))
- return false;
- if (target_count == new_count)
- return true;
- }
- return false;
+bool TabProxy::WaitForInfoBarCount(int target_count) {
+ if (!is_valid())
+ return false;
+
+ bool success = false;
+ return sender_->Send(new AutomationMsg_WaitForInfoBarCount(
+ 0, handle_, target_count, &success)) && success;
}
bool TabProxy::ClickInfoBarAccept(int info_bar_index,