summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xchrome/browser/automation/automation_provider.cc13
-rw-r--r--chrome/browser/automation/automation_provider.h1
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc6
-rw-r--r--chrome/test/automation/automation_messages_internal.h9
-rw-r--r--chrome/test/automation/window_proxy.cc9
-rw-r--r--chrome/test/automation/window_proxy.h5
-rw-r--r--chrome/test/startup/feature_startup_test.cc3
7 files changed, 46 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index d43bab6..1217c1a 100755
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -950,6 +950,7 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowExecuteCommand,
ExecuteBrowserCommand)
IPC_MESSAGE_HANDLER(AutomationMsg_WindowViewBounds, WindowGetViewBounds)
+ IPC_MESSAGE_HANDLER(AutomationMsg_SetWindowBounds, SetWindowBounds)
IPC_MESSAGE_HANDLER(AutomationMsg_SetWindowVisible, SetWindowVisible)
#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(AutomationMsg_WindowClick, WindowSimulateClick)
@@ -1713,6 +1714,18 @@ void AutomationProvider::GetFocusedViewID(int handle, int* view_id) {
}
}
+void AutomationProvider::SetWindowBounds(int handle, const gfx::Rect& bounds,
+ bool* success) {
+ *success = false;
+ if (window_tracker_->ContainsHandle(handle)) {
+ HWND hwnd = window_tracker_->GetResource(handle);
+ if (::MoveWindow(hwnd, bounds.x(), bounds.y(), bounds.width(),
+ bounds.height(), true)) {
+ *success = true;
+ }
+ }
+}
+
void AutomationProvider::SetWindowVisible(int handle, bool visible,
bool* result) {
if (window_tracker_->ContainsHandle(handle)) {
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index cbbc23c..c83eaaa 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -180,6 +180,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
int handle,
wchar_t key,
int flags);
+ void SetWindowBounds(int handle, const gfx::Rect& bounds, bool* result);
void SetWindowVisible(int handle, bool visible, bool* result);
void IsWindowActive(int handle, bool* success, bool* is_active);
void ActivateWindow(int handle);
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index 39371e4..3ba508d 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -47,6 +47,12 @@ void AutomationProvider::ActivateWindow(int handle) { NOTIMPLEMENTED(); }
void AutomationProvider::SetWindowVisible(int handle, bool visible,
bool* result) { NOTIMPLEMENTED(); }
+void AutomationProvider::SetWindowBounds(int handle, const gfx::Rect& bounds,
+ bool* success) {
+ NOTIMPLEMENTED();
+}
+
+
void AutomationProvider::GetFocusedViewID(int handle, int* view_id) {
NOTIMPLEMENTED();
}
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 4060b16..66b898e 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -257,6 +257,15 @@ IPC_BEGIN_MESSAGES(Automation)
IPC_SYNC_MESSAGE_ROUTED3_2(AutomationMsg_WindowViewBounds, int, int,
bool, bool, gfx::Rect)
+ // This message sets the bounds of the window.
+ // Request:
+ // int - the handle of the window to resize
+ // gfx::Rect - the bounds of the window
+ // Response:
+ // bool - true if the resize was successful
+ IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_SetWindowBounds, int, gfx::Rect,
+ bool)
+
#if defined(OS_WIN)
// TODO(port): Port these messages.
//
diff --git a/chrome/test/automation/window_proxy.cc b/chrome/test/automation/window_proxy.cc
index 6cced64..eea1ced 100644
--- a/chrome/test/automation/window_proxy.cc
+++ b/chrome/test/automation/window_proxy.cc
@@ -106,6 +106,15 @@ bool WindowProxy::GetViewBoundsWithTimeout(int view_id, gfx::Rect* bounds,
return result;
}
+bool WindowProxy::SetBounds(const gfx::Rect& bounds) {
+ if (!is_valid())
+ return false;
+ bool result = false;
+ sender_->Send(new AutomationMsg_SetWindowBounds(0, handle_, bounds,
+ &result));
+ return result;
+}
+
bool WindowProxy::GetFocusedViewID(int* view_id) {
if (!is_valid()) return false;
diff --git a/chrome/test/automation/window_proxy.h b/chrome/test/automation/window_proxy.h
index 8beb158..efbe1ca 100644
--- a/chrome/test/automation/window_proxy.h
+++ b/chrome/test/automation/window_proxy.h
@@ -82,6 +82,11 @@ class WindowProxy : public AutomationResourceProxy {
bool GetViewBoundsWithTimeout(int view_id, gfx::Rect* bounds,
bool screen_coordinates, uint32 timeout_ms,
bool* is_timeout);
+
+ // Sets the position and size of the window. Returns true if setting the
+ // bounds was successful.
+ bool SetBounds(const gfx::Rect& bounds);
+
// Gets the id of the view that currently has focus. Returns true if the id
// was retrieved.
bool GetFocusedViewID(int* view_id);
diff --git a/chrome/test/startup/feature_startup_test.cc b/chrome/test/startup/feature_startup_test.cc
index 6862d6a..268a1b4 100644
--- a/chrome/test/startup/feature_startup_test.cc
+++ b/chrome/test/startup/feature_startup_test.cc
@@ -3,12 +3,14 @@
// found in the LICENSE file.
#include "base/file_util.h"
+#include "base/gfx/rect.h"
#include "base/path_service.h"
#include "base/perftimer.h"
#include "base/time.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/automation/browser_proxy.h"
+#include "chrome/test/automation/window_proxy.h"
#include "chrome/test/ui/ui_test.h"
#include "net/base/net_util.h"
@@ -61,6 +63,7 @@ class NewTabUIStartupTest : public UITest {
// first (the first is about:blank).
scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
+ ASSERT_TRUE(window->GetWindow().get()->SetBounds(gfx::Rect(1000, 1000)));
int tab_count = -1;
ASSERT_TRUE(window->GetTabCount(&tab_count));
ASSERT_EQ(1, tab_count);