diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 00:26:17 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 00:26:17 +0000 |
commit | d2cc6ed02579f9bdedf6d4f81916bc50aeede31b (patch) | |
tree | 5df409d7e48b00eb1fa8985c5e58bd5605de912b /chrome/browser/automation | |
parent | e6df36c37320cb2e7febd049eab0adcc13313e70 (diff) | |
download | chromium_src-d2cc6ed02579f9bdedf6d4f81916bc50aeede31b.zip chromium_src-d2cc6ed02579f9bdedf6d4f81916bc50aeede31b.tar.gz chromium_src-d2cc6ed02579f9bdedf6d4f81916bc50aeede31b.tar.bz2 |
Port and enable most of TabRestoreUITest on linux.
- fill in necessary bits of automation proxy, also mock out some windows-only functions on posix so that the IPC messages don't get completely ignored (so we get NOTIMPLEMENTEDs rather than just hanging when porting future UI tests)
- add IsWindowActive to platform_util
Review URL: http://codereview.chromium.org/93096
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14396 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 32 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 10 |
2 files changed, 34 insertions, 8 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 8a3c324..fce3a68 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -965,22 +965,26 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { GetBrowserForWindow); #if defined(OS_WIN) IPC_MESSAGE_HANDLER(AutomationMsg_CreateExternalTab, CreateExternalTab) +#endif IPC_MESSAGE_HANDLER(AutomationMsg_NavigateInExternalTab, NavigateInExternalTab) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_ShowInterstitialPage, ShowInterstitialPage); IPC_MESSAGE_HANDLER(AutomationMsg_HideInterstitialPage, HideInterstitialPage); +#if defined(OS_WIN) IPC_MESSAGE_HANDLER(AutomationMsg_SetAcceleratorsForTab, SetAcceleratorsForTab) IPC_MESSAGE_HANDLER(AutomationMsg_ProcessUnhandledAccelerator, ProcessUnhandledAccelerator) +#endif IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForTabToBeRestored, WaitForTabToBeRestored) IPC_MESSAGE_HANDLER(AutomationMsg_SetInitialFocus, SetInitialFocus) +#if defined(OS_WIN) IPC_MESSAGE_HANDLER(AutomationMsg_TabReposition, OnTabReposition) -#endif // defined(OS_WIN) +#endif IPC_MESSAGE_HANDLER(AutomationMsg_GetSecurityState, GetSecurityState) IPC_MESSAGE_HANDLER(AutomationMsg_GetPageType, @@ -1690,12 +1694,13 @@ void AutomationProvider::SetWindowVisible(int handle, bool visible, *result = false; } } +#endif // defined(OS_WIN) void AutomationProvider::IsWindowActive(int handle, bool* success, bool* is_active) { if (window_tracker_->ContainsHandle(handle)) { - HWND hwnd = window_tracker_->GetResource(handle); - *is_active = ::GetForegroundWindow() == hwnd; + *is_active = + platform_util::IsWindowActive(window_tracker_->GetResource(handle)); *success = true; } else { *success = false; @@ -1703,12 +1708,14 @@ void AutomationProvider::IsWindowActive(int handle, bool* success, } } +// TODO(port): port this. +#if defined(OS_WIN) void AutomationProvider::ActivateWindow(int handle) { if (window_tracker_->ContainsHandle(handle)) { ::SetActiveWindow(window_tracker_->GetResource(handle)); } } -#endif // defined(OS_WIN) +#endif void AutomationProvider::GetTabCount(int handle, int* tab_count) { *tab_count = -1; // -1 is the error code @@ -2307,6 +2314,7 @@ void AutomationProvider::CreateExternalTab(HWND parent, delete external_tab_container; } } +#endif void AutomationProvider::NavigateInExternalTab( int handle, const GURL& url, @@ -2320,6 +2328,8 @@ void AutomationProvider::NavigateInExternalTab( } } +#if defined(OS_WIN) +// TODO(port): remove windowisms. void AutomationProvider::SetAcceleratorsForTab(int handle, HACCEL accel_table, int accel_entry_count, @@ -2341,6 +2351,7 @@ void AutomationProvider::ProcessUnhandledAccelerator( } // This message expects no response. } +#endif void AutomationProvider::WaitForTabToBeRestored(int tab_handle, IPC::Message* reply_message) { @@ -2355,13 +2366,20 @@ void AutomationProvider::WaitForTabToBeRestored(int tab_handle, void AutomationProvider::SetInitialFocus(const IPC::Message& message, int handle, bool reverse) { +#if defined(OS_WIN) ExternalTabContainer* external_tab = GetExternalTabForHandle(handle); if (external_tab) { external_tab->SetInitialFocus(reverse); } // This message expects no response. +#elif defined(OS_POSIX) + // TODO(port) enable this function. + NOTIMPLEMENTED(); +#endif } +// TODO(port): enable these functions. +#if defined(OS_WIN) void AutomationProvider::GetSecurityState(int handle, bool* success, SecurityStyle* security_style, int* ssl_cert_status, @@ -2827,7 +2845,8 @@ void AutomationProvider::SavePackageShouldPromptUser(bool should_prompt) { SavePackage::SetShouldPromptUser(should_prompt); } -#ifdef OS_WIN +#if defined(OS_WIN) +// TODO(port): Reposition_Params is win-specific. We'll need to port it. void AutomationProvider::OnTabReposition( int tab_handle, const IPC::Reposition_Params& params) { if (!tab_tracker_->ContainsHandle(tab_handle)) @@ -2856,8 +2875,7 @@ void AutomationProvider::OnTabReposition( } } } - -#endif // defined(OS_WIN) +#endif void AutomationProvider::GetWindowTitle(int handle, string16* text) { gfx::NativeWindow window = window_tracker_->GetResource(handle); diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 4e33c2d..a7cab75 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -274,25 +274,33 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, IPC::Message* reply_message); void HideInterstitialPage(int tab_handle, bool* success); +// TODO(port): remove windowisms. #if defined(OS_WIN) - // TODO(port): Re-enable. void CreateExternalTab(HWND parent, const gfx::Rect& dimensions, unsigned int style, bool incognito, HWND* tab_container_window, int* tab_handle); +#endif // defined(OS_WIN) + void NavigateInExternalTab( int handle, const GURL& url, AutomationMsg_NavigationResponseValues* status); + +// TODO(port): remove windowisms. +#if defined(OS_WIN) // The container of an externally hosted tab calls this to reflect any // accelerator keys that it did not process. This gives the tab a chance // to handle the keys void ProcessUnhandledAccelerator(const IPC::Message& message, int handle, const MSG& msg); +#endif void SetInitialFocus(const IPC::Message& message, int handle, bool reverse); // See comment in AutomationMsg_WaitForTabToBeRestored. void WaitForTabToBeRestored(int tab_handle, IPC::Message* reply_message); +// TODO(port): remove windowisms. +#if defined(OS_WIN) // This sets the keyboard accelerators to be used by an externally // hosted tab. This call is not valid on a regular tab hosted within // Chrome. |