Commit 54741f66 authored by mjs@apple.com's avatar mjs@apple.com
Browse files

2011-01-18 Maciej Stachowiak <mjs@apple.com>

        Reviewed by Sam Weinig.

        WebKitTestRunner should track loading more like DumpRenderTree
        https://bugs.webkit.org/show_bug.cgi?id=52692

        Change load tracking to track the current top loading frame, in the manner of DumpRenderTree.
        This makes some tests that call notifyDone multiple times pass.
        
        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
        (WTR::InjectedBundle::InjectedBundle):
        (WTR::InjectedBundle::done):
        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
        (WTR::InjectedBundle::topLoadingFrame):
        (WTR::InjectedBundle::setTopLoadingFrame):
        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::InjectedBundlePage::InjectedBundlePage):
        (WTR::InjectedBundlePage::stopLoading):
        (WTR::InjectedBundlePage::didStartProvisionalLoadForFrame):
        (WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame):
        (WTR::InjectedBundlePage::didFinishLoadForFrame):
        (WTR::InjectedBundlePage::didFailLoadWithErrorForFrame):
        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
        (WTR::LayoutTestController::notifyDone):
        * WebKitTestRunner/TestController.cpp:
        (WTR::TestController::didReceiveMessageFromInjectedBundle):
2011-01-18  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Sam Weinig.

        WebKitTestRunner should track loading more like DumpRenderTree
        https://bugs.webkit.org/show_bug.cgi?id=52692
        
        Relax the message check in didSaveFrameToPageCache a bit more, since
        layout tests were still hitting the old one.

        * UIProcess/WebPageProxy.cpp:
        (WebKit::isDisconnectedFrame):
        (WebKit::WebPageProxy::didSaveFrameToPageCache):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76092 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4ab3da0f
