summaryrefslogtreecommitdiffstats
path: root/chrome/test/automation
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 21:43:53 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 21:43:53 +0000
commit982921f1ba1f442e8b4ccd04093a5c6bd796c2fb (patch)
tree3f816852334bd7789121c991408b775f09125e0d /chrome/test/automation
parent7cd2afd1788641996735e7742aff93029bb112b9 (diff)
downloadchromium_src-982921f1ba1f442e8b4ccd04093a5c6bd796c2fb.zip
chromium_src-982921f1ba1f442e8b4ccd04093a5c6bd796c2fb.tar.gz
chromium_src-982921f1ba1f442e8b4ccd04093a5c6bd796c2fb.tar.bz2
Take 2 at this. The only change between this and the first is to add the GetType message to the end of the list and to keep the old message for
creating a new browser as well as adding one that takes the type. To change the params of the message requires updating the reference build. That's best done on a weekend when I'm bored. Makes session restore on Chrome OS restore popups. BUG=18862 TEST=none Review URL: http://codereview.chromium.org/329040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation')
-rw-r--r--chrome/test/automation/automation_messages_internal.h12
-rw-r--r--chrome/test/automation/automation_proxy.cc9
-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, 67 insertions, 6 deletions
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 69e9c51..e7cd47f 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -364,6 +364,8 @@ IPC_BEGIN_MESSAGES(Automation)
int /* view_handle */)
// Opens a new browser window.
+ // TODO(sky): remove this and replace with OpenNewBrowserWindowOfType.
+ // Doing this requires updating the reference build.
IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_OpenNewBrowserWindow,
bool /* show */ )
@@ -1143,5 +1145,15 @@ IPC_BEGIN_MESSAGES(Automation)
FilePath /* root directory of extension */,
AutomationMsg_ExtensionResponseValues)
+ // 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)
+
+ // Opens a new browser window of a specific type.
+ IPC_SYNC_MESSAGE_ROUTED2_0(AutomationMsg_OpenNewBrowserWindowOfType,
+ int /* Type (Browser::Type) */,
+ bool /* show */ )
+
IPC_END_MESSAGES(Automation)
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index 4658bf3..4e3b785 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -485,8 +485,13 @@ 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) {
+ if (type == BrowserProxy::TYPE_NORMAL)
+ return Send(new AutomationMsg_OpenNewBrowserWindow(0, show));
+ return Send(
+ new AutomationMsg_OpenNewBrowserWindowOfType(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.
//