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

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

Issue 196096: First part of automated_ui_tests improvements.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: disable on lin/mac Created 11 years, 3 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
« no previous file with comments | « no previous file | chrome/test/automated_ui_tests/automated_ui_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/automation/automation_provider.cc
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 7e0d8032de5a364fbf57c5f62824fa17f1f345d1..b461636c606a74c4efb88004819e51a027756121 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -761,10 +761,31 @@ void AutomationProvider::ExecuteBrowserCommandAsync(int handle, int command,
void AutomationProvider::ExecuteBrowserCommand(
int handle, int command, IPC::Message* reply_message) {
+ // List of commands which just finish synchronously and don't require
+ // setting up an observer.
+ static const int kSynchronousCommands[] = {
+ IDC_HOME,
+ IDC_SELECT_NEXT_TAB,
+ IDC_SELECT_PREVIOUS_TAB,
+ IDC_SHOW_DOWNLOADS,
+ IDC_SHOW_HISTORY,
+ };
if (browser_tracker_->ContainsHandle(handle)) {
Browser* browser = browser_tracker_->GetResource(handle);
if (browser->command_updater()->SupportsCommand(command) &&
browser->command_updater()->IsCommandEnabled(command)) {
+ // First check if we can handle the command without using an observer.
+ for (size_t i = 0; i < arraysize(kSynchronousCommands); i++) {
+ if (command == kSynchronousCommands[i]) {
+ browser->ExecuteCommand(command);
+ AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message,
+ true);
+ Send(reply_message);
+ return;
+ }
+ }
+
+ // Use an observer if we have one, otherwise fail.
if (ExecuteBrowserCommandObserver::CreateAndRegisterObserver(
this, browser, command, reply_message)) {
browser->ExecuteCommand(command);
« no previous file with comments | « no previous file | chrome/test/automated_ui_tests/automated_ui_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698