diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-13 22:04:58 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-13 22:04:58 +0000 |
commit | 4440a58b8f7658021f9badf5d5e142fc61f288c6 (patch) | |
tree | 9ba043ce2dc73dbc36cdfb2e5d8c9e23343bdf0d /chrome/test/automation | |
parent | 5ccaa41d72d5241e76bad7f16c3e0147d990584b (diff) | |
download | chromium_src-4440a58b8f7658021f9badf5d5e142fc61f288c6.zip chromium_src-4440a58b8f7658021f9badf5d5e142fc61f288c6.tar.gz chromium_src-4440a58b8f7658021f9badf5d5e142fc61f288c6.tar.bz2 |
Notifications permission infobar should only be shown in response to a user gesture, not arbitrary script.
Experimental fix for UI test, so checking in flaky at first to see if I have it...
BUG=27215
TEST=included
Committed as r31839... and reverted.
Review URL: http://codereview.chromium.org/387011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31953 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation')
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 13 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.h | 5 |
2 files changed, 18 insertions, 0 deletions
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index c16044f..1b9b62d 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -618,6 +618,19 @@ 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::min(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::ClickInfoBarAccept(int info_bar_index, bool wait_for_navigation) { if (!is_valid()) diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index 9a5be9c..61ab571 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -318,6 +318,11 @@ class TabProxy : public AutomationResourceProxy { // Retrieves the number of info-bars currently showing in |count|. bool GetInfoBarCount(int* count); + // Waits for up to |wait_timeout| ms until the infobar count is |count|. + // Returns false if a timeout occurred before the count matched, or an + // error occurred retrieving the count. + bool WaitForInfoBarCount(int count, int wait_timeout); + // Causes a click on the "accept" button of the info-bar at |info_bar_index|. // If |wait_for_navigation| is true, this call does not return until a // navigation has occured. |