......@@ -18,6 +18,7 @@ function runTest()
var destinationRichText = document.getElementById("destination-rich-text");
sel.setPosition(destinationRichText, 0);
document.execCommand("Paste");
alert(destinationRichText.innerHTML);
var destinationPlainText = document.getElementById("destination-plain-text");
destinationPlainText.focus();
......@@ -29,6 +30,8 @@ function runTest()
results.innerText = "Plain text field has the wrong value (expected " +
JSON.stringify(expectedPlainTextValue) + " but found " +
JSON.stringify(destinationPlainText.value) + ").";
Markup.dump(document.body);
Markup.notifyDone();
return;
}
......@@ -52,6 +55,8 @@ function runTest()
results.innerText = "Plain text field has the wrong value (expected " +
JSON.stringify(expectedPlainTextValue2) + " but found " +
JSON.stringify(destinationPlainText.value) + ").";
Markup.dump(document.body);
Markup.notifyDone();
return;
}
......
......@@ -14,6 +14,9 @@ function divScrolled() {
document.getElementById('result').innerHTML = 'SUCCESS: div.onscroll was called, but window.onscroll was not.';
// Don't call notifyDone straight away, in case there's another scroll event coming/bubbling.
doneTimeout = setTimeout(function() {
// Don't pollute the test result with nonsense.
document.getElementById('container').innerHTML = '';
if (window.layoutTestController)
layoutTestController.notifyDone();
}, 100);
......@@ -32,9 +35,6 @@ function runTest() {
div.onscroll = divScrolled;
window.onscroll = windowScrolled;
div.scrollByLines(1);
// Don't pollute the test result with nonsense.
div.innerHTML = '';
}
</script>
......
......@@ -976,6 +976,7 @@ java
# WebKit2 needs layoutTestController.overridePreference
# <https://bugs.webkit.org/show_bug.cgi?id=42197>
http/tests/navigation/go-back-to-error-page.html
http/tests/navigation/ping-cookie.html
plugins/application-plugin-plugins-disabled.html
fast/canvas/webgl/context-lost-restored.html
......@@ -1084,6 +1085,7 @@ media/restore-from-page-cache.html
# Pasteboard doesn't work in WebKit2
# <https://bugs.webkit.org/show_bug.cgi?id=42317>
editing/pasteboard/copy-null-characters.html
editing/execCommand/4128080-2.html
editing/execCommand/5939887.html
editing/execCommand/copy-without-selection.html
......@@ -2333,3 +2335,24 @@ http/tests/media/video-buffered.html
# These require DRT setSerializeHTTPLoads implementation for WebKit2 to be reliable.
http/tests/local/link-stylesheet-load-order.html
http/tests/local/link-stylesheet-load-order-preload.html
# Transitions sometimes don't stop when they should
transitions/hang-with-bad-transition-list.html
transitions/remove-transition-style.html
transitions/repeated-firing-background-color.html
transitions/zero-duration-with-non-zero-delay-end.html
# CSSValue and CSSPrimitiveValue prototypes are wrong
fast/dom/global-constructors.html
# WebKit2 doesn't support tiled layers
compositing/tiling/huge-layer-resize.html
# Unexplained plugin failures
plugins/destroy-reentry.html
platform/mac/plugins/testplugin-onnew-onpaint.html
plugins/destroy-stream-twice.html
plugins/embed-inside-object.html
plugins/no-mime-with-valid-extension.html
......@@ -51,6 +51,7 @@
function startTransition()
{
var box = document.getElementById('box');
box.addEventListener("webkitTransitionEnd", function() { alert("end"); }, false);
box.className = 'animated';
window.setTimeout(function() {
box.style.opacity = '0.5';
......@@ -67,4 +68,4 @@
<div id="results"></div>
</body>
</html>
\ No newline at end of file
</html>
2011-01-18 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam Weinig.
WebKitTestRunner should track loading more like DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=52692
Relax the message check in didSaveFrameToPageCache a bit more, since
layout tests were still hitting the old one.
* UIProcess/WebPageProxy.cpp:
(WebKit::isDisconnectedFrame):
(WebKit::WebPageProxy::didSaveFrameToPageCache):
2011-01-18 Brady Eidson <beidson@apple.com>
 
Reviewed by Darin Adler.
......@@ -1082,6 +1082,11 @@ void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
parentFrame->appendChild(subFrame.get());
}
static bool isDisconnectedFrame(WebFrameProxy* frame)
{
return !frame->page() || !frame->page()->mainFrame() || !frame->isDescendantOf(frame->page()->mainFrame());
}
void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
{
MESSAGE_CHECK(m_mainFrame);
......@@ -1089,7 +1094,7 @@ void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
WebFrameProxy* subframe = process()->webFrame(frameID);
MESSAGE_CHECK(subframe);
if (!subframe->parentFrame())
if (isDisconnectedFrame(subframe))
return;
MESSAGE_CHECK(subframe->isDescendantOf(m_mainFrame.get()));
......
2011-01-18 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam Weinig.
WebKitTestRunner should track loading more like DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=52692
Change load tracking to track the current top loading frame, in the manner of DumpRenderTree.
This makes some tests that call notifyDone multiple times pass.
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::InjectedBundle):
(WTR::InjectedBundle::done):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
(WTR::InjectedBundle::topLoadingFrame):
(WTR::InjectedBundle::setTopLoadingFrame):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::stopLoading):
(WTR::InjectedBundlePage::didStartProvisionalLoadForFrame):
(WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame):
(WTR::InjectedBundlePage::didFinishLoadForFrame):
(WTR::InjectedBundlePage::didFailLoadWithErrorForFrame):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::notifyDone):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::didReceiveMessageFromInjectedBundle):
2011-01-18 Mihai Parparita <mihaip@chromium.org>
 
