Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Unified Diff: chrome/browser/automation/automation_provider.cc

Issue 2280003: Use IPC to wait for download in DownloadTest. (Closed) Base URL: git://codf21.jail.google.com/chromium.git
Patch Set: Fix compile error. Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/automation/automation_provider.cc
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index eb165e1e9e5c88e545e9349ba3ebfe6a2b7c4471..b5718e52953908e6deb1d34f5733fac781f2bf39 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -216,11 +216,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) {
@@ -231,7 +226,7 @@ NotificationObserver* AutomationProvider::AddTabStripObserver(
return observer;
}
-void AutomationProvider::RemoveTabStripObserver(NotificationObserver* obs) {
+void AutomationProvider::RemoveObserver(NotificationObserver* obs) {
notification_observer_list_.RemoveObserver(obs);
}
@@ -499,6 +494,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)
@@ -602,7 +600,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;
}
@@ -1594,6 +1592,31 @@ void AutomationProvider::RemoveBookmark(int handle,
*success = false;
}
+void AutomationProvider::WaitForDownloadShelfVisibilityChange(
+ int browser_handle,
+ bool desired_visibility,
+ IPC::Message* reply_message) {
+ bool success = false;
+ if (browser_tracker_->ContainsHandle(browser_handle)) {
+ bool visibility = !desired_visibility;
+ GetShelfVisibility(browser_handle, &visibility);
+ if (visibility == desired_visibility) {
+ success = true;
+ } else {
+ Browser* browser = browser_tracker_->GetResource(browser_handle);
+ notification_observer_list_.AddObserver(
+ new DownloadShelfVisibilityObserver(this,
+ browser,
+ desired_visibility,
+ reply_message));
+ return;
+ }
+ }
+ AutomationMsg_WaitForDownloadShelfVisibilityChange::WriteReplyParams(
+ reply_message, success);
+ Send(reply_message);
+}
+
// Sample json input: { "command": "SetWindowDimensions",
// "x": 20, # optional
// "y": 20, # optional
« no previous file with comments | « chrome/browser/automation/automation_provider.h ('k') | chrome/browser/automation/automation_provider_observers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698