diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 22:15:34 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 22:15:34 +0000 |
commit | f5494d49ab74e3d116540b14db3457558f54c88e (patch) | |
tree | beb367c01c187652d02091a5067a69d5bc0fa064 /chrome/test/automation | |
parent | a9f39a313b7ecc11d98727d869e15094481f3a65 (diff) | |
download | chromium_src-f5494d49ab74e3d116540b14db3457558f54c88e.zip chromium_src-f5494d49ab74e3d116540b14db3457558f54c88e.tar.gz chromium_src-f5494d49ab74e3d116540b14db3457558f54c88e.tar.bz2 |
Clean up Automation and Chrome Frame IPC code.-only use routed messages when needed-use routing IDs to avoid manually unpacking messages-remove data structures from IPC namespace (that should only be used for IPC code, and param traits)Note that I temporarily commented out part of a test in external_tab_test.cc because I couldn't figure out how to get the updated gmock macros to compile.
Review URL: http://codereview.chromium.org/5998006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70105 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation')
-rw-r--r-- | chrome/test/automation/autocomplete_edit_proxy.cc | 10 | ||||
-rw-r--r-- | chrome/test/automation/automation_handle_tracker.cc | 2 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.cc | 51 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.h | 5 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.cc | 184 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.h | 37 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.cc | 86 | ||||
-rw-r--r-- | chrome/test/automation/extension_proxy.cc | 16 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 133 | ||||
-rw-r--r-- | chrome/test/automation/window_proxy.cc | 35 |
10 files changed, 265 insertions, 294 deletions
diff --git a/chrome/test/automation/autocomplete_edit_proxy.cc b/chrome/test/automation/autocomplete_edit_proxy.cc index 184239a..019326b 100644 --- a/chrome/test/automation/autocomplete_edit_proxy.cc +++ b/chrome/test/automation/autocomplete_edit_proxy.cc @@ -22,7 +22,7 @@ bool AutocompleteEditProxy::GetText(std::wstring* text) const { } bool result = false; sender_->Send(new AutomationMsg_AutocompleteEditGetText( - 0, handle_, &result, text)); + handle_, &result, text)); return result; } @@ -31,7 +31,7 @@ bool AutocompleteEditProxy::WaitForFocus() const { return false; bool edit_exists = false; sender_->Send(new AutomationMsg_WaitForAutocompleteEditFocus( - 0, handle_, &edit_exists)); + handle_, &edit_exists)); return edit_exists; } @@ -40,7 +40,7 @@ bool AutocompleteEditProxy::SetText(const std::wstring& text) { return false; bool result = false; sender_->Send(new AutomationMsg_AutocompleteEditSetText( - 0, handle_, text, &result)); + handle_, text, &result)); return result; } @@ -53,7 +53,7 @@ bool AutocompleteEditProxy::IsQueryInProgress(bool* query_in_progress) const { } bool edit_exists = false; sender_->Send(new AutomationMsg_AutocompleteEditIsQueryInProgress( - 0, handle_, &edit_exists, query_in_progress)); + handle_, &edit_exists, query_in_progress)); return edit_exists; } @@ -81,6 +81,6 @@ bool AutocompleteEditProxy::GetAutocompleteMatches(Matches* matches) const { } bool edit_exists = false; sender_->Send(new AutomationMsg_AutocompleteEditGetMatches( - 0, handle_, &edit_exists, matches)); + handle_, &edit_exists, matches)); return edit_exists; } diff --git a/chrome/test/automation/automation_handle_tracker.cc b/chrome/test/automation/automation_handle_tracker.cc index b5613a5..0ad7592 100644 --- a/chrome/test/automation/automation_handle_tracker.cc +++ b/chrome/test/automation/automation_handle_tracker.cc @@ -45,7 +45,7 @@ void AutomationHandleTracker::Remove(AutomationResourceProxy* proxy) { AutomationHandle proxy_handle = proxy->handle(); handle_to_object_.erase(iter); if (channel_) - channel_->Send(new AutomationMsg_HandleUnused(0, proxy_handle)); + channel_->Send(new AutomationMsg_HandleUnused(proxy_handle)); } } diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index cd5d9af..bf00ea6 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -227,13 +227,13 @@ void AutomationProxy::SignalNewTabUITab(int load_time) { } bool AutomationProxy::SavePackageShouldPromptUser(bool should_prompt) { - return Send(new AutomationMsg_SavePackageShouldPromptUser(0, should_prompt)); + return Send(new AutomationMsg_SavePackageShouldPromptUser(should_prompt)); } scoped_refptr<ExtensionProxy> AutomationProxy::InstallExtension( const FilePath& crx_file, bool with_ui) { int handle = 0; - if (!Send(new AutomationMsg_InstallExtensionAndGetHandle(0, crx_file, with_ui, + if (!Send(new AutomationMsg_InstallExtensionAndGetHandle(crx_file, with_ui, &handle))) return NULL; @@ -243,7 +243,7 @@ scoped_refptr<ExtensionProxy> AutomationProxy::InstallExtension( void AutomationProxy::EnsureExtensionTestResult() { bool result; std::string message; - if (!Send(new AutomationMsg_WaitForExtensionTestResult(0, &result, + if (!Send(new AutomationMsg_WaitForExtensionTestResult(&result, &message))) { FAIL() << "Could not send WaitForExtensionTestResult message"; return; @@ -253,8 +253,7 @@ void AutomationProxy::EnsureExtensionTestResult() { bool AutomationProxy::GetEnabledExtensions( std::vector<FilePath>* extension_directories) { - return Send(new AutomationMsg_GetEnabledExtensions( - 0, extension_directories)); + return Send(new AutomationMsg_GetEnabledExtensions(extension_directories)); } bool AutomationProxy::GetBrowserWindowCount(int* num_windows) { @@ -263,7 +262,7 @@ bool AutomationProxy::GetBrowserWindowCount(int* num_windows) { return false; } - return Send(new AutomationMsg_BrowserWindowCount(0, num_windows)); + return Send(new AutomationMsg_BrowserWindowCount(num_windows)); } bool AutomationProxy::GetNormalBrowserWindowCount(int* num_windows) { @@ -272,13 +271,13 @@ bool AutomationProxy::GetNormalBrowserWindowCount(int* num_windows) { return false; } - return Send(new AutomationMsg_NormalBrowserWindowCount(0, num_windows)); + return Send(new AutomationMsg_NormalBrowserWindowCount(num_windows)); } bool AutomationProxy::WaitForWindowCountToBecome(int count) { bool wait_success = false; if (!Send(new AutomationMsg_WaitForBrowserWindowCountToBecome( - 0, count, &wait_success))) { + count, &wait_success))) { return false; } return wait_success; @@ -295,7 +294,7 @@ bool AutomationProxy::GetShowingAppModalDialog( int button_int = 0; if (!Send(new AutomationMsg_ShowingAppModalDialog( - 0, showing_app_modal_dialog, &button_int))) { + showing_app_modal_dialog, &button_int))) { return false; } @@ -308,7 +307,7 @@ bool AutomationProxy::ClickAppModalDialogButton( bool succeeded = false; if (!Send(new AutomationMsg_ClickAppModalDialogButton( - 0, button, &succeeded))) { + button, &succeeded))) { return false; } @@ -317,7 +316,7 @@ bool AutomationProxy::ClickAppModalDialogButton( bool AutomationProxy::WaitForAppModalDialog() { bool wait_success = false; - if (!Send(new AutomationMsg_WaitForAppModalDialogToBeShown(0, &wait_success))) + if (!Send(new AutomationMsg_WaitForAppModalDialogToBeShown(&wait_success))) return false; return wait_success; } @@ -355,23 +354,23 @@ bool AutomationProxy::IsURLDisplayed(GURL url) { bool AutomationProxy::GetMetricEventDuration(const std::string& event_name, int* duration_ms) { - return Send(new AutomationMsg_GetMetricEventDuration(0, event_name, + return Send(new AutomationMsg_GetMetricEventDuration(event_name, duration_ms)); } bool AutomationProxy::SetFilteredInet(bool enabled) { - return Send(new AutomationMsg_SetFilteredInet(0, enabled)); + return Send(new AutomationMsg_SetFilteredInet(enabled)); } int AutomationProxy::GetFilteredInetHitCount() { int hit_count; - if (!Send(new AutomationMsg_GetFilteredInetHitCount(0, &hit_count))) + if (!Send(new AutomationMsg_GetFilteredInetHitCount(&hit_count))) return -1; return hit_count; } bool AutomationProxy::SendProxyConfig(const std::string& new_proxy_config) { - return Send(new AutomationMsg_SetProxyConfig(0, new_proxy_config)); + return Send(new AutomationMsg_SetProxyConfig(new_proxy_config)); } void AutomationProxy::Disconnect() { @@ -394,7 +393,7 @@ void AutomationProxy::OnChannelError() { scoped_refptr<WindowProxy> AutomationProxy::GetActiveWindow() { int handle = 0; - if (!Send(new AutomationMsg_ActiveWindow(0, &handle))) + if (!Send(new AutomationMsg_ActiveWindow(&handle))) return NULL; return ProxyObjectFromHandle<WindowProxy>(handle); @@ -403,7 +402,7 @@ scoped_refptr<WindowProxy> AutomationProxy::GetActiveWindow() { scoped_refptr<BrowserProxy> AutomationProxy::GetBrowserWindow( int window_index) { int handle = 0; - if (!Send(new AutomationMsg_BrowserWindow(0, window_index, &handle))) + if (!Send(new AutomationMsg_BrowserWindow(window_index, &handle))) return NULL; return ProxyObjectFromHandle<BrowserProxy>(handle); @@ -411,7 +410,7 @@ scoped_refptr<BrowserProxy> AutomationProxy::GetBrowserWindow( bool AutomationProxy::GetBrowserLocale(string16* locale) { DCHECK(locale != NULL); - if (!Send(new AutomationMsg_GetBrowserLocale(0, locale))) + if (!Send(new AutomationMsg_GetBrowserLocale(locale))) return false; return !locale->empty(); @@ -419,7 +418,7 @@ bool AutomationProxy::GetBrowserLocale(string16* locale) { scoped_refptr<BrowserProxy> AutomationProxy::FindNormalBrowserWindow() { int handle = 0; - if (!Send(new AutomationMsg_FindNormalBrowserWindow(0, &handle))) + if (!Send(new AutomationMsg_FindNormalBrowserWindow(&handle))) return NULL; return ProxyObjectFromHandle<BrowserProxy>(handle); @@ -427,7 +426,7 @@ scoped_refptr<BrowserProxy> AutomationProxy::FindNormalBrowserWindow() { scoped_refptr<BrowserProxy> AutomationProxy::GetLastActiveBrowserWindow() { int handle = 0; - if (!Send(new AutomationMsg_LastActiveBrowserWindow(0, &handle))) + if (!Send(new AutomationMsg_LastActiveBrowserWindow(&handle))) return NULL; return ProxyObjectFromHandle<BrowserProxy>(handle); @@ -475,21 +474,19 @@ void AutomationProxy::InvalidateHandle(const IPC::Message& message) { } bool AutomationProxy::OpenNewBrowserWindow(Browser::Type type, bool show) { - if (type == Browser::TYPE_NORMAL) - return Send(new AutomationMsg_OpenNewBrowserWindow(0, show)); return Send( - new AutomationMsg_OpenNewBrowserWindowOfType(0, static_cast<int>(type), + new AutomationMsg_OpenNewBrowserWindowOfType(static_cast<int>(type), show)); } scoped_refptr<TabProxy> AutomationProxy::CreateExternalTab( - const IPC::ExternalTabSettings& settings, + const ExternalTabSettings& settings, gfx::NativeWindow* external_tab_container, gfx::NativeWindow* tab) { int handle = 0; int session_id = 0; bool succeeded = - Send(new AutomationMsg_CreateExternalTab(0, settings, + Send(new AutomationMsg_CreateExternalTab(settings, external_tab_container, tab, &handle, @@ -539,7 +536,7 @@ void AutomationProxy::ResetChannel() { bool AutomationProxy::LoginWithUserAndPass(const std::string& username, const std::string& password) { bool success; - bool sent = Send(new AutomationMsg_LoginWithUserAndPass(0, username, + bool sent = Send(new AutomationMsg_LoginWithUserAndPass(username, password, &success)); // If message sending unsuccessful or test failed, return false. @@ -548,5 +545,5 @@ bool AutomationProxy::LoginWithUserAndPass(const std::string& username, #endif bool AutomationProxy::ResetToDefaultTheme() { - return Send(new AutomationMsg_ResetToDefaultTheme(0)); + return Send(new AutomationMsg_ResetToDefaultTheme()); } diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 7902ef0..b0cd74c 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -31,10 +31,7 @@ class BrowserProxy; class ExtensionProxy; class TabProxy; class WindowProxy; - -namespace IPC { struct ExternalTabSettings; -} // This is an interface that AutomationProxy-related objects can use to // access the message-sending abilities of the Proxy. @@ -235,7 +232,7 @@ class AutomationProxy : public IPC::Channel::Listener, // returns a TabProxy representing the tab as well as a window handle // that can be reparented in another process. scoped_refptr<TabProxy> CreateExternalTab( - const IPC::ExternalTabSettings& settings, + const ExternalTabSettings& settings, gfx::NativeWindow* external_tab_container, gfx::NativeWindow* tab); diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index d963f1d..9c36fe1 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -671,15 +671,15 @@ ExternalTabUITestMockClient::~ExternalTabUITestMockClient() { } void ExternalTabUITestMockClient::ReplyStarted( - const IPC::AutomationURLResponse* response, + const AutomationURLResponse* response, int tab_handle, int request_id) { - AutomationProxy::Send(new AutomationMsg_RequestStarted(0, tab_handle, + AutomationProxy::Send(new AutomationMsg_RequestStarted(tab_handle, request_id, *response)); } void ExternalTabUITestMockClient::ReplyData( const std::string* data, int tab_handle, int request_id) { - AutomationProxy::Send(new AutomationMsg_RequestData(0, tab_handle, + AutomationProxy::Send(new AutomationMsg_RequestData(tab_handle, request_id, *data)); } @@ -689,13 +689,13 @@ void ExternalTabUITestMockClient::ReplyEOF(int tab_handle, int request_id) { void ExternalTabUITestMockClient::ReplyEnd(const URLRequestStatus& status, int tab_handle, int request_id) { - AutomationProxy::Send(new AutomationMsg_RequestEnd(0, tab_handle, + AutomationProxy::Send(new AutomationMsg_RequestEnd(tab_handle, request_id, status)); } void ExternalTabUITestMockClient::Reply404(int tab_handle, int request_id) { - const IPC::AutomationURLResponse notfound("", "HTTP/1.1 404\r\n\r\n", 0, - base::Time(), "", 0); + const AutomationURLResponse notfound("", "HTTP/1.1 404\r\n\r\n", 0, + base::Time(), "", 0); ReplyStarted(¬found, tab_handle, request_id); ReplyEOF(tab_handle, request_id); } @@ -703,29 +703,29 @@ void ExternalTabUITestMockClient::Reply404(int tab_handle, int request_id) { void ExternalTabUITestMockClient::ServeHTMLData(int tab_handle, const GURL& url, const std::string& data) { - EXPECT_CALL(*this, OnRequestStart(tab_handle, _, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, url.spec()), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + EXPECT_CALL(*this, OnRequestStart(tab_handle, testing::AllOf( + testing::Field(&AutomationURLRequest::url, url.spec()), + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(this, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(this, &ExternalTabUITestMockClient::ReplyStarted, &http_200)))); - EXPECT_CALL(*this, OnRequestRead(tab_handle, _, testing::Gt(0))) + EXPECT_CALL(*this, OnRequestRead(tab_handle, testing::Gt(0))) .Times(2) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(this, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(this, &ExternalTabUITestMockClient::ReplyData, &data)))) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(this, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(this, &ExternalTabUITestMockClient::ReplyEOF)))); } void ExternalTabUITestMockClient::IgnoreFavIconNetworkRequest() { // Ignore favicon.ico - EXPECT_CALL(*this, OnRequestStart(_, _, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, + EXPECT_CALL(*this, OnRequestStart(_, testing::AllOf( + testing::Field(&AutomationURLRequest::url, testing::EndsWith("favicon.ico")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(testing::AnyNumber()) - .WillRepeatedly(testing::WithArgs<0, 1>(testing::Invoke( + .WillRepeatedly(testing::WithArgs<0, 0>(testing::Invoke( CreateFunctor(this, &ExternalTabUITestMockClient::ReplyEnd, URLRequestStatus(URLRequestStatus::FAILED, 0))))); } @@ -742,7 +742,7 @@ void ExternalTabUITestMockClient::InvalidateHandle( } // Most of the time we need external tab with these settings. -const IPC::ExternalTabSettings ExternalTabUITestMockClient::default_settings( +const ExternalTabSettings ExternalTabUITestMockClient::default_settings( NULL, gfx::Rect(), // will be replaced by CreateHostWindowAndTab WS_CHILD | WS_VISIBLE, false, // is_off_the_record @@ -754,7 +754,7 @@ const IPC::ExternalTabSettings ExternalTabUITestMockClient::default_settings( false); // route_all_top_level_navigations // static -const IPC::AutomationURLResponse ExternalTabUITestMockClient::http_200( +const AutomationURLResponse ExternalTabUITestMockClient::http_200( "", "HTTP/0.9 200\r\n\r\n", 0, @@ -775,12 +775,12 @@ void ExternalTabUITestMockClient::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab) IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, - OnNavigationStateChanged) + OnNavigationStateChanged) IPC_END_MESSAGE_MAP() } scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateHostWindowAndTab( - const IPC::ExternalTabSettings& settings) { + const ExternalTabSettings& settings) { EXPECT_THAT(settings.parent, testing::IsNull()); host_window_ = CreateWindowW(L"Button", NULL, host_window_style_, @@ -790,7 +790,7 @@ scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateHostWindowAndTab( RECT client_area = {0}; ::GetClientRect(host_window_, &client_area); - IPC::ExternalTabSettings s = settings; + ExternalTabSettings s = settings; s.parent = host_window_; s.dimensions = client_area; @@ -806,7 +806,7 @@ scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateHostWindowAndTab( scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateTabWithUrl( const GURL& initial_url) { - IPC::ExternalTabSettings settings = + ExternalTabSettings settings = ExternalTabUITestMockClient::default_settings; settings.initial_url = initial_url; return CreateHostWindowAndTab(settings); @@ -814,25 +814,25 @@ scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateTabWithUrl( void ExternalTabUITestMockClient::NavigateInExternalTab(int tab_handle, const GURL& url, const GURL& referrer /* = GURL()*/) { - channel_->ChannelProxy::Send(new AutomationMsg_NavigateInExternalTab(0, + channel_->ChannelProxy::Send(new AutomationMsg_NavigateInExternalTab( tab_handle, url, referrer, NULL)); } void ExternalTabUITestMockClient::ConnectToExternalTab(gfx::NativeWindow parent, - const IPC::AttachExternalTabParams& attach_params) { + const AttachExternalTabParams& attach_params) { gfx::NativeWindow tab_container = NULL; gfx::NativeWindow tab_window = NULL; int tab_handle = 0; int session_id = -1; - IPC::SyncMessage* message = new AutomationMsg_ConnectExternalTab(0, + IPC::SyncMessage* message = new AutomationMsg_ConnectExternalTab( attach_params.cookie, true, NULL, &tab_container, &tab_window, &tab_handle, &session_id); channel_->Send(message); RECT rect; ::GetClientRect(parent, &rect); - IPC::Reposition_Params params = {0}; + Reposition_Params params = {0}; params.window = tab_container; params.flags = SWP_NOZORDER | SWP_SHOWWINDOW; params.width = rect.right - rect.left; @@ -840,7 +840,7 @@ void ExternalTabUITestMockClient::ConnectToExternalTab(gfx::NativeWindow parent, params.set_parent = true; params.parent_window = parent; - channel_->Send(new AutomationMsg_TabReposition(0, tab_handle, params)); + channel_->Send(new AutomationMsg_TabReposition(tab_handle, params)); ::ShowWindow(parent, SW_SHOWNORMAL); } @@ -894,10 +894,10 @@ TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab1) { TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) + EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) .Times(1) .WillOnce(testing::InvokeWithoutArgs(mock_, &ExternalTabUITestMockClient::DestroyHostWindow)); @@ -917,10 +917,10 @@ TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab2) { TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) + EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) .Times(1) .WillOnce(testing::InvokeWithoutArgs(mock_, &ExternalTabUITestMockClient::DestroyHostWindow)); @@ -945,7 +945,7 @@ TEST_F(ExternalTabUITest, FLAKY_IncognitoMode) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); - IPC::ExternalTabSettings incognito = + ExternalTabSettings incognito = ExternalTabUITestMockClient::default_settings; incognito.is_off_the_record = true; // SetCookie is a sync call and deadlock can happen if window is visible, @@ -982,9 +982,9 @@ TEST_F(ExternalTabUITest, FLAKY_TabPostMessage) { TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); std::string content = "data:text/html,<html><head><script>" @@ -998,7 +998,7 @@ TEST_F(ExternalTabUITest, FLAKY_TabPostMessage) { "<body onload='onload()'>external tab test<br></div>" "</body></html>"; - EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) + EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) .Times(1) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor( ReceivePointer(tab), @@ -1006,7 +1006,7 @@ TEST_F(ExternalTabUITest, FLAKY_TabPostMessage) { std::string("Hello from gtest"), std::string("null"), std::string("*")))); - EXPECT_CALL(*mock_, OnForwardMessageToExternalHost(testing::_, + EXPECT_CALL(*mock_, OnForwardMessageToExternalHost( testing::StrEq("Hello from gtest"), testing::_, testing::_)) .Times(1) .WillOnce(testing::DoAll( @@ -1030,21 +1030,21 @@ TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { scoped_refptr<TabProxy> tab; TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); std::string kTestMessage("Hello from gtest"); std::string kTestOrigin("http://www.external.tab"); - EXPECT_CALL(*mock_, OnDidNavigate(1, testing::_)) + EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) .Times(1) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor( ReceivePointer(tab), &TabProxy::HandleMessageFromExternalHost, kTestMessage, kTestOrigin, std::string("http://localhost:1337/")))); - EXPECT_CALL(*mock_, OnForwardMessageToExternalHost(1, + EXPECT_CALL(*mock_, OnForwardMessageToExternalHost( testing::StrEq(kTestMessage), testing::_, testing::StrEq(GURL(kTestOrigin).GetOrigin().spec()))) @@ -1056,7 +1056,7 @@ TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); - IPC::ExternalTabSettings s = ExternalTabUITestMockClient::default_settings; + ExternalTabSettings s = ExternalTabUITestMockClient::default_settings; s.load_requests_via_automation = false; s.initial_url = GURL("http://localhost:1337/files/post_message.html"); tab = mock_->CreateHostWindowAndTab(s); @@ -1068,20 +1068,20 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStack) { scoped_refptr<TabProxy> tab; TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); std::string url = "http://placetogo.org"; testing::InSequence sequence; - EXPECT_CALL(*mock_, OnRequestStart(1, 2, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + EXPECT_CALL(*mock_, OnRequestStart(2, testing::AllOf( + testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) // We can simply do CreateFunctor(1, 2, &http_200) since we know the // tab handle and request id, but using WithArgs<> is much more fancy :) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyStarted, &ExternalTabUITestMockClient::http_200)))); @@ -1089,34 +1089,34 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStack) { const std::string data = "<!DOCTYPE html><title>Hello</title>" "<img src=\"logo.gif\">"; - EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) .Times(2) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyEOF)))); // Expect navigation is ok. - EXPECT_CALL(*mock_, OnDidNavigate(1, testing::Field(&IPC::NavigationInfo::url, - GURL(url)))) + EXPECT_CALL(*mock_, OnDidNavigate(testing::Field(&NavigationInfo::url, + GURL(url)))) .Times(1); // Expect GET request for logo.gif - EXPECT_CALL(*mock_, OnRequestStart(1, 3, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/logo.gif")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + EXPECT_CALL(*mock_, OnRequestStart(3, testing::AllOf( + testing::Field(&AutomationURLRequest::url, StrEq(url + "/logo.gif")), + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::Reply404, 1, 3))); - EXPECT_CALL(*mock_, OnRequestRead(1, 3, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(3, testing::Gt(0))) .Times(1); // Chrome makes a brave request for favicon.ico - EXPECT_CALL(*mock_, OnRequestStart(1, 4, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, + EXPECT_CALL(*mock_, OnRequestStart(4, testing::AllOf( + testing::Field(&AutomationURLRequest::url, StrEq(url + "/favicon.ico")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) .WillOnce(testing::DoAll( testing::InvokeWithoutArgs(CreateFunctor(mock_, @@ -1126,7 +1126,7 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStack) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); - EXPECT_CALL(*mock_, OnRequestRead(1, 4, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(4, testing::Gt(0))) .Times(1) .WillOnce(QUIT_LOOP_SOON(&loop, 300)); @@ -1139,36 +1139,36 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackAbortRequest) { scoped_refptr<TabProxy> tab; TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); std::string url = "http://placetogo.org"; testing::InSequence sequence; - EXPECT_CALL(*mock_, OnRequestStart(1, 2, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + EXPECT_CALL(*mock_, OnRequestStart(2, testing::AllOf( + testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) // We can simply do CreateFunctor(1, 2, &http_200) since we know the // tab handle and request id, but using WithArgs<> is much more fancy :) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyStarted, &ExternalTabUITestMockClient::http_200)))); // Return some trivial page, that have a link to a "logo.gif" image const std::string data = "<!DOCTYPE html><title>Hello"; - EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) .Times(2) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))) - .WillOnce(testing::WithArgs<0, 1>( + .WillOnce(testing::WithArgs<0, 0>( testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::DestroyHostWindow)))); EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); - EXPECT_CALL(*mock_, OnRequestEnd(1, 2, testing::_)) + EXPECT_CALL(*mock_, OnRequestEnd(2, testing::_)) .Times(1) .WillOnce(QUIT_LOOP_SOON(&loop, 300)); @@ -1181,24 +1181,24 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackUnresponsiveRenderer) { scoped_refptr<TabProxy> tab; TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); std::string url = "http://placetogo.org"; - EXPECT_CALL(*mock_, OnRequestStart(1, 3, testing::_)) + EXPECT_CALL(*mock_, OnRequestStart(3, testing::_)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(testing::AnyNumber()); testing::InSequence sequence; - EXPECT_CALL(*mock_, OnRequestStart(1, 2, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + EXPECT_CALL(*mock_, OnRequestStart(2, testing::AllOf( + testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) // We can simply do CreateFunctor(1, 2, &http_200) since we know the // tab handle and request id, but using WithArgs<> is much more fancy :) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyStarted, &ExternalTabUITestMockClient::http_200)))); @@ -1221,17 +1221,17 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackUnresponsiveRenderer) { const std::string tail = "</body></html>"; - EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) .Times(1) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyData, &head, 1, 2))); - EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) .Times(100) .WillRepeatedly(testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))); - EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) .Times(testing::AnyNumber()) .WillOnce(testing::DoAll( testing::InvokeWithoutArgs(CreateFunctor(mock_, @@ -1270,9 +1270,9 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_WindowDotOpen) { ASSERT_THAT(mock_, testing::NotNull()); mock_->IgnoreFavIconNetworkRequest(); // Ignore navigation state changes. - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(testing::AnyNumber()); GURL main_url("http://placetogo.com/"); std::string main_html = @@ -1281,7 +1281,7 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_WindowDotOpen) { "height=320,width=300,left=1');" "</script></head><body>Main.</body></html>"; mock_->ServeHTMLData(1, main_url, main_html); - EXPECT_CALL(*mock_, OnLoad(1, _)).Times(1); + EXPECT_CALL(*mock_, OnLoad(_)).Times(1); GURL popup1_url("http://placetogo.com/popup1.html"); std::string popup1_html = @@ -1289,12 +1289,12 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_WindowDotOpen) { "window.open('popup2.html','','');" "</script></head><body>Popup1.</body></html>"; mock_->ServeHTMLData(2, popup1_url, popup1_html); - EXPECT_CALL(*mock_, OnLoad(2, _)).Times(1); + EXPECT_CALL(*mock_, OnLoad(_)).Times(1); GURL popup2_url("http://placetogo.com/popup2.html"); std::string popup2_html = "<html><body>Popup2.</body></html>"; mock_->ServeHTMLData(3, popup2_url, popup2_html); - EXPECT_CALL(*mock_, OnLoad(3, _)).Times(1) + EXPECT_CALL(*mock_, OnLoad(_)).Times(1) .WillOnce(QUIT_LOOP_SOON(&loop, 500)); DWORD style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; @@ -1306,14 +1306,14 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_WindowDotOpen) { CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL); - EXPECT_CALL(*mock_, OnAttachExternalTab(1, _)) + EXPECT_CALL(*mock_, OnAttachExternalTab(_)) .Times(1) - .WillOnce(testing::WithArgs<1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ConnectToExternalTab, popup1_host)))); - EXPECT_CALL(*mock_, OnAttachExternalTab(2, _)) + EXPECT_CALL(*mock_, OnAttachExternalTab(_)) .Times(1) - .WillOnce(testing::WithArgs<1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ConnectToExternalTab, popup2_host)))); mock_->CreateTabWithUrl(main_url); @@ -1335,9 +1335,9 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_UserGestureTargetBlank) { ASSERT_THAT(mock_, testing::NotNull()); mock_->IgnoreFavIconNetworkRequest(); // Ignore navigation state changes. - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(testing::AnyNumber()); GURL main_url("http://placetogo.com/"); std::string main_html = "<!DOCTYPE html><title>Hello</title>" @@ -1349,11 +1349,11 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_UserGestureTargetBlank) { CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL); testing::InSequence s; - EXPECT_CALL(*mock_, OnLoad(1, _)) + EXPECT_CALL(*mock_, OnLoad(_)) .WillOnce(testing::InvokeWithoutArgs(testing::CreateFunctor(mock_, &ExternalTabUITestMockClient::NavigateThroughUserGesture))); - EXPECT_CALL(*mock_, OnAttachExternalTab(1, _)) + EXPECT_CALL(*mock_, OnAttachExternalTab(_)) .Times(1) .WillOnce(QUIT_LOOP_SOON(&loop, 500)); diff --git a/chrome/test/automation/automation_proxy_uitest.h b/chrome/test/automation/automation_proxy_uitest.h index cda06c1..35de197 100644 --- a/chrome/test/automation/automation_proxy_uitest.h +++ b/chrome/test/automation/automation_proxy_uitest.h @@ -37,35 +37,34 @@ class ExternalTabUITestMockClient : public AutomationProxy { explicit ExternalTabUITestMockClient(int execution_timeout); virtual ~ExternalTabUITestMockClient(); - MOCK_METHOD2(OnDidNavigate, void(int tab_handle, - const IPC::NavigationInfo& nav_info)); - MOCK_METHOD4(OnForwardMessageToExternalHost, void(int handle, + MOCK_METHOD1(OnDidNavigate, void(const NavigationInfo& nav_info)); + MOCK_METHOD3(OnForwardMessageToExternalHost, void( const std::string& message, const std::string& origin, const std::string& target)); - MOCK_METHOD3(OnRequestStart, void(int tab_handle, int request_id, - const IPC::AutomationURLRequest& request)); - MOCK_METHOD3(OnRequestRead, void(int tab_handle, int request_id, + MOCK_METHOD2(OnRequestStart, void(int request_id, + const AutomationURLRequest& request)); + MOCK_METHOD2(OnRequestRead, void(int request_id, int bytes_to_read)); - MOCK_METHOD3(OnRequestEnd, void(int tab_handle, int request_id, + MOCK_METHOD2(OnRequestEnd, void(int request_id, const URLRequestStatus& status)); - MOCK_METHOD3(OnSetCookieAsync, void(int tab_handle, const GURL& url, + MOCK_METHOD2(OnSetCookieAsync, void(const GURL& url, const std::string& cookie)); MOCK_METHOD1(HandleClosed, void(int handle)); - MOCK_METHOD4(OnOpenURL, void(int tab_handle, const GURL& url, + MOCK_METHOD3(OnOpenURL, void(const GURL& url, const GURL& referrer, int open_disposition)); - MOCK_METHOD3(OnNavigationStateChanged, void(int tab_handle, int flags, - const IPC::NavigationInfo& nav_info)); - MOCK_METHOD2(OnAttachExternalTab, void(int tab_handle, - const IPC::AttachExternalTabParams& params)); - MOCK_METHOD2(OnLoad, void(int tab_handle, const GURL&url)); + MOCK_METHOD2(OnNavigationStateChanged, void(int flags, + const NavigationInfo& nav_info)); + MOCK_METHOD1(OnAttachExternalTab, void( + const AttachExternalTabParams& params)); + MOCK_METHOD1(OnLoad, void(const GURL&url)); // Action helpers for OnRequest* incoming messages. Create the message and // delegate sending to the base class. Apparently we do not have wrappers // in AutomationProxy for these messages. - void ReplyStarted(const IPC::AutomationURLResponse* response, + void ReplyStarted(const AutomationURLResponse* response, int tab_handle, int request_id); void ReplyData(const std::string* data, int tab_handle, int request_id); void ReplyEOF(int tab_handle, int request_id); @@ -74,7 +73,7 @@ class ExternalTabUITestMockClient : public AutomationProxy { // Test setup helpers scoped_refptr<TabProxy> CreateHostWindowAndTab( - const IPC::ExternalTabSettings& settings); + const ExternalTabSettings& settings); scoped_refptr<TabProxy> CreateTabWithUrl(const GURL& initial_url); void NavigateInExternalTab(int tab_handle, const GURL& url, const GURL& referrer = GURL()); @@ -84,7 +83,7 @@ class ExternalTabUITestMockClient : public AutomationProxy { void IgnoreFavIconNetworkRequest(); void ConnectToExternalTab(gfx::NativeWindow parent, - const IPC::AttachExternalTabParams& attach_params); + const AttachExternalTabParams& attach_params); // Helper for network requests. void ServeHTMLData(int tab_handle, const GURL& url, const std::string& data); // Destroys the host window. @@ -96,8 +95,8 @@ class ExternalTabUITestMockClient : public AutomationProxy { // very possible. unsigned long host_window_style_; - static const IPC::AutomationURLResponse http_200; - static const IPC::ExternalTabSettings default_settings; + static const AutomationURLResponse http_200; + static const ExternalTabSettings default_settings; protected: gfx::NativeWindow host_window_; diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index 3bcd101..ae18470 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -29,7 +29,7 @@ bool BrowserProxy::ActivateTab(int tab_index) { int activate_tab_response = -1; if (!sender_->Send(new AutomationMsg_ActivateTab( - 0, handle_, tab_index, &activate_tab_response))) { + handle_, tab_index, &activate_tab_response))) { return false; } @@ -46,7 +46,7 @@ bool BrowserProxy::BringToFront() { bool succeeded = false; if (!sender_->Send(new AutomationMsg_BringBrowserToFront( - 0, handle_, &succeeded))) { + handle_, &succeeded))) { return false; } @@ -57,7 +57,7 @@ bool BrowserProxy::IsMenuCommandEnabled(int id, bool* enabled) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_IsMenuCommandEnabled(0, handle_, id, + return sender_->Send(new AutomationMsg_IsMenuCommandEnabled(handle_, id, enabled)); } @@ -67,7 +67,7 @@ bool BrowserProxy::AppendTab(const GURL& tab_url) { int append_tab_response = -1; - sender_->Send(new AutomationMsg_AppendTab(0, handle_, tab_url, + sender_->Send(new AutomationMsg_AppendTab(handle_, tab_url, &append_tab_response)); return append_tab_response >= 0; } @@ -84,7 +84,7 @@ bool BrowserProxy::GetActiveTabIndex(int* active_tab_index) const { int active_tab_index_response = -1; if (!sender_->Send(new AutomationMsg_ActiveTabIndex( - 0, handle_, &active_tab_index_response))) { + handle_, &active_tab_index_response))) { return false; } @@ -102,7 +102,7 @@ scoped_refptr<TabProxy> BrowserProxy::GetTab(int tab_index) const { int tab_handle = 0; - sender_->Send(new AutomationMsg_Tab(0, handle_, tab_index, &tab_handle)); + sender_->Send(new AutomationMsg_Tab(handle_, tab_index, &tab_handle)); if (!tab_handle) return NULL; @@ -137,7 +137,7 @@ bool BrowserProxy::GetTabCount(int* num_tabs) const { int tab_count_response = -1; if (!sender_->Send(new AutomationMsg_TabCount( - 0, handle_, &tab_count_response))) { + handle_, &tab_count_response))) { return false; } @@ -159,7 +159,7 @@ bool BrowserProxy::GetType(Browser::Type* type) const { } int type_as_int; - if (!sender_->Send(new AutomationMsg_Type(0, handle_, &type_as_int))) + if (!sender_->Send(new AutomationMsg_Type(handle_, &type_as_int))) return false; *type = static_cast<Browser::Type>(type_as_int); @@ -184,7 +184,7 @@ bool BrowserProxy::SimulateDrag(const gfx::Point& start, bool result = false; if (!sender_->Send(new AutomationMsg_WindowDrag( - 0, handle_, drag_path, flags, press_escape_en_route, &result))) { + handle_, drag_path, flags, press_escape_en_route, &result))) { return false; } @@ -194,7 +194,7 @@ bool BrowserProxy::SimulateDrag(const gfx::Point& start, bool BrowserProxy::WaitForTabCountToBecome(int count) { bool success = false; if (!sender_->Send(new AutomationMsg_WaitForTabCountToBecome( - 0, handle_, count, &success))) { + handle_, count, &success))) { return false; } @@ -219,7 +219,7 @@ bool BrowserProxy::OpenFindInPage() { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_OpenFindInPage(0, handle_)); + return sender_->Send(new AutomationMsg_OpenFindInPage(handle_)); // This message expects no response. } @@ -227,8 +227,7 @@ bool BrowserProxy::GetFindWindowLocation(int* x, int* y) { if (!is_valid() || !x || !y) return false; - return sender_->Send( - new AutomationMsg_FindWindowLocation(0, handle_, x, y)); + return sender_->Send(new AutomationMsg_FindWindowLocation(handle_, x, y)); } bool BrowserProxy::IsFindWindowFullyVisible(bool* is_visible) { @@ -241,7 +240,7 @@ bool BrowserProxy::IsFindWindowFullyVisible(bool* is_visible) { } return sender_->Send( - new AutomationMsg_FindWindowVisibility(0, handle_, is_visible)); + new AutomationMsg_FindWindowVisibility(handle_, is_visible)); } bool BrowserProxy::RunCommandAsync(int browser_command) const { @@ -250,7 +249,7 @@ bool BrowserProxy::RunCommandAsync(int browser_command) const { bool result = false; - sender_->Send(new AutomationMsg_WindowExecuteCommandAsync(0, handle_, + sender_->Send(new AutomationMsg_WindowExecuteCommandAsync(handle_, browser_command, &result)); @@ -263,7 +262,7 @@ bool BrowserProxy::RunCommand(int browser_command) const { bool result = false; - sender_->Send(new AutomationMsg_WindowExecuteCommand(0, handle_, + sender_->Send(new AutomationMsg_WindowExecuteCommand(handle_, browser_command, &result)); @@ -281,7 +280,7 @@ bool BrowserProxy::GetBookmarkBarVisibility(bool* is_visible, } return sender_->Send(new AutomationMsg_BookmarkBarVisibility( - 0, handle_, is_visible, is_animating)); + handle_, is_visible, is_animating)); } bool BrowserProxy::GetBookmarksAsJSON(std::string *json_string) { @@ -292,7 +291,7 @@ bool BrowserProxy::GetBookmarksAsJSON(std::string *json_string) { return false; bool result = false; - sender_->Send(new AutomationMsg_GetBookmarksAsJSON(0, handle_, + sender_->Send(new AutomationMsg_GetBookmarksAsJSON(handle_, json_string, &result)); return result; @@ -303,8 +302,7 @@ bool BrowserProxy::WaitForBookmarkModelToLoad() { return false; bool result = false; - sender_->Send(new AutomationMsg_WaitForBookmarkModelToLoad(0, handle_, - &result)); + sender_->Send(new AutomationMsg_WaitForBookmarkModelToLoad(handle_, &result)); return result; } @@ -313,7 +311,7 @@ bool BrowserProxy::AddBookmarkGroup(int64 parent_id, int index, if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_AddBookmarkGroup(0, handle_, + sender_->Send(new AutomationMsg_AddBookmarkGroup(handle_, parent_id, index, title, &result)); @@ -325,7 +323,7 @@ bool BrowserProxy::AddBookmarkURL(int64 parent_id, int index, if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_AddBookmarkURL(0, handle_, + sender_->Send(new AutomationMsg_AddBookmarkURL(handle_, parent_id, index, title, url, &result)); @@ -336,7 +334,7 @@ bool BrowserProxy::ReparentBookmark(int64 id, int64 new_parent_id, int index) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_ReparentBookmark(0, handle_, + sender_->Send(new AutomationMsg_ReparentBookmark(handle_, id, new_parent_id, index, &result)); @@ -347,7 +345,7 @@ bool BrowserProxy::SetBookmarkTitle(int64 id, const std::wstring& title) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_SetBookmarkTitle(0, handle_, + sender_->Send(new AutomationMsg_SetBookmarkTitle(handle_, id, title, &result)); return result; @@ -357,7 +355,7 @@ bool BrowserProxy::SetBookmarkURL(int64 id, const GURL& url) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_SetBookmarkURL(0, handle_, + sender_->Send(new AutomationMsg_SetBookmarkURL(handle_, id, url, &result)); return result; @@ -367,7 +365,7 @@ bool BrowserProxy::RemoveBookmark(int64 id) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_RemoveBookmark(0, handle_, + sender_->Send(new AutomationMsg_RemoveBookmark(handle_, id, &result)); return result; @@ -382,7 +380,7 @@ bool BrowserProxy::IsShelfVisible(bool* is_visible) { return false; } - return sender_->Send(new AutomationMsg_ShelfVisibility(0, handle_, + return sender_->Send(new AutomationMsg_ShelfVisibility(handle_, is_visible)); } @@ -390,7 +388,7 @@ bool BrowserProxy::SetShelfVisible(bool is_visible) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_SetShelfVisibility(0, handle_, + return sender_->Send(new AutomationMsg_SetShelfVisibility(handle_, is_visible)); } @@ -400,7 +398,7 @@ bool BrowserProxy::SetIntPreference(const std::string& name, int value) { bool result = false; - sender_->Send(new AutomationMsg_SetIntPreference(0, handle_, name, value, + sender_->Send(new AutomationMsg_SetIntPreference(handle_, name, value, &result)); return result; } @@ -412,7 +410,7 @@ bool BrowserProxy::SetStringPreference(const std::string& name, bool result = false; - sender_->Send(new AutomationMsg_SetStringPreference(0, handle_, name, value, + sender_->Send(new AutomationMsg_SetStringPreference(handle_, name, value, &result)); return result; } @@ -424,7 +422,7 @@ bool BrowserProxy::GetBooleanPreference(const std::string& name, bool result = false; - sender_->Send(new AutomationMsg_GetBooleanPreference(0, handle_, name, value, + sender_->Send(new AutomationMsg_GetBooleanPreference(handle_, name, value, &result)); return result; } @@ -436,7 +434,7 @@ bool BrowserProxy::SetBooleanPreference(const std::string& name, bool result = false; - sender_->Send(new AutomationMsg_SetBooleanPreference(0, handle_, name, + sender_->Send(new AutomationMsg_SetBooleanPreference(handle_, name, value, &result)); return result; } @@ -454,7 +452,7 @@ bool BrowserProxy::SetContentSetting(const std::string& host, bool result = false; - sender_->Send(new AutomationMsg_SetContentSetting(0, handle_, host, + sender_->Send(new AutomationMsg_SetContentSetting(handle_, host, content_type, setting, &result)); return result; @@ -466,7 +464,7 @@ bool BrowserProxy::TerminateSession() { bool result = false; - sender_->Send(new AutomationMsg_TerminateSession(0, handle_, &result)); + sender_->Send(new AutomationMsg_TerminateSession(handle_, &result)); return result; } @@ -478,7 +476,7 @@ scoped_refptr<WindowProxy> BrowserProxy::GetWindow() const { bool handle_ok = false; int window_handle = 0; - sender_->Send(new AutomationMsg_WindowForBrowser(0, handle_, &handle_ok, + sender_->Send(new AutomationMsg_WindowForBrowser(handle_, &handle_ok, &window_handle)); if (!handle_ok) return NULL; @@ -504,7 +502,7 @@ scoped_refptr<AutocompleteEditProxy> BrowserProxy::GetAutocompleteEdit() { int autocomplete_edit_handle = 0; sender_->Send(new AutomationMsg_AutocompleteEditForBrowser( - 0, handle_, &handle_ok, &autocomplete_edit_handle)); + handle_, &handle_ok, &autocomplete_edit_handle)); if (!handle_ok) return NULL; @@ -529,8 +527,7 @@ bool BrowserProxy::IsFullscreen(bool* is_fullscreen) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_IsFullscreen(0, handle_, - is_fullscreen)); + return sender_->Send(new AutomationMsg_IsFullscreen(handle_, is_fullscreen)); } bool BrowserProxy::IsFullscreenBubbleVisible(bool* is_visible) { @@ -539,14 +536,14 @@ bool BrowserProxy::IsFullscreenBubbleVisible(bool* is_visible) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_IsFullscreenBubbleVisible(0, handle_, + return sender_->Send(new AutomationMsg_IsFullscreenBubbleVisible(handle_, is_visible)); } bool BrowserProxy::ShutdownSessionService() { bool did_shutdown = false; bool succeeded = sender_->Send( - new AutomationMsg_ShutdownSessionService(0, handle_, &did_shutdown)); + new AutomationMsg_ShutdownSessionService(handle_, &did_shutdown)); if (!succeeded) { DLOG(ERROR) << @@ -562,8 +559,8 @@ bool BrowserProxy::StartTrackingPopupMenus() { return false; bool result = false; - if (!sender_->Send(new AutomationMsg_StartTrackingPopupMenus - (0, handle_, &result))) + if (!sender_->Send(new AutomationMsg_StartTrackingPopupMenus( + handle_, &result))) return false; return result; } @@ -573,8 +570,7 @@ bool BrowserProxy::WaitForPopupMenuToOpen() { return false; bool result = false; - if (!sender_->Send(new AutomationMsg_WaitForPopupMenuToOpen - (0, &result))) + if (!sender_->Send(new AutomationMsg_WaitForPopupMenuToOpen(&result))) return false; return result; } @@ -585,7 +581,7 @@ bool BrowserProxy::SendJSONRequest(const std::string& request, return false; bool result = false; - return sender_->Send(new AutomationMsg_SendJSONRequest(0, handle_, + return sender_->Send(new AutomationMsg_SendJSONRequest(handle_, request, response, &result)); return result; diff --git a/chrome/test/automation/extension_proxy.cc b/chrome/test/automation/extension_proxy.cc index 4390c10..147df636 100644 --- a/chrome/test/automation/extension_proxy.cc +++ b/chrome/test/automation/extension_proxy.cc @@ -21,8 +21,7 @@ bool ExtensionProxy::Uninstall() { return false; bool success = false; - if (!sender_->Send(new AutomationMsg_UninstallExtension(0, handle_, - &success))) + if (!sender_->Send(new AutomationMsg_UninstallExtension(handle_, &success))) return false; return success; } @@ -32,8 +31,7 @@ bool ExtensionProxy::Enable() { return false; bool success = false; - if (!sender_->Send(new AutomationMsg_EnableExtension(0, handle_, - &success))) + if (!sender_->Send(new AutomationMsg_EnableExtension(handle_, &success))) return false; return success; } @@ -43,8 +41,7 @@ bool ExtensionProxy::Disable() { return false; bool success = false; - if (!sender_->Send(new AutomationMsg_DisableExtension(0, handle_, - &success))) + if (!sender_->Send(new AutomationMsg_DisableExtension(handle_, &success))) return false; return success; } @@ -55,7 +52,7 @@ bool ExtensionProxy::ExecuteActionInActiveTabAsync(BrowserProxy* browser) { bool success = false; if (!sender_->Send(new AutomationMsg_ExecuteExtensionActionInActiveTabAsync( - 0, handle_, browser->handle(), &success))) + handle_, browser->handle(), &success))) return false; return success; } @@ -65,8 +62,7 @@ bool ExtensionProxy::MoveBrowserAction(int index) { return false; bool success = false; if (!sender_->Send( - new AutomationMsg_MoveExtensionBrowserAction(0, handle_, index, - &success))) + new AutomationMsg_MoveExtensionBrowserAction(handle_, index, &success))) return false; return success; } @@ -135,7 +131,7 @@ bool ExtensionProxy::GetProperty(AutomationMsg_ExtensionProperty type, return false; bool success = false; - if (!sender_->Send(new AutomationMsg_GetExtensionProperty(0, handle_, type, + if (!sender_->Send(new AutomationMsg_GetExtensionProperty(handle_, type, &success, value))) return false; return success; diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index fdce639..dbf298c 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -33,7 +33,7 @@ bool TabProxy::GetTabTitle(std::wstring* title) const { int tab_title_size_response = 0; bool succeeded = sender_->Send( - new AutomationMsg_TabTitle(0, handle_, &tab_title_size_response, title)); + new AutomationMsg_TabTitle(handle_, &tab_title_size_response, title)); return succeeded; } @@ -46,7 +46,7 @@ bool TabProxy::GetTabIndex(int* index) const { return false; } - return sender_->Send(new AutomationMsg_TabIndex(0, handle_, index)); + return sender_->Send(new AutomationMsg_TabIndex(handle_, index)); } int TabProxy::FindInPage(const std::wstring& search_string, @@ -66,7 +66,7 @@ int TabProxy::FindInPage(const std::wstring& search_string, int matches = 0; int ordinal2 = 0; - bool succeeded = sender_->Send(new AutomationMsg_Find(0, handle_, + bool succeeded = sender_->Send(new AutomationMsg_Find(handle_, params, &ordinal2, &matches)); @@ -91,15 +91,8 @@ AutomationMsg_NavigationResponseValues AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; - if (number_of_navigations == 1) { - // TODO(phajdan.jr): Remove when the reference build gets updated. - // This is only for backwards compatibility. - sender_->Send(new AutomationMsg_NavigateToURL(0, handle_, url, - &navigate_response)); - } else { - sender_->Send(new AutomationMsg_NavigateToURLBlockUntilNavigationsComplete( - 0, handle_, url, number_of_navigations, &navigate_response)); - } + sender_->Send(new AutomationMsg_NavigateToURLBlockUntilNavigationsComplete( + handle_, url, number_of_navigations, &navigate_response)); return navigate_response; } @@ -111,7 +104,7 @@ bool TabProxy::SetAuth(const std::wstring& username, AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_SetAuth(0, handle_, username, password, + sender_->Send(new AutomationMsg_SetAuth(handle_, username, password, &navigate_response)); return navigate_response == AUTOMATION_MSG_NAVIGATION_SUCCESS; } @@ -122,7 +115,7 @@ bool TabProxy::CancelAuth() { AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_CancelAuth(0, handle_, &navigate_response)); + sender_->Send(new AutomationMsg_CancelAuth(handle_, &navigate_response)); return navigate_response == AUTOMATION_MSG_NAVIGATION_SUCCESS; } @@ -131,7 +124,7 @@ bool TabProxy::NeedsAuth() const { return false; bool needs_auth = false; - sender_->Send(new AutomationMsg_NeedsAuth(0, handle_, &needs_auth)); + sender_->Send(new AutomationMsg_NeedsAuth(handle_, &needs_auth)); return needs_auth; } @@ -147,7 +140,7 @@ AutomationMsg_NavigationResponseValues AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; sender_->Send(new AutomationMsg_GoBackBlockUntilNavigationsComplete( - 0, handle_, number_of_navigations, &navigate_response)); + handle_, number_of_navigations, &navigate_response)); return navigate_response; } @@ -164,7 +157,7 @@ AutomationMsg_NavigationResponseValues AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; sender_->Send(new AutomationMsg_GoForwardBlockUntilNavigationsComplete( - 0, handle_, number_of_navigations, &navigate_response)); + handle_, number_of_navigations, &navigate_response)); return navigate_response; } @@ -174,14 +167,14 @@ AutomationMsg_NavigationResponseValues TabProxy::Reload() { AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_Reload(0, handle_, &navigate_response)); + sender_->Send(new AutomationMsg_Reload(handle_, &navigate_response)); return navigate_response; } bool TabProxy::GetRedirectsFrom(const GURL& source_url, std::vector<GURL>* redirects) { bool succeeded = false; - sender_->Send(new AutomationMsg_RedirectsFrom(0, handle_, + sender_->Send(new AutomationMsg_RedirectsFrom(handle_, source_url, &succeeded, redirects)); @@ -198,7 +191,7 @@ bool TabProxy::GetCurrentURL(GURL* url) const { } bool succeeded = false; - sender_->Send(new AutomationMsg_TabURL(0, handle_, &succeeded, url)); + sender_->Send(new AutomationMsg_TabURL(handle_, &succeeded, url)); return succeeded; } @@ -207,8 +200,7 @@ bool TabProxy::NavigateToURLAsync(const GURL& url) { return false; bool status = false; - sender_->Send(new AutomationMsg_NavigationAsync(0, - handle_, + sender_->Send(new AutomationMsg_NavigationAsync(handle_, url, &status)); return status; @@ -221,8 +213,7 @@ bool TabProxy::NavigateToURLAsyncWithDisposition( return false; bool status = false; - sender_->Send(new AutomationMsg_NavigationAsyncWithDisposition(0, - handle_, + sender_->Send(new AutomationMsg_NavigationAsyncWithDisposition(handle_, url, disposition, &status)); @@ -238,7 +229,7 @@ bool TabProxy::GetProcessID(int* process_id) const { return false; } - return sender_->Send(new AutomationMsg_TabProcessID(0, handle_, process_id)); + return sender_->Send(new AutomationMsg_TabProcessID(handle_, process_id)); } bool TabProxy::ExecuteAndExtractString(const std::wstring& frame_xpath, @@ -323,7 +314,7 @@ bool TabProxy::ExecuteAndExtractValue(const std::wstring& frame_xpath, } std::string json; - if (!sender_->Send(new AutomationMsg_DomOperation(0, handle_, frame_xpath, + if (!sender_->Send(new AutomationMsg_DomOperation(handle_, frame_xpath, jscript, &json))) return false; // Wrap |json| in an array before deserializing because valid JSON has an @@ -352,7 +343,7 @@ bool TabProxy::SetEnableExtensionAutomation( return false; return sender_->Send(new AutomationMsg_SetEnableExtensionAutomation( - 0, handle_, functions_enabled)); + handle_, functions_enabled)); } bool TabProxy::GetConstrainedWindowCount(int* count) const { @@ -365,7 +356,7 @@ bool TabProxy::GetConstrainedWindowCount(int* count) const { } return sender_->Send(new AutomationMsg_ConstrainedWindowCount( - 0, handle_, count)); + handle_, count)); } bool TabProxy::WaitForChildWindowCountToChange(int count, int* new_count, @@ -393,7 +384,7 @@ bool TabProxy::GetBlockedPopupCount(int* count) const { } return sender_->Send(new AutomationMsg_BlockedPopupCount( - 0, handle_, count)); + handle_, count)); } bool TabProxy::WaitForBlockedPopupCountToChangeTo(int target_count, @@ -417,7 +408,7 @@ bool TabProxy::GetCookies(const GURL& url, std::string* cookies) { return false; int size = 0; - return sender_->Send(new AutomationMsg_GetCookies(0, url, handle_, &size, + return sender_->Send(new AutomationMsg_GetCookies(url, handle_, &size, cookies)); } @@ -442,13 +433,13 @@ bool TabProxy::GetCookieByName(const GURL& url, bool TabProxy::SetCookie(const GURL& url, const std::string& value) { int response_value = 0; - return sender_->Send(new AutomationMsg_SetCookie(0, url, value, handle_, + return sender_->Send(new AutomationMsg_SetCookie(url, value, handle_, &response_value)); } bool TabProxy::DeleteCookie(const GURL& url, const std::string& name) { bool succeeded; - sender_->Send(new AutomationMsg_DeleteCookie(0, url, name, handle_, + sender_->Send(new AutomationMsg_DeleteCookie(url, name, handle_, &succeeded)); return succeeded; } @@ -456,7 +447,7 @@ bool TabProxy::DeleteCookie(const GURL& url, const std::string& name) { bool TabProxy::ShowCollectedCookiesDialog() { bool succeeded = false; return sender_->Send(new AutomationMsg_ShowCollectedCookiesDialog( - 0, handle_, &succeeded)) && succeeded; + handle_, &succeeded)) && succeeded; } int TabProxy::InspectElement(int x, int y) { @@ -464,7 +455,7 @@ int TabProxy::InspectElement(int x, int y) { return -1; int ret = -1; - sender_->Send(new AutomationMsg_InspectElement(0, handle_, x, y, &ret)); + sender_->Send(new AutomationMsg_InspectElement(handle_, x, y, &ret)); return ret; } @@ -473,7 +464,7 @@ bool TabProxy::GetDownloadDirectory(FilePath* directory) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_DownloadDirectory(0, handle_, + return sender_->Send(new AutomationMsg_DownloadDirectory(handle_, directory)); } @@ -484,7 +475,7 @@ bool TabProxy::ShowInterstitialPage(const std::string& html_text) { AutomationMsg_NavigationResponseValues result = AUTOMATION_MSG_NAVIGATION_ERROR; if (!sender_->Send(new AutomationMsg_ShowInterstitialPage( - 0, handle_, html_text, &result))) { + handle_, html_text, &result))) { return false; } @@ -496,7 +487,7 @@ bool TabProxy::HideInterstitialPage() { return false; bool result = false; - sender_->Send(new AutomationMsg_HideInterstitialPage(0, handle_, &result)); + sender_->Send(new AutomationMsg_HideInterstitialPage(handle_, &result)); return result; } @@ -509,7 +500,7 @@ bool TabProxy::Close(bool wait_until_closed) { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_CloseTab(0, handle_, wait_until_closed, + sender_->Send(new AutomationMsg_CloseTab(handle_, wait_until_closed, &succeeded)); return succeeded; } @@ -520,7 +511,7 @@ bool TabProxy::ProcessUnhandledAccelerator(const MSG& msg) { return false; return sender_->Send( - new AutomationMsg_ProcessUnhandledAccelerator(0, handle_, msg)); + new AutomationMsg_ProcessUnhandledAccelerator(handle_, msg)); // This message expects no response } @@ -529,7 +520,7 @@ bool TabProxy::SetInitialFocus(bool reverse, bool restore_focus_to_view) { return false; return sender_->Send( - new AutomationMsg_SetInitialFocus(0, handle_, reverse, + new AutomationMsg_SetInitialFocus(handle_, reverse, restore_focus_to_view)); // This message expects no response } @@ -540,7 +531,7 @@ AutomationMsg_NavigationResponseValues TabProxy::NavigateInExternalTab( return AUTOMATION_MSG_NAVIGATION_ERROR; AutomationMsg_NavigationResponseValues rv = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_NavigateInExternalTab(0, handle_, url, + sender_->Send(new AutomationMsg_NavigateInExternalTab(handle_, url, referrer, &rv)); return rv; } @@ -551,7 +542,7 @@ AutomationMsg_NavigationResponseValues TabProxy::NavigateExternalTabAtIndex( return AUTOMATION_MSG_NAVIGATION_ERROR; AutomationMsg_NavigationResponseValues rv = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_NavigateExternalTabAtIndex(0, handle_, index, + sender_->Send(new AutomationMsg_NavigateExternalTabAtIndex(handle_, index, &rv)); return rv; } @@ -564,14 +555,14 @@ void TabProxy::HandleMessageFromExternalHost(const std::string& message, sender_->Send( new AutomationMsg_HandleMessageFromExternalHost( - 0, handle_, message, origin, target)); + handle_, message, origin, target)); } #endif // defined(OS_WIN) bool TabProxy::WaitForTabToBeRestored(uint32 timeout_ms) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_WaitForTabToBeRestored(0, handle_)); + return sender_->Send(new AutomationMsg_WaitForTabToBeRestored(handle_)); } bool TabProxy::GetSecurityState(SecurityStyle* security_style, @@ -585,7 +576,7 @@ bool TabProxy::GetSecurityState(SecurityStyle* security_style, bool succeeded = false; sender_->Send(new AutomationMsg_GetSecurityState( - 0, handle_, &succeeded, security_style, ssl_cert_status, + handle_, &succeeded, security_style, ssl_cert_status, insecure_content_status)); return succeeded; @@ -598,7 +589,7 @@ bool TabProxy::GetPageType(PageType* type) { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_GetPageType(0, handle_, &succeeded, type)); + sender_->Send(new AutomationMsg_GetPageType(handle_, &succeeded, type)); return succeeded; } @@ -608,7 +599,7 @@ bool TabProxy::TakeActionOnSSLBlockingPage(bool proceed) { AutomationMsg_NavigationResponseValues result = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_ActionOnSSLBlockingPage(0, handle_, proceed, + sender_->Send(new AutomationMsg_ActionOnSSLBlockingPage(handle_, proceed, &result)); return result == AUTOMATION_MSG_NAVIGATION_SUCCESS || result == AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED; @@ -619,7 +610,7 @@ bool TabProxy::PrintNow() { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_PrintNow(0, handle_, &succeeded)); + sender_->Send(new AutomationMsg_PrintNow(handle_, &succeeded)); return succeeded; } @@ -627,7 +618,7 @@ bool TabProxy::PrintAsync() { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_PrintAsync(0, handle_)); + return sender_->Send(new AutomationMsg_PrintAsync(handle_)); } bool TabProxy::SavePage(const FilePath& file_name, @@ -637,7 +628,7 @@ bool TabProxy::SavePage(const FilePath& file_name, return false; bool succeeded = false; - sender_->Send(new AutomationMsg_SavePage(0, handle_, file_name, dir_path, + sender_->Send(new AutomationMsg_SavePage(handle_, file_name, dir_path, static_cast<int>(type), &succeeded)); return succeeded; @@ -647,7 +638,7 @@ bool TabProxy::GetInfoBarCount(int* count) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_GetInfoBarCount(0, handle_, count)); + return sender_->Send(new AutomationMsg_GetInfoBarCount(handle_, count)); } bool TabProxy::WaitForInfoBarCount(int target_count) { @@ -656,7 +647,7 @@ bool TabProxy::WaitForInfoBarCount(int target_count) { bool success = false; return sender_->Send(new AutomationMsg_WaitForInfoBarCount( - 0, handle_, target_count, &success)) && success; + handle_, target_count, &success)) && success; } bool TabProxy::ClickInfoBarAccept(int info_bar_index, @@ -667,7 +658,7 @@ bool TabProxy::ClickInfoBarAccept(int info_bar_index, AutomationMsg_NavigationResponseValues result = AUTOMATION_MSG_NAVIGATION_ERROR; sender_->Send(new AutomationMsg_ClickInfoBarAccept( - 0, handle_, info_bar_index, wait_for_navigation, &result)); + handle_, info_bar_index, wait_for_navigation, &result)); return result == AUTOMATION_MSG_NAVIGATION_SUCCESS || result == AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED; } @@ -678,7 +669,7 @@ bool TabProxy::GetLastNavigationTime(int64* nav_time) { bool success = false; success = sender_->Send(new AutomationMsg_GetLastNavigationTime( - 0, handle_, nav_time)); + handle_, nav_time)); return success; } @@ -688,7 +679,7 @@ bool TabProxy::WaitForNavigation(int64 last_navigation_time) { AutomationMsg_NavigationResponseValues result = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_WaitForNavigation(0, handle_, + sender_->Send(new AutomationMsg_WaitForNavigation(handle_, last_navigation_time, &result)); return result == AUTOMATION_MSG_NAVIGATION_SUCCESS || @@ -700,7 +691,7 @@ bool TabProxy::GetPageCurrentEncoding(std::string* encoding) { return false; bool succeeded = sender_->Send( - new AutomationMsg_GetPageCurrentEncoding(0, handle_, encoding)); + new AutomationMsg_GetPageCurrentEncoding(handle_, encoding)); return succeeded; } @@ -709,7 +700,7 @@ bool TabProxy::OverrideEncoding(const std::string& encoding) { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_OverrideEncoding(0, handle_, encoding, + sender_->Send(new AutomationMsg_OverrideEncoding(handle_, encoding, &succeeded)); return succeeded; } @@ -719,7 +710,7 @@ bool TabProxy::LoadBlockedPlugins() { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_LoadBlockedPlugins(0, handle_, &succeeded)); + sender_->Send(new AutomationMsg_LoadBlockedPlugins(handle_, &succeeded)); return succeeded; } @@ -728,7 +719,7 @@ bool TabProxy::CaptureEntirePageAsPNG(const FilePath& path) { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_CaptureEntirePageAsPNG(0, handle_, path, + sender_->Send(new AutomationMsg_CaptureEntirePageAsPNG(handle_, path, &succeeded)); return succeeded; } @@ -737,7 +728,7 @@ bool TabProxy::CaptureEntirePageAsPNG(const FilePath& path) { void TabProxy::Reposition(HWND window, HWND window_insert_after, int left, int top, int width, int height, int flags, HWND parent_window) { - IPC::Reposition_Params params = {0}; + Reposition_Params params = {0}; params.window = window; params.window_insert_after = window_insert_after; params.left = left; @@ -747,45 +738,45 @@ void TabProxy::Reposition(HWND window, HWND window_insert_after, int left, params.flags = flags; params.set_parent = (::IsWindow(parent_window) ? true : false); params.parent_window = parent_window; - sender_->Send(new AutomationMsg_TabReposition(0, handle_, params)); + sender_->Send(new AutomationMsg_TabReposition(handle_, params)); } void TabProxy::SendContextMenuCommand(int selected_command) { sender_->Send(new AutomationMsg_ForwardContextMenuCommandToChrome( - 0, handle_, selected_command)); + handle_, selected_command)); } void TabProxy::OnHostMoved() { - sender_->Send(new AutomationMsg_BrowserMove(0, handle_)); + sender_->Send(new AutomationMsg_BrowserMove(handle_)); } #endif // defined(OS_WIN) void TabProxy::SelectAll() { - sender_->Send(new AutomationMsg_SelectAll(0, handle_)); + sender_->Send(new AutomationMsg_SelectAll(handle_)); } void TabProxy::Cut() { - sender_->Send(new AutomationMsg_Cut(0, handle_)); + sender_->Send(new AutomationMsg_Cut(handle_)); } void TabProxy::Copy() { - sender_->Send(new AutomationMsg_Copy(0, handle_)); + sender_->Send(new AutomationMsg_Copy(handle_)); } void TabProxy::Paste() { - sender_->Send(new AutomationMsg_Paste(0, handle_)); + sender_->Send(new AutomationMsg_Paste(handle_)); } void TabProxy::ReloadAsync() { - sender_->Send(new AutomationMsg_ReloadAsync(0, handle_)); + sender_->Send(new AutomationMsg_ReloadAsync(handle_)); } void TabProxy::StopAsync() { - sender_->Send(new AutomationMsg_StopAsync(0, handle_)); + sender_->Send(new AutomationMsg_StopAsync(handle_)); } void TabProxy::SaveAsAsync() { - sender_->Send(new AutomationMsg_SaveAsAsync(0, handle_)); + sender_->Send(new AutomationMsg_SaveAsAsync(handle_)); } void TabProxy::AddObserver(TabProxyDelegate* observer) { @@ -820,7 +811,7 @@ bool TabProxy::ExecuteJavaScriptAndGetJSON(const std::string& script, NOTREACHED(); return false; } - return sender_->Send(new AutomationMsg_DomOperation(0, handle_, L"", + return sender_->Send(new AutomationMsg_DomOperation(handle_, L"", UTF8ToWide(script), json)); } diff --git a/chrome/test/automation/window_proxy.cc b/chrome/test/automation/window_proxy.cc index 6774e6d..3230c08 100644 --- a/chrome/test/automation/window_proxy.cc +++ b/chrome/test/automation/window_proxy.cc @@ -19,15 +19,14 @@ bool WindowProxy::SimulateOSClick(const gfx::Point& click, int flags) { if (!is_valid()) return false; - return sender_->Send( - new AutomationMsg_WindowClick(0, handle_, click, flags)); + return sender_->Send(new AutomationMsg_WindowClick(handle_, click, flags)); } bool WindowProxy::SimulateOSMouseMove(const gfx::Point& location) { if (!is_valid()) return false; return sender_->Send( - new AutomationMsg_WindowMouseMove(0, handle_, location)); + new AutomationMsg_WindowMouseMove(handle_, location)); } bool WindowProxy::GetWindowTitle(string16* text) { @@ -38,14 +37,14 @@ bool WindowProxy::GetWindowTitle(string16* text) { return false; } - return sender_->Send(new AutomationMsg_WindowTitle(0, handle_, text)); + return sender_->Send(new AutomationMsg_WindowTitle(handle_, text)); } bool WindowProxy::SimulateOSKeyPress(app::KeyboardCode key, int flags) { if (!is_valid()) return false; return sender_->Send( - new AutomationMsg_WindowKeyPress(0, handle_, key, flags)); + new AutomationMsg_WindowKeyPress(handle_, key, flags)); } bool WindowProxy::SetVisible(bool visible) { @@ -53,8 +52,7 @@ bool WindowProxy::SetVisible(bool visible) { bool result = false; - sender_->Send(new AutomationMsg_SetWindowVisible(0, handle_, visible, - &result)); + sender_->Send(new AutomationMsg_SetWindowVisible(handle_, visible, &result)); return result; } @@ -63,14 +61,14 @@ bool WindowProxy::IsActive(bool* active) { bool result = false; - sender_->Send(new AutomationMsg_IsWindowActive(0, handle_, &result, active)); + sender_->Send(new AutomationMsg_IsWindowActive(handle_, &result, active)); return result; } bool WindowProxy::Activate() { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_ActivateWindow(0, handle_)); + return sender_->Send(new AutomationMsg_ActivateWindow(handle_)); } bool WindowProxy::GetViewBounds(int view_id, gfx::Rect* bounds, @@ -86,7 +84,7 @@ bool WindowProxy::GetViewBounds(int view_id, gfx::Rect* bounds, bool result = false; if (!sender_->Send(new AutomationMsg_WindowViewBounds( - 0, handle_, view_id, screen_coordinates, &result, bounds))) { + handle_, view_id, screen_coordinates, &result, bounds))) { return false; } @@ -97,8 +95,7 @@ bool WindowProxy::GetBounds(gfx::Rect* bounds) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_GetWindowBounds(0, handle_, bounds, - &result)); + sender_->Send(new AutomationMsg_GetWindowBounds(handle_, bounds, &result)); return result; } @@ -106,8 +103,7 @@ bool WindowProxy::SetBounds(const gfx::Rect& bounds) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_SetWindowBounds(0, handle_, bounds, - &result)); + sender_->Send(new AutomationMsg_SetWindowBounds(handle_, bounds, &result)); return result; } @@ -119,15 +115,14 @@ bool WindowProxy::GetFocusedViewID(int* view_id) { return false; } - return sender_->Send(new AutomationMsg_GetFocusedViewID(0, handle_, - view_id)); + return sender_->Send(new AutomationMsg_GetFocusedViewID(handle_, view_id)); } bool WindowProxy::WaitForFocusedViewIDToChange( int old_view_id, int* new_view_id) { bool result = false; - if (!sender_->Send(new AutomationMsg_WaitForFocusedViewIDToChange - (0, handle_, old_view_id, &result, new_view_id))) + if (!sender_->Send(new AutomationMsg_WaitForFocusedViewIDToChange( + handle_, old_view_id, &result, new_view_id))) return false; return result; } @@ -144,7 +139,7 @@ scoped_refptr<BrowserProxy> WindowProxy::GetBrowserWithTimeout( bool handle_ok = false; int browser_handle = 0; - sender_->Send(new AutomationMsg_BrowserForWindow(0, handle_, &handle_ok, + sender_->Send(new AutomationMsg_BrowserForWindow(handle_, &handle_ok, &browser_handle)); if (!handle_ok) return NULL; @@ -168,7 +163,7 @@ bool WindowProxy::IsMaximized(bool* maximized) { bool result = false; - sender_->Send(new AutomationMsg_IsWindowMaximized(0, handle_, maximized, + sender_->Send(new AutomationMsg_IsWindowMaximized(handle_, maximized, &result)); return result; } |