Viewport percentage tests that resize the viewport are flaky
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Jun 2014 00:01:16 +0000 (00:01 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Jun 2014 00:01:16 +0000 (00:01 +0000)
commit8104b53ee3b74daa33a9b4dfa3ae1aca832977a3
treec7a014a97c1e86ba1726950d126432f047eeeece
parentec913efc86432fdef843d91fef89ce4321c8fad7
Viewport percentage tests that resize the viewport are flaky
https://bugs.webkit.org/show_bug.cgi?id=133351

Reviewed by Anders Carlsson.

Source/WebCore:
* page/FrameView.cpp:
(WebCore::FrameView::setFrameRect): Removed code that explicitly sends a resize event here.
The resize event will be sent as a side effect of layout instead.
(WebCore::FrameView::sendResizeEventIfNeeded): Don't send a resize event until layout is done,
since this is what propagates the new geometry in so the JavaScript code can detect it. Also
simplified the logic and streamlined a little, and added a FIXME about the bad idea here where
the code enqueues an event for an unknown time in the future. Removed the unneeded code that
passes in the DOM window as the target to dispatchWindowEvent, since that gets filled in as the
target by default.

Tools:
* DumpRenderTree/mac/DumpRenderTree.mm:
(sizeWebViewForCurrentTest): Added a call to reset the window origin, which
happens to be stored in the UI delegate object. This is part of resetting the
window position.

* DumpRenderTree/mac/UIDelegate.h: Store the window origin rather than storing
a frame rectangle. The size is stored in the size of the web view itself.
* DumpRenderTree/mac/UIDelegate.mm:
(-[UIDelegate resetWindowOrigin]): Added.
(-[UIDelegate webView:setFrame:]): Changed to set the size of the web view. The
old version would store the frame, but not resize the web view!
(-[UIDelegate webViewFrame:]): Get the size from the web view.

* WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
(WTR::PlatformWebView::setWindowFrame): Added code to resize the web view.

* WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
(WTR::PlatformWebView::resizeTo): Added a comment about missing code to resize
the window.

* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::PlatformWebView::resizeTo): Changed this to call setWindowFrame so the
window gets resized too, not just the web view.
(WTR::PlatformWebView::setWindowFrame): Added code to set the size of the web view.

* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::resizeTo): Changed this to call setWindowFrame so the
window gets resized too, not just the web view.
(WTR::PlatformWebView::setWindowFrame): Added code to set the size of the web view.

LayoutTests:
* css3/viewport-percentage-lengths/resources/resize-test.js:
Added code to compensate for the difference between innerWidth/Height and outerWidth/Height
so this works well in a browser window. Added code to "warm up" so the first resize triggers
a resize event. Tweaked style of the code a bit. Use resize events to avoid flakiness due
to race conditions. One thing I did not fix is the "out of order" problem where all the
test results get written out after the words TEST COMPLETE.

* css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block-expected.txt:
Updated due to changes to the underlying test machinery, and also to show actual expected success.
The old results said PASS with various obviously wrong results.

* css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block.html:
Changed this test to use the shared resize-test.js.

* css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child-expected.txt:
Updated due to changes to the underlying test machinery, and also to show actual expected success.
The old results said PASS with various obviously wrong results.

* css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child.html:
Streamlined this test a little.

* css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt:
Updated due to changes to the underlying test machinery, and also to show actual expected success.
The old results said PASS with various obviously wrong results.

* css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html:
Streamlined this test a little.

* css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt:
Updated due to changes to the underlying test machinery, and also to show both expected success,
and some expected failures. These failures were going unnoticed before since the test didn't
successfully do any resizing of the web view.

* css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html:
Streamlined this test a little.

* fast/dom/Window/window-resize-contents-expected.txt: Updated to reflect the test actually
resizing. The old test results expected no resizing to occur.
* fast/dom/Window/window-resize-contents.html: Updated to use a resize event handler so the
test can successfully test asynchronous resizes like the ones done by WebKit2.

* fast/dom/rtl-scroll-to-leftmost-and-resize.html: Updated to use a resize event handler so
this can test asynchronous resizes. Also fixed code that was treating the arguments to resizeTo
as if they were inner coordinates rather than outer. However, the bug this tests for has not
been fixed, so need to expect failures.

* platform/mac/TestExpectations: Added a failure expection for the test above.

* platform/mac/fast/dynamic/window-resize-scrollbars-test-expected.png: Updated to expect a result
that successfully resized.
* platform/mac/fast/dynamic/window-resize-scrollbars-test-expected.txt: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169505 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/viewport-percentage-lengths/resources/resize-test.js
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block-expected.txt
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-anonymous-block.html
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child-expected.txt
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-percent-size-child.html
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size-expected.txt
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-relative-font-size.html
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt
LayoutTests/css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html
LayoutTests/fast/dom/Window/window-resize-contents-expected.txt
LayoutTests/fast/dom/Window/window-resize-contents.html
LayoutTests/fast/dom/rtl-scroll-to-leftmost-and-resize.html
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/mac/fast/dynamic/window-resize-scrollbars-test-expected.png
LayoutTests/platform/mac/fast/dynamic/window-resize-scrollbars-test-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/mac/UIDelegate.h
Tools/DumpRenderTree/mac/UIDelegate.mm
Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp
Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp
Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm