diff options
author | japhet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 22:24:58 +0000 |
---|---|---|
committer | japhet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 22:24:58 +0000 |
commit | 2ef6527547e597552e34159294574b74471fd636 (patch) | |
tree | 6e35434a86f82c0c18280126900fa61fa3121840 /webkit | |
parent | 4fd471b77191784cf988bd30d4194ba670ba8e06 (diff) | |
download | chromium_src-2ef6527547e597552e34159294574b74471fd636.zip chromium_src-2ef6527547e597552e34159294574b74471fd636.tar.gz chromium_src-2ef6527547e597552e34159294574b74471fd636.tar.bz2 |
Fake main window resizing in the test shell.
BUG=22707
TEST=window-resize layout tests
Review URL: http://codereview.chromium.org/212053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
6 files changed, 36 insertions, 12 deletions
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt index 6f685a5..2c579ff 100755 --- a/webkit/tools/layout_tests/test_expectations.txt +++ b/webkit/tools/layout_tests/test_expectations.txt @@ -146,10 +146,6 @@ WONTFIX SKIP : LayoutTests/webarchive/adopt-inline-styled-node-webarchive.html = // WONTFIX TESTS // ----------------------------------------------------------------- -// We don't intend to pass all of these cases, so this is an expected fail. -// Window resizing is not implemented in chrome. -BUG1137420 WONTFIX : LayoutTests/fast/dom/Window/window-resize.html = FAIL - // This test is completely timing dependent. It is testing the time // between a key event and a search event. You cannot count on this // always being exactly the same, so we allow this to either PASS or FAIL @@ -611,9 +607,6 @@ BUG10274 WIN LINUX : LayoutTests/fast/dom/Window/window-screen-properties.html = // it doesn't need to block the current release BUG10275 : LayoutTests/http/tests/security/cross-frame-access-put.html = FAIL -// We don't support support window.resizeTo (nor is it planned for Beta) -BUG982602 : LayoutTests/fast/dom/Window/window-resize-and-move-arguments.html = FAIL - // TODO(joshia): Need some changes to the test shell in order to support // Java applet related unit tests. So disable the following for now. BUG879449 : LayoutTests/fast/replaced/applet-disabled-positioned.html = FAIL diff --git a/webkit/tools/test_shell/mac/test_webview_delegate.mm b/webkit/tools/test_shell/mac/test_webview_delegate.mm index 369eaa4..3d298b9 100644 --- a/webkit/tools/test_shell/mac/test_webview_delegate.mm +++ b/webkit/tools/test_shell/mac/test_webview_delegate.mm @@ -112,15 +112,17 @@ WebRect TestWebViewDelegate::windowRect() { } void TestWebViewDelegate::setWindowRect(const WebRect& rect) { - // TODO: Mac window movement if (this == shell_->delegate()) { - // ignored + set_fake_window_rect(rect); } else if (this == shell_->popup_delegate()) { popup_bounds_ = rect; // The initial position of the popup. } } WebRect TestWebViewDelegate::rootWindowRect() { + if (using_fake_rect_) { + return fake_window_rect(); + } if (WebWidgetHost* host = GetWidgetHost()) { NSView *view = host->view_handle(); NSRect rect = [[[view window] contentView] frame]; diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index f63b9a8..ab3aa12f 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -899,6 +899,7 @@ TestWebViewDelegate::TestWebViewDelegate(TestShell* shell) top_loading_frame_(NULL), page_id_(-1), last_page_id_updated_(-1), + using_fake_rect_(false), #if defined(OS_LINUX) cursor_type_(GDK_X_CURSOR), #endif @@ -1079,3 +1080,12 @@ std::wstring TestWebViewDelegate::GetFrameDescription(WebFrame* webframe) { return L"frame (anonymous)"; } } + +void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { + fake_rect_ = rect; + using_fake_rect_ = true; +} + +WebRect TestWebViewDelegate::fake_window_rect() { + return fake_rect_; +} diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index f96b351..e688a9f 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -25,8 +25,8 @@ #include "base/scoped_ptr.h" #include "base/weak_ptr.h" #include "webkit/api/public/WebFrameClient.h" -#if defined(OS_MACOSX) #include "webkit/api/public/WebRect.h" +#if defined(OS_MACOSX) #include "webkit/api/public/WebPopupMenuInfo.h" #endif #include "webkit/glue/webcursor.h" @@ -312,6 +312,16 @@ class TestWebViewDelegate : public WebViewDelegate, // test. void LocationChangeDone(WebKit::WebFrame*); + // Tests that require moving or resizing the main window (via resizeTo() or + // moveTo()) pass in Chrome even though Chrome disregards move requests for + // non-popup windows (see TabContents::RequestMove()). These functions allow + // the test shell to mimic its behavior. If setWindowRect() is called for + // the main window, the passed in WebRect is saved as fake_rect_ and we return + // it instead of the real window dimensions whenever rootWindowRect() is + // called. + WebKit::WebRect fake_window_rect(); + void set_fake_window_rect(const WebKit::WebRect&); + WebWidgetHost* GetWidgetHost(); void UpdateForCommittedLoad(WebKit::WebFrame* webframe, bool is_new_navigation); @@ -355,6 +365,9 @@ class TestWebViewDelegate : public WebViewDelegate, WebCursor current_cursor_; + WebKit::WebRect fake_rect_; + bool using_fake_rect_; + #if defined(OS_WIN) // Classes needed by drag and drop. scoped_refptr<TestDragDelegate> drag_delegate_; diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc index f99b280..c73d62a 100644 --- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc +++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc @@ -156,7 +156,7 @@ WebRect TestWebViewDelegate::windowRect() { void TestWebViewDelegate::setWindowRect(const WebRect& rect) { if (this == shell_->delegate()) { - // ignored + set_fake_window_rect(rect); } else if (this == shell_->popup_delegate()) { WebWidgetHost* host = GetWidgetHost(); GtkWidget* drawing_area = host->view_handle(); @@ -168,6 +168,9 @@ void TestWebViewDelegate::setWindowRect(const WebRect& rect) { } WebRect TestWebViewDelegate::rootWindowRect() { + if (using_fake_rect_) { + return fake_window_rect(); + } if (WebWidgetHost* host = GetWidgetHost()) { // We are being asked for the x/y and width/height of the entire browser // window. This means the x/y is the distance from the corner of the diff --git a/webkit/tools/test_shell/test_webview_delegate_win.cc b/webkit/tools/test_shell/test_webview_delegate_win.cc index 04eeb1e..3afdfaa 100644 --- a/webkit/tools/test_shell/test_webview_delegate_win.cc +++ b/webkit/tools/test_shell/test_webview_delegate_win.cc @@ -86,7 +86,7 @@ WebRect TestWebViewDelegate::windowRect() { void TestWebViewDelegate::setWindowRect(const WebRect& rect) { if (this == shell_->delegate()) { - // ignored + set_fake_window_rect(rect); } else if (this == shell_->popup_delegate()) { MoveWindow(shell_->popupWnd(), rect.x, rect.y, rect.width, rect.height, FALSE); @@ -94,6 +94,9 @@ void TestWebViewDelegate::setWindowRect(const WebRect& rect) { } WebRect TestWebViewDelegate::rootWindowRect() { + if (using_fake_rect_) { + return fake_window_rect(); + } if (WebWidgetHost* host = GetWidgetHost()) { RECT rect; HWND root_window = ::GetAncestor(host->view_handle(), GA_ROOT); |