summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation/automation_provider.cc
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 11:49:08 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 11:49:08 +0000
commit585b6bdeaf4104d26311f09dbb99f5085b5becb6 (patch)
tree737e492a12c1577ed730952080160fa07304fb12 /chrome/browser/automation/automation_provider.cc
parent88e71dc17b86efc2f4d70dee9a1bb4a71f86adc9 (diff)
downloadchromium_src-585b6bdeaf4104d26311f09dbb99f5085b5becb6.zip
chromium_src-585b6bdeaf4104d26311f09dbb99f5085b5becb6.tar.gz
chromium_src-585b6bdeaf4104d26311f09dbb99f5085b5becb6.tar.bz2
Add AutomationMsg_WaitForDownloadShelfVisibilityChange and use it in UITestBase for the download tests.
This should decrease flakiness of download tests. TEST=DownloadTest.*, especially DownloadTest.[Dont]CloseNewTab* BUG=43066 Review URL: http://codereview.chromium.org/1933005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46681 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_provider.cc')
-rw-r--r--chrome/browser/automation/automation_provider.cc35
1 files changed, 28 insertions, 7 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 76b9b9b..e907d45 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -213,11 +213,6 @@ NotificationObserver* AutomationProvider::AddNavigationStatusListener(
return observer;
}
-void AutomationProvider::RemoveNavigationStatusListener(
- NotificationObserver* obs) {
- notification_observer_list_.RemoveObserver(obs);
-}
-
NotificationObserver* AutomationProvider::AddTabStripObserver(
Browser* parent,
IPC::Message* reply_message) {
@@ -228,7 +223,7 @@ NotificationObserver* AutomationProvider::AddTabStripObserver(
return observer;
}
-void AutomationProvider::RemoveTabStripObserver(NotificationObserver* obs) {
+void AutomationProvider::RemoveObserver(NotificationObserver* obs) {
notification_observer_list_.RemoveObserver(obs);
}
@@ -496,6 +491,9 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AutomationMsg_SetEnableExtensionAutomation,
SetEnableExtensionAutomation)
#endif
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(
+ AutomationMsg_WaitForDownloadShelfVisibilityChange,
+ WaitForDownloadShelfVisibilityChange)
IPC_MESSAGE_HANDLER(AutomationMsg_SetShelfVisibility, SetShelfVisibility)
IPC_MESSAGE_HANDLER(AutomationMsg_BlockedPopupCount, GetBlockedPopupCount)
IPC_MESSAGE_HANDLER(AutomationMsg_SelectAll, SelectAll)
@@ -599,7 +597,7 @@ void AutomationProvider::AppendTab(int handle, const GURL& url,
if (append_tab_response < 0) {
// The append tab failed. Remove the TabStripObserver
if (observer) {
- RemoveTabStripObserver(observer);
+ RemoveObserver(observer);
delete observer;
}
@@ -1591,6 +1589,29 @@ void AutomationProvider::RemoveBookmark(int handle,
*success = false;
}
+void AutomationProvider::WaitForDownloadShelfVisibilityChange(
+ int browser_handle,
+ bool visibility,
+ IPC::Message* reply_message) {
+ bool success = false;
+ if (browser_tracker_->ContainsHandle(browser_handle)) {
+ Browser* browser = browser_tracker_->GetResource(browser_handle);
+ if (browser->window()->IsDownloadShelfVisible() == visibility) {
+ success = true;
+ } else {
+ notification_observer_list_.AddObserver(
+ new DownloadShelfVisibilityObserver(this,
+ browser,
+ visibility,
+ reply_message));
+ return;
+ }
+ }
+ AutomationMsg_WaitForDownloadShelfVisibilityChange::WriteReplyParams(
+ reply_message, success);
+ Send(reply_message);
+}
+
// Sample json input: { "command": "GetHistoryInfo",
// "search_text": "some text" }
// Refer chrome/test/pyautolib/history_info.py for sample json output.