Reviewed by Kent Tamura.
......@@ -266,6 +266,8 @@ unsigned LayoutTestController::workerThreadCount() const
void LayoutTestController::notifyDone()
{
puts("notifyDone");
if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count())
dump();
m_waitToDump = false;
......
......@@ -47,6 +47,7 @@ InjectedBundle& InjectedBundle::shared()
InjectedBundle::InjectedBundle()
: m_bundle(0)
, m_topLoadingFrame(0)
, m_state(Idle)
{
}
......@@ -161,6 +162,7 @@ void InjectedBundle::done()
m_state = Stopping;
page()->stopLoading();
setTopLoadingFrame(0);
WKRetainPtr<WKStringRef> doneMessageName(AdoptWK, WKStringCreateWithUTF8CString("Done"));
WKRetainPtr<WKStringRef> doneMessageBody(AdoptWK, WKStringCreateWithUTF8CString(m_outputStream.str().c_str()));
......
......@@ -65,6 +65,9 @@ public:
bool isTestRunning() { return m_state == Testing; }
WKBundleFrameRef topLoadingFrame() { return m_topLoadingFrame; }
void setTopLoadingFrame(WKBundleFrameRef frame) { m_topLoadingFrame = frame; }
private:
InjectedBundle();
~InjectedBundle();
......@@ -89,6 +92,8 @@ private:
RefPtr<GCController> m_gcController;
RefPtr<EventSendingController> m_eventSendingController;
WKBundleFrameRef m_topLoadingFrame;
std::ostringstream m_outputStream;
enum State {
......
......@@ -37,6 +37,8 @@
#include <WebKit2/WKBundleFramePrivate.h>
#include <WebKit2/WKBundlePagePrivate.h>
#include <WebKit2/WKStringCF.h>
using namespace std;
namespace WTR {
......@@ -168,7 +170,6 @@ static ostream& operator<<(ostream& out, WKBundleFrameRef frame)
InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
: m_page(page)
, m_world(AdoptWK, WKBundleScriptWorldCreateWorld())
, m_isLoading(false)
{
WKBundlePageLoaderClient loaderClient = {
0,
......@@ -233,7 +234,6 @@ InjectedBundlePage::~InjectedBundlePage()
void InjectedBundlePage::stopLoading()
{
WKBundlePageStopLoading(m_page);
m_isLoading = false;
}
void InjectedBundlePage::reset()
......@@ -334,8 +334,9 @@ void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundleFrameRef frame)
if (!InjectedBundle::shared().isTestRunning())
return;
if (frame == WKBundlePageGetMainFrame(m_page))
m_isLoading = true;
if (InjectedBundle::shared().topLoadingFrame())
return;
InjectedBundle::shared().setTopLoadingFrame(frame);
}
void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef frame)
......@@ -344,6 +345,17 @@ void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBu
void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef error)
{
if (!InjectedBundle::shared().isTestRunning())
return;
if (frame != InjectedBundle::shared().topLoadingFrame())
return;
InjectedBundle::shared().setTopLoadingFrame(0);
if (InjectedBundle::shared().layoutTestController()->waitToDump())
return;
InjectedBundle::shared().done();
}
void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame)
......@@ -475,18 +487,14 @@ void InjectedBundlePage::didFinishLoadForFrame(WKBundleFrameRef frame)
if (!InjectedBundle::shared().isTestRunning())
return;
if (!WKBundleFrameIsMainFrame(frame))
return;
m_isLoading = false;
if (this != InjectedBundle::shared().page())
if (frame != InjectedBundle::shared().topLoadingFrame())
return;
InjectedBundle::shared().setTopLoadingFrame(0);
if (InjectedBundle::shared().layoutTestController()->waitToDump())
return;
dump();
InjectedBundle::shared().page()->dump();
}
void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef)
......@@ -494,12 +502,11 @@ void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WK
if (!InjectedBundle::shared().isTestRunning())
return;
if (!WKBundleFrameIsMainFrame(frame))
if (frame != InjectedBundle::shared().topLoadingFrame())
return;
InjectedBundle::shared().setTopLoadingFrame(0);
m_isLoading = false;
if (this != InjectedBundle::shared().page())
if (InjectedBundle::shared().layoutTestController()->waitToDump())
return;
InjectedBundle::shared().done();
......
......@@ -41,7 +41,6 @@ public:
void dump();
void stopLoading();
bool isLoading() { return m_isLoading; }
void reset();
......@@ -124,7 +123,6 @@ private:
WKBundlePageRef m_page;
WKRetainPtr<WKBundleScriptWorldRef> m_world;
WKRetainPtr<WKBundleBackForwardListItemRef> m_previousTestBackForwardListItem;
bool m_isLoading;
};
} // namespace WTR
......
......@@ -132,8 +132,9 @@ void LayoutTestController::notifyDone()
if (!InjectedBundle::shared().isTestRunning())
return;
if (m_waitToDump && !InjectedBundle::shared().page()->isLoading())
if (m_waitToDump && !InjectedBundle::shared().topLoadingFrame())
InjectedBundle::shared().page()->dump();
m_waitToDump = false;
}
......
......@@ -386,6 +386,8 @@ void TestController::didReceiveSynchronousMessageFromInjectedBundle(WKContextRef
void TestController::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody)
{
if (!m_currentInvocation)
return;
m_currentInvocation->didReceiveMessageFromInjectedBundle(messageName, messageBody);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment