summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-24 00:26:17 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-24 00:26:17 +0000
commitd2cc6ed02579f9bdedf6d4f81916bc50aeede31b (patch)
tree5df409d7e48b00eb1fa8985c5e58bd5605de912b /chrome/browser
parente6df36c37320cb2e7febd049eab0adcc13313e70 (diff)
downloadchromium_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')
-rw-r--r--chrome/browser/automation/automation_provider.cc32
-rw-r--r--chrome/browser/automation/automation_provider.h10
-rw-r--r--chrome/browser/tab_restore_uitest.cc11
3 files changed, 44 insertions, 9 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.
diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc
index 506acf6..43d9436 100644
--- a/chrome/browser/tab_restore_uitest.cc
+++ b/chrome/browser/tab_restore_uitest.cc
@@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
+#if defined(OS_WIN)
#include "base/win_util.h"
+#endif
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -125,7 +128,7 @@ class TabRestoreUITest : public UITest {
GURL url2_;
private:
- DISALLOW_EVIL_CONSTRUCTORS(TabRestoreUITest);
+ DISALLOW_COPY_AND_ASSIGN(TabRestoreUITest);
};
// Close the end tab in the current window, then restore it. The tab should be
@@ -231,9 +234,11 @@ TEST_F(TabRestoreUITest, RestoreToDifferentWindow) {
// Close a tab, open a new window, close the first window, then restore the
// tab. It should be in a new window.
TEST_F(TabRestoreUITest, BasicRestoreFromClosedWindow) {
+#if defined(OS_WIN)
// This test is disabled on win2k. See bug 1215881.
if (win_util::GetWinVersion() == win_util::WINVERSION_2000)
return;
+#endif
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
CheckActiveWindow(browser_proxy.get());
@@ -479,6 +484,9 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) {
EXPECT_EQ(http_url2, GetActiveTabURL());
}
+// TODO(estade): The browser currently ignores the CloseWindow command. We need
+// to enable that command before we can enable this test.
+#if defined(OS_WIN)
TEST_F(TabRestoreUITest, RestoreWindow) {
// Create a new window.
int window_count;
@@ -532,3 +540,4 @@ TEST_F(TabRestoreUITest, RestoreWindow) {
ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url));
EXPECT_TRUE(url == url2_);
}
+#endif // defined(OS_WIN)