summaryrefslogtreecommitdiffstats
path: root/chrome/test/automation
diff options
context:
space:
mode:
authoramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 22:09:03 +0000
committeramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 22:09:03 +0000
commit95c3c59d275042225cda4589525cb279f66f1f2c (patch)
treef9fc3164096b65db04c60060a882bf68e7d5d7df /chrome/test/automation
parent7d7b882f49e7c33e1ad7b113234fd6af94fac608 (diff)
downloadchromium_src-95c3c59d275042225cda4589525cb279f66f1f2c.zip
chromium_src-95c3c59d275042225cda4589525cb279f66f1f2c.tar.gz
chromium_src-95c3c59d275042225cda4589525cb279f66f1f2c.tar.bz2
Remove the defunct SetAccelerator message and replace it with an
automation message to set initial settings. BUG=none TEST=none Review URL: http://codereview.chromium.org/155376 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20676 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation')
-rw-r--r--chrome/test/automation/automation_messages.h42
-rw-r--r--chrome/test/automation/automation_messages_internal.h40
-rw-r--r--chrome/test/automation/automation_proxy.cc19
-rw-r--r--chrome/test/automation/automation_proxy.h11
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc39
-rw-r--r--chrome/test/automation/tab_proxy.cc11
-rw-r--r--chrome/test/automation/tab_proxy.h5
7 files changed, 98 insertions, 69 deletions
diff --git a/chrome/test/automation/automation_messages.h b/chrome/test/automation/automation_messages.h
index f19a74f..dd17017 100644
--- a/chrome/test/automation/automation_messages.h
+++ b/chrome/test/automation/automation_messages.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/gfx/rect.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/security_style.h"
#include "chrome/common/ipc_message_utils.h"
@@ -295,6 +296,47 @@ struct ParamTraits<AutomationURLResponse> {
}
};
+struct ExternalTabSettings {
+ gfx::NativeWindow parent;
+ gfx::Rect dimensions;
+ unsigned int style;
+ bool is_off_the_record;
+ bool load_requests_via_automation;
+};
+
+// Traits for ExternalTabSettings structure to pack/unpack.
+template <>
+struct ParamTraits<ExternalTabSettings> {
+ typedef ExternalTabSettings param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.parent);
+ WriteParam(m, p.dimensions);
+ WriteParam(m, p.style);
+ WriteParam(m, p.is_off_the_record);
+ WriteParam(m, p.load_requests_via_automation);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return ReadParam(m, iter, &p->parent) &&
+ ReadParam(m, iter, &p->dimensions) &&
+ ReadParam(m, iter, &p->style) &&
+ ReadParam(m, iter, &p->is_off_the_record) &&
+ ReadParam(m, iter, &p->load_requests_via_automation);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.parent, l);
+ l->append(L", ");
+ LogParam(p.dimensions, l);
+ l->append(L", ");
+ LogParam(p.style, l);
+ l->append(L", ");
+ LogParam(p.is_off_the_record, l);
+ l->append(L", ");
+ LogParam(p.load_requests_via_automation, l);
+ l->append(L")");
+ }
+};
+
} // namespace IPC
#define MESSAGES_INTERNAL_FILE \
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index ac1b7deb..15528c2 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -409,25 +409,15 @@ IPC_BEGIN_MESSAGES(Automation)
// associated for, as defined in chrome/views/event.h
IPC_MESSAGE_ROUTED3(AutomationMsg_WindowKeyPress, int, wchar_t, int)
-#if defined(OS_WIN)
- // TODO(port): Port these messages.
- //
// This message notifies the AutomationProvider to create a tab which is
// hosted by an external process.
// Request:
- // HWND - handle to a window acting as a parent/owner for the new tab.
- // gfx::Rect - initial dimensions.
- // style - window style to be used at the time of cration.
- // incognito - use off-the-record profile
- IPC_SYNC_MESSAGE_ROUTED4_3(AutomationMsg_CreateExternalTab,
- HWND /* owner_or_parent*/,
- gfx::Rect /* dimensions */,
- unsigned int /* style */,
- bool /* off-the-record profile */,
- HWND, // Tab container HWND
- HWND, // Tab HWND
- int /* Handle to the new tab */)
-#endif // defined(OS_WIN)
+ // ExternalTabSettings - settings for external tab
+ IPC_SYNC_MESSAGE_ROUTED1_3(AutomationMsg_CreateExternalTab,
+ IPC::ExternalTabSettings /* settings*/,
+ gfx::NativeWindow /* Tab container window */,
+ gfx::NativeWindow /* Tab window */,
+ int /* Handle to the new tab */)
// This message notifies the AutomationProvider to navigate to a specified
// url in the external tab with given handle. The first parameter is the
@@ -493,21 +483,15 @@ IPC_BEGIN_MESSAGES(Automation)
bool)
IPC_MESSAGE_ROUTED1(AutomationMsg_CloseBrowserRequestAsync, int)
+
+ // Unused.
+ // Response:
+ // None expected
+ IPC_MESSAGE_ROUTED1(AutomationMsg_Unused, int)
+
#if defined(OS_WIN)
// TODO(port): Port these messages.
//
- // This message sets the keyboard accelarators to be used by an externally
- // hosted tab. This call is not valid on a regular tab hosted within
- // Chrome.
- // Request:
- // - int: handle of the tab
- // - HACCEL: The accelerator table to be set
- // - int: The number of entries in the accelerator table
- // Response:
- // -bool: whether the operation was successful.
- IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetAcceleratorsForTab, int, HACCEL,
- int, bool)
-
// This message is an outgoing message from Chrome to an external host.
// It is a request to process a keyboard accelerator.
// Request:
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index 2d4fe5b..a1df2d8 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -496,17 +496,13 @@ bool AutomationProxy::OpenNewBrowserWindow(bool show) {
return Send(new AutomationMsg_OpenNewBrowserWindow(0, show));
}
-#if defined(OS_WIN)
-// TODO(port): Replace HWNDs.
-scoped_refptr<TabProxy> AutomationProxy::CreateExternalTab(HWND parent,
- const gfx::Rect& dimensions, unsigned int style, bool incognito,
- HWND* external_tab_container, HWND* tab) {
- IPC::Message* response = NULL;
+scoped_refptr<TabProxy> AutomationProxy::CreateExternalTab(
+ const IPC::ExternalTabSettings& settings,
+ gfx::NativeWindow* external_tab_container,
+ gfx::NativeWindow* tab) {
int handle = 0;
-
bool succeeded =
- Send(new AutomationMsg_CreateExternalTab(0, parent, dimensions, style,
- incognito,
+ Send(new AutomationMsg_CreateExternalTab(0, settings,
external_tab_container,
tab,
&handle));
@@ -514,11 +510,14 @@ scoped_refptr<TabProxy> AutomationProxy::CreateExternalTab(HWND parent,
return NULL;
}
+#if defined(OS_WIN)
DCHECK(IsWindow(*external_tab_container));
+#else // defined(OS_WIN)
+ DCHECK(*external_tab_container);
+#endif // defined(OS_WIN)
DCHECK(tracker_->GetResource(handle) == NULL);
return new TabProxy(this, tracker_.get(), handle);
}
-#endif // defined(OS_WIN)
template <class T> scoped_refptr<T> AutomationProxy::ProxyObjectFromHandle(
int handle) {
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index 2271f83..ffbf39d 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -191,16 +191,13 @@ class AutomationProxy : public IPC::Channel::Listener,
// the tracker.
void InvalidateHandle(const IPC::Message& message);
-#if defined(OS_WIN)
- // TODO(port): Enable when we can replace HWND.
-
// Creates a tab that can hosted in an external process. The function
// returns a TabProxy representing the tab as well as a window handle
// that can be reparented in another process.
- scoped_refptr<TabProxy> CreateExternalTab(HWND parent,
- const gfx::Rect& dimensions, unsigned int style, bool incognito,
- HWND* external_tab_container, HWND* tab);
-#endif // defined(OS_WIN)
+ scoped_refptr<TabProxy> CreateExternalTab(
+ const IPC::ExternalTabSettings& settings,
+ gfx::NativeWindow* external_tab_container,
+ gfx::NativeWindow* tab);
int command_execution_timeout_ms() const {
return static_cast<int>(command_execution_timeout_.InMilliseconds());
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index 261bdfc..eeedf20 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -767,10 +767,18 @@ void AutomationProxyForExternalTab::OnForwardMessageToExternalHost(
}
TEST_F(ExternalTabTestType, CreateExternalTab) {
+ const IPC::ExternalTabSettings settings = {
+ NULL,
+ gfx::Rect(),
+ WS_POPUP,
+ false,
+ false
+ };
HWND external_tab_container = NULL;
HWND tab_wnd = NULL;
- scoped_refptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(),
- WS_POPUP, false, &external_tab_container, &tab_wnd));
+
+ scoped_refptr<TabProxy> tab(automation()->CreateExternalTab(settings,
+ &external_tab_container, &tab_wnd));
EXPECT_TRUE(tab != NULL);
EXPECT_NE(FALSE, ::IsWindow(external_tab_container));
if (tab != NULL) {
@@ -783,14 +791,21 @@ TEST_F(ExternalTabTestType, CreateExternalTab) {
}
TEST_F(ExternalTabTestType, IncognitoMode) {
+ IPC::ExternalTabSettings settings = {
+ NULL,
+ gfx::Rect(),
+ WS_POPUP,
+ true,
+ false
+ };
HWND external_tab_container = NULL;
HWND tab_wnd = NULL;
GURL url("http://anatomyofmelancholy.net");
std::string value_result;
// Create incognito tab
- scoped_refptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(),
- WS_POPUP, true, &external_tab_container, &tab_wnd));
+ scoped_refptr<TabProxy> tab(automation()->CreateExternalTab(settings,
+ &external_tab_container, &tab_wnd));
EXPECT_TRUE(tab->SetCookie(url, "robert=burton; "
"expires=Thu, 13 Oct 2011 05:04:03 UTC;"));
EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result));
@@ -803,8 +818,9 @@ TEST_F(ExternalTabTestType, IncognitoMode) {
external_tab_container = NULL;
tab_wnd = NULL;
LaunchBrowserAndServer();
- tab = automation()->CreateExternalTab(NULL, gfx::Rect(),
- WS_POPUP, false, &external_tab_container, &tab_wnd);
+ settings.is_off_the_record = false;
+ tab = automation()->CreateExternalTab(settings, &external_tab_container,
+ &tab_wnd);
EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result));
EXPECT_EQ("", value_result);
}
@@ -813,10 +829,17 @@ TEST_F(ExternalTabTestType, ExternalTabPostMessage) {
AutomationProxyForExternalTab* proxy =
static_cast<AutomationProxyForExternalTab*>(automation());
+ IPC::ExternalTabSettings settings = {
+ NULL,
+ gfx::Rect(),
+ WS_POPUP,
+ false,
+ false
+ };
HWND external_tab_container = NULL;
HWND tab_wnd = NULL;
- scoped_refptr<TabProxy> tab(proxy->CreateExternalTab(NULL, gfx::Rect(),
- WS_POPUP, false, &external_tab_container, &tab_wnd));
+ scoped_refptr<TabProxy> tab(proxy->CreateExternalTab(settings,
+ &external_tab_container, &tab_wnd));
EXPECT_TRUE(tab != NULL);
EXPECT_NE(FALSE, ::IsWindow(external_tab_container));
if (tab != NULL) {
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index 8d8ebf7..89bbf26 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -451,17 +451,6 @@ bool TabProxy::Close(bool wait_until_closed) {
#if defined(OS_WIN)
// TODO(port): Remove windowsisms.
-bool TabProxy::SetAccelerators(HACCEL accel_table,
- int accel_table_entry_count) {
- if (!is_valid())
- return false;
-
- bool succeeded = false;
- sender_->Send(new AutomationMsg_SetAcceleratorsForTab(
- 0, handle_, accel_table, accel_table_entry_count, &succeeded));
- return succeeded;
-}
-
bool TabProxy::ProcessUnhandledAccelerator(const MSG& msg) {
if (!is_valid())
return false;
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index 200c5f9..a04f496 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -215,11 +215,6 @@ class TabProxy : public AutomationResourceProxy {
#if defined(OS_WIN)
// TODO(port): Use something portable.
- // 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.
- bool SetAccelerators(HACCEL accel_table, int accel_table_entry_count);
-
// 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