diff options
author | huanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-31 04:16:44 +0000 |
---|---|---|
committer | huanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-31 04:16:44 +0000 |
commit | 49a14a8af7d0186c0c6de56271dffdf54643b5fd (patch) | |
tree | 55403096e800c9c8685d800f313d5710afe02dc6 /chrome | |
parent | 80f8dafc252632661d8c26835f0d92b387390532 (diff) | |
download | chromium_src-49a14a8af7d0186c0c6de56271dffdf54643b5fd.zip chromium_src-49a14a8af7d0186c0c6de56271dffdf54643b5fd.tar.gz chromium_src-49a14a8af7d0186c0c6de56271dffdf54643b5fd.tar.bz2 |
Mechanic change based on comment from previous code review.
Rename RunCommand to RunCommandAsync and RunCommandSync to
RunCommand.
Review URL: http://codereview.chromium.org/57039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12836 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 11 | ||||
-rw-r--r-- | chrome/browser/download/save_page_uitest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/find_bar_win_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/test/automated_ui_tests/automated_ui_tests.cc | 68 | ||||
-rw-r--r-- | chrome/test/automated_ui_tests/automated_ui_tests.h | 4 | ||||
-rw-r--r-- | chrome/test/automation/automation_messages_internal.h | 4 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.cc | 16 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.h | 4 |
8 files changed, 56 insertions, 57 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 954db43..b3699b8 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -471,8 +471,8 @@ class ExecuteBrowserCommandObserver : public NotificationObserver { const NotificationSource& source, const NotificationDetails& details) { if (type == notification_type_) { - AutomationMsg_WindowExecuteCommandSync::WriteReplyParams(reply_message_, - true); + AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_, + true); automation_->Send(reply_message_); delete this; } else { @@ -837,9 +837,9 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { #if defined(OS_WIN) IPC_MESSAGE_HANDLER(AutomationMsg_WindowHWND, GetWindowHWND) #endif // defined(OS_WIN) - IPC_MESSAGE_HANDLER(AutomationMsg_WindowExecuteCommand, + IPC_MESSAGE_HANDLER(AutomationMsg_WindowExecuteCommandAsync, ExecuteBrowserCommand) - IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowExecuteCommandSync, + IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowExecuteCommand, ExecuteBrowserCommandWithNotification) IPC_MESSAGE_HANDLER(AutomationMsg_WindowViewBounds, WindowGetViewBounds) @@ -1335,8 +1335,7 @@ void AutomationProvider::ExecuteBrowserCommandWithNotification( return; } } - AutomationMsg_WindowExecuteCommandSync::WriteReplyParams(reply_message, - false); + AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message, false); Send(reply_message); } diff --git a/chrome/browser/download/save_page_uitest.cc b/chrome/browser/download/save_page_uitest.cc index 6531267..78e3759 100644 --- a/chrome/browser/download/save_page_uitest.cc +++ b/chrome/browser/download/save_page_uitest.cc @@ -135,7 +135,7 @@ TEST_F(SavePageTest, FilenameFromPageTitle) { scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); automation()->SavePackageShouldPromptUser(false); - EXPECT_TRUE(browser->RunCommand(IDC_SAVE_PAGE)); + EXPECT_TRUE(browser->RunCommandAsync(IDC_SAVE_PAGE)); EXPECT_TRUE(WaitForDownloadShelfVisible(tab.get())); automation()->SavePackageShouldPromptUser(true); @@ -158,7 +158,7 @@ TEST_F(SavePageTest, CleanFilenameFromPageTitle) { scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); automation()->SavePackageShouldPromptUser(false); - EXPECT_TRUE(browser->RunCommand(IDC_SAVE_PAGE)); + EXPECT_TRUE(browser->RunCommandAsync(IDC_SAVE_PAGE)); EXPECT_TRUE(WaitForDownloadShelfVisible(tab.get())); automation()->SavePackageShouldPromptUser(true); diff --git a/chrome/browser/views/find_bar_win_uitest.cc b/chrome/browser/views/find_bar_win_uitest.cc index 88dc0ed..e646fde 100644 --- a/chrome/browser/views/find_bar_win_uitest.cc +++ b/chrome/browser/views/find_bar_win_uitest.cc @@ -315,7 +315,7 @@ TEST_F(FindInPageControllerTest, FindDisappearOnNewTabAndHistory) { EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), true)); // Open History page. - EXPECT_TRUE(browser->RunCommand(IDC_SHOW_HISTORY)); + EXPECT_TRUE(browser->RunCommandAsync(IDC_SHOW_HISTORY)); // Wait for the Find box to disappear. EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), false)); diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc index 287e38e..d1fa0f1 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.cc +++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc @@ -416,7 +416,7 @@ bool AutomatedUITest::OpenAndActivateNewBrowserWindow() { } bool AutomatedUITest::BackButton() { - return RunCommand(IDC_BACK); + return RunCommandAsync(IDC_BACK); } bool AutomatedUITest::ChangeEncoding() { @@ -436,7 +436,7 @@ bool AutomatedUITest::ChangeEncoding() { index = base::RandInt(0, len); } - return RunCommand((*encodings)[index].encoding_id); + return RunCommandAsync((*encodings)[index].encoding_id); } bool AutomatedUITest::CloseActiveTab() { @@ -455,7 +455,7 @@ bool AutomatedUITest::CloseActiveTab() { automation()->GetBrowserWindowCount(&browser_windows_count); // Avoid quitting the application by not closing the last window. if (tab_count > 1) { - return_value = browser->RunCommand(IDC_CLOSE_TAB); + return_value = browser->RunCommandAsync(IDC_CLOSE_TAB); // Wait for the tab to close before we continue. if (!browser->WaitForTabCountToBecome(tab_count - 1, action_max_timeout_ms())) { @@ -463,7 +463,7 @@ bool AutomatedUITest::CloseActiveTab() { return false; } } else if (tab_count == 1 && browser_windows_count > 1) { - return_value = browser->RunCommand(IDC_CLOSE_TAB); + return_value = browser->RunCommandAsync(IDC_CLOSE_TAB); // Wait for the window to close before we continue. if (!automation()->WaitForWindowCountToBecome(browser_windows_count - 1, action_max_timeout_ms())) { @@ -478,31 +478,31 @@ bool AutomatedUITest::CloseActiveTab() { } bool AutomatedUITest::DuplicateTab() { - return RunCommand(IDC_DUPLICATE_TAB); + return RunCommandAsync(IDC_DUPLICATE_TAB); } bool AutomatedUITest::FindInPage() { - return RunCommand(IDC_FIND); + return RunCommandAsync(IDC_FIND); } bool AutomatedUITest::ForwardButton() { - return RunCommand(IDC_FORWARD); + return RunCommandAsync(IDC_FORWARD); } bool AutomatedUITest::GoOffTheRecord() { - return RunCommand(IDC_NEW_INCOGNITO_WINDOW); + return RunCommandAsync(IDC_NEW_INCOGNITO_WINDOW); } bool AutomatedUITest::Home() { - return RunCommand(IDC_HOME); + return RunCommandAsync(IDC_HOME); } bool AutomatedUITest::JavaScriptConsole() { - return RunCommand(IDC_JS_CONSOLE); + return RunCommandAsync(IDC_JS_CONSOLE); } bool AutomatedUITest::JavaScriptDebugger() { - return RunCommand(IDC_DEBUGGER); + return RunCommandAsync(IDC_DEBUGGER); } bool AutomatedUITest::Navigate() { @@ -547,35 +547,35 @@ bool AutomatedUITest::NewTab() { } // Apply accelerator and wait for a new tab to open, if either // fails, return false. Apply Accelerator takes care of logging its failure. - return RunCommandSync(IDC_NEW_TAB); + return RunCommand(IDC_NEW_TAB); } bool AutomatedUITest::OpenAboutDialog() { - return RunCommand(IDC_ABOUT); + return RunCommandAsync(IDC_ABOUT); } bool AutomatedUITest::OpenClearBrowsingDataDialog() { - return RunCommand(IDC_CLEAR_BROWSING_DATA); + return RunCommandAsync(IDC_CLEAR_BROWSING_DATA); } bool AutomatedUITest::OpenEditSearchEnginesDialog() { - return RunCommand(IDC_EDIT_SEARCH_ENGINES); + return RunCommandAsync(IDC_EDIT_SEARCH_ENGINES); } bool AutomatedUITest::OpenImportSettingsDialog() { - return RunCommand(IDC_IMPORT_SETTINGS); + return RunCommandAsync(IDC_IMPORT_SETTINGS); } bool AutomatedUITest::OpenTaskManagerDialog() { - return RunCommand(IDC_TASK_MANAGER); + return RunCommandAsync(IDC_TASK_MANAGER); } bool AutomatedUITest::OpenViewPasswordsDialog() { - return RunCommand(IDC_VIEW_PASSWORDS); + return RunCommandAsync(IDC_VIEW_PASSWORDS); } bool AutomatedUITest::Options() { - return RunCommand(IDC_OPTIONS); + return RunCommandAsync(IDC_OPTIONS); } bool AutomatedUITest::PressDownArrow() { @@ -611,47 +611,47 @@ bool AutomatedUITest::PressUpArrow() { } bool AutomatedUITest::ReloadPage() { - return RunCommand(IDC_RELOAD); + return RunCommandAsync(IDC_RELOAD); } bool AutomatedUITest::RestoreTab() { - return RunCommand(IDC_RESTORE_TAB); + return RunCommandAsync(IDC_RESTORE_TAB); } bool AutomatedUITest::SelectNextTab() { - return RunCommand(IDC_SELECT_NEXT_TAB); + return RunCommandAsync(IDC_SELECT_NEXT_TAB); } bool AutomatedUITest::SelectPreviousTab() { - return RunCommand(IDC_SELECT_PREVIOUS_TAB); + return RunCommandAsync(IDC_SELECT_PREVIOUS_TAB); } bool AutomatedUITest::ShowBookmarkBar() { - return RunCommand(IDC_SHOW_BOOKMARK_BAR); + return RunCommandAsync(IDC_SHOW_BOOKMARK_BAR); } bool AutomatedUITest::ShowDownloads() { - return RunCommand(IDC_SHOW_DOWNLOADS); + return RunCommandAsync(IDC_SHOW_DOWNLOADS); } bool AutomatedUITest::ShowHistory() { - return RunCommand(IDC_SHOW_HISTORY); + return RunCommandAsync(IDC_SHOW_HISTORY); } bool AutomatedUITest::StarPage() { - return RunCommand(IDC_STAR); + return RunCommandAsync(IDC_STAR); } bool AutomatedUITest::ViewSource() { - return RunCommand(IDC_VIEW_SOURCE); + return RunCommandAsync(IDC_VIEW_SOURCE); } bool AutomatedUITest::ZoomMinus() { - return RunCommand(IDC_ZOOM_MINUS); + return RunCommandAsync(IDC_ZOOM_MINUS); } bool AutomatedUITest::ZoomPlus() { - return RunCommand(IDC_ZOOM_PLUS); + return RunCommandAsync(IDC_ZOOM_PLUS); } bool AutomatedUITest::TestAboutChrome() { @@ -829,26 +829,26 @@ WindowProxy* AutomatedUITest::GetAndActivateWindowForBrowser( return window; } -bool AutomatedUITest::RunCommand(int browser_command) { +bool AutomatedUITest::RunCommandAsync(int browser_command) { scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow()); if (browser.get() == NULL) { AddErrorAttribute("browser_window_not_found"); return false; } - if (!browser->RunCommand(browser_command)) { + if (!browser->RunCommandAsync(browser_command)) { AddWarningAttribute("failure_running_browser_command"); return false; } return true; } -bool AutomatedUITest::RunCommandSync(int browser_command) { +bool AutomatedUITest::RunCommand(int browser_command) { scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow()); if (browser.get() == NULL) { AddErrorAttribute("browser_window_not_found"); return false; } - if (!browser->RunCommandSync(browser_command)) { + if (!browser->RunCommand(browser_command)) { AddWarningAttribute("failure_running_browser_command"); return false; } diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.h b/chrome/test/automated_ui_tests/automated_ui_tests.h index dcff882..a7b4c6d 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.h +++ b/chrome/test/automated_ui_tests/automated_ui_tests.h @@ -393,7 +393,7 @@ class AutomatedUITest : public UITest { // Returns true if the call is successfully dispatched. // Possible failures include the active window is not a browser window or // the message to apply the accelerator fails. - bool RunCommand(int browser_command); + bool RunCommandAsync(int browser_command); // Runs the specified browser command in the current active browser, wait // and return until the command has finished executing. @@ -402,7 +402,7 @@ class AutomatedUITest : public UITest { // Possible failures include the active window is not a browser window, or // the message to apply the accelerator fails, or the command execution // fails. - bool RunCommandSync(int browser_command); + bool RunCommand(int browser_command); // Calls SimulateOSKeyPress on the active window. Simulates a key press at // the OS level. |key| is the key pressed and |flags| specifies which diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index c0f3f9b..89e401b 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -711,7 +711,7 @@ IPC_BEGIN_MESSAGES(Automation) // This message requests the execution of a browser command in the browser // for which the handle is specified. // The return value contains a boolean, whether the command was dispatched. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WindowExecuteCommand, + IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WindowExecuteCommandAsync, int /* automation handle */, int /* browser command */, bool /* success flag */) @@ -720,7 +720,7 @@ IPC_BEGIN_MESSAGES(Automation) // for which the handle is specified. // The return value contains a boolean, whether the command was dispatched // and successful executed. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WindowExecuteCommandSync, + IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WindowExecuteCommand, int /* automation handle */, int /* browser command */, bool /* success flag */) diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index 240974e..4a7846e 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -281,28 +281,28 @@ bool BrowserProxy::GetHWND(HWND* handle) const { } #endif // defined(OS_WIN) -bool BrowserProxy::RunCommand(int browser_command) const { +bool BrowserProxy::RunCommandAsync(int browser_command) const { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_WindowExecuteCommand(0, handle_, - browser_command, - &result)); + sender_->Send(new AutomationMsg_WindowExecuteCommandAsync(0, handle_, + browser_command, + &result)); return result; } -bool BrowserProxy::RunCommandSync(int browser_command) const { +bool BrowserProxy::RunCommand(int browser_command) const { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_WindowExecuteCommandSync(0, handle_, - browser_command, - &result)); + sender_->Send(new AutomationMsg_WindowExecuteCommand(0, handle_, + browser_command, + &result)); return result; } diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h index 0e9107c..4c6884a 100644 --- a/chrome/test/automation/browser_proxy.h +++ b/chrome/test/automation/browser_proxy.h @@ -175,12 +175,12 @@ class BrowserProxy : public AutomationResourceProxy { // Run the specified command in the browser (see browser_commands.cc for the // list of supported commands). Returns true if the command was successfully // dispatched, false otherwise. - bool RunCommand(int browser_command) const; + bool RunCommandAsync(int browser_command) const; // Run the specified command in the browser (see browser_commands.cc for the // list of supported commands). Returns true if the command was successfully // dispatched and executed, false otherwise. - bool RunCommandSync(int browser_command) const; + bool RunCommand(int browser_command) const; // Returns whether the Bookmark bar is visible and whether we are animating // it into position. Returns false on failure. |