summaryrefslogtreecommitdiffstats
path: root/chrome/test/automation
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test/automation')
-rw-r--r--chrome/test/automation/automation_messages_internal.h10
-rw-r--r--chrome/test/automation/automation_proxy.cc6
-rw-r--r--chrome/test/automation/automation_proxy.h8
-rw-r--r--chrome/test/automation/browser_proxy.cc33
-rw-r--r--chrome/test/automation/browser_proxy.h11
5 files changed, 60 insertions, 8 deletions
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 69e9c51..f9253c5 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -133,6 +133,11 @@ IPC_BEGIN_MESSAGES(Automation)
// request failed.
IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_TabCount, int, int)
+ // This message requests the type of the window with the given handle. The
+ // return value contains the type (Browser::Type), or -1 if the request
+ // failed.
+ IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_Type, int, int)
+
// This message requests the handle of the tab with the given (zero-based)
// index in the given app window. First parameter specifies the given window
// handle, second specifies the given tab_index. On error, the returned handle
@@ -364,8 +369,9 @@ IPC_BEGIN_MESSAGES(Automation)
int /* view_handle */)
// Opens a new browser window.
- IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_OpenNewBrowserWindow,
- bool /* show */ )
+ IPC_SYNC_MESSAGE_ROUTED2_0(AutomationMsg_OpenNewBrowserWindow,
+ int /* Type (Browser::Type) */,
+ bool /* show */ )
// This message requests the handle (int64 app-unique identifier) of the
// current active top window. On error, the returned handle value is 0.
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index 4658bf3..0a758a5 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -485,8 +485,10 @@ void AutomationProxy::InvalidateHandle(const IPC::Message& message) {
}
}
-bool AutomationProxy::OpenNewBrowserWindow(bool show) {
- return Send(new AutomationMsg_OpenNewBrowserWindow(0, show));
+bool AutomationProxy::OpenNewBrowserWindow(BrowserProxy::Type type,
+ bool show) {
+ return Send(new AutomationMsg_OpenNewBrowserWindow(0, static_cast<int>(type),
+ show));
}
scoped_refptr<TabProxy> AutomationProxy::CreateExternalTab(
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index cf40606..6825518 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -17,6 +17,7 @@
#include "base/waitable_event.h"
#include "chrome/test/automation/automation_constants.h"
#include "chrome/test/automation/automation_handle_tracker.h"
+#include "chrome/test/automation/browser_proxy.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_message.h"
@@ -86,10 +87,9 @@ class AutomationProxy : public IPC::Channel::Listener,
// Returns true if the load is successful.
bool WaitForInitialNewTabUILoad(int* load_time);
- // Open a new browser window, returning true on success. |show|
- // identifies whether the window should be shown.
- // False likely indicates an IPC error.
- bool OpenNewBrowserWindow(bool show);
+ // Open a new browser window of type |type|, returning true on success. |show|
+ // identifies whether the window should be shown. Returns true on success.
+ bool OpenNewBrowserWindow(BrowserProxy::Type type, bool show);
// Fills the number of open browser windows into the given variable, returning
// true on success. False likely indicates an IPC error.
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc
index 6543b26..ad6c8ff 100644
--- a/chrome/test/automation/browser_proxy.cc
+++ b/chrome/test/automation/browser_proxy.cc
@@ -175,6 +175,39 @@ bool BrowserProxy::GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms,
return succeeded;
}
+bool BrowserProxy::GetType(Type* type) const {
+ if (!is_valid())
+ return false;
+
+ if (!type) {
+ NOTREACHED();
+ return false;
+ }
+
+ int type_as_int;
+ bool succeeded = sender_->SendWithTimeout(new AutomationMsg_Type(
+ 0, handle_, &type_as_int), base::kNoTimeout, NULL);
+
+ switch (type_as_int) {
+ case 0:
+ *type = TYPE_NORMAL;
+ break;
+ case 1:
+ *type = TYPE_POPUP;
+ break;
+ case 2:
+ *type = TYPE_APP;
+ break;
+ case 3:
+ *type = TYPE_APP_POPUP;
+ break;
+ default:
+ return false;
+ }
+
+ return succeeded;
+}
+
bool BrowserProxy::ApplyAccelerator(int id) {
return RunCommandAsync(id);
}
diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h
index 05b1b534..447a949 100644
--- a/chrome/test/automation/browser_proxy.h
+++ b/chrome/test/automation/browser_proxy.h
@@ -31,6 +31,13 @@ namespace gfx {
// any subsequent calls will return false immediately.
class BrowserProxy : public AutomationResourceProxy {
public:
+ enum Type {
+ TYPE_NORMAL = 0,
+ TYPE_POPUP = 1,
+ TYPE_APP = 2,
+ TYPE_APP_POPUP = TYPE_APP | TYPE_POPUP,
+ };
+
BrowserProxy(AutomationMessageSender* sender,
AutomationHandleTracker* tracker,
int handle)
@@ -84,6 +91,10 @@ class BrowserProxy : public AutomationResourceProxy {
bool GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms,
bool* is_timeout) const;
+ // Returns the type of the given window. Returns true if the call was
+ // successful.
+ bool GetType(Type* type) const;
+
// Returns the TabProxy for the tab at the given index, transferring
// ownership of the pointer to the caller. On failure, returns NULL.
//