Diff
Modified: trunk/Tools/ChangeLog (116337 => 116338)
--- trunk/Tools/ChangeLog 2012-05-07 19:12:00 UTC (rev 116337)
+++ trunk/Tools/ChangeLog 2012-05-07 19:22:05 UTC (rev 116338)
@@ -1,3 +1,55 @@
+2012-05-07 Jon Lee <[email protected]>
+
+ WebKitTestRunner needs layoutTestController.dumpFrameLoadCallbacks
+ https://bugs.webkit.org/show_bug.cgi?id=42331
+ <rdar://problem/8193641>
+
+ Reviewed by Darin Adler.
+
+ This patch sets up the framework for supporting dumpFrameLoadCallbacks, as well as
+ outputting some of the required strings. As tests become unskipped the other callbacks
+ can be supported.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: Add dumpFrameLoadCallbacks()
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didReceiveMessage): pass in the dictionary containing keys needed to initialize
+ dump callbacks for the layoutTestController.
+ (WTR::InjectedBundle::booleanForKey): Helper function to extract boolean value from key in WKDictionaryRef.
+ Output some warning if we are trying to extract a value that is not a boolean.
+ (WTR::InjectedBundle::beginTesting): Update to take in the dictionary passed in by the TestController.
+ We cannot set the bits on the layoutTestController until it has been created in beginTesting().
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didReceiveMessage):
+ (WTR):
+ (WTR::InjectedBundle::beginTesting):
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+ (InjectedBundle):
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR):
+ (WTR::dumpFrameDescriptionSuitableForTestResult): Static function similar to
+ -[WebFrame _drt_descriptionSuitableForTestResult] in DumpRenderTree.
+ (WTR::InjectedBundlePage::didStartProvisionalLoadForFrame): Output string.
+ (WTR::InjectedBundlePage::didCommitLoadForFrame): Output string.
+ (WTR::InjectedBundlePage::didFinishLoadForFrame): Output string.
+ (WTR::InjectedBundlePage::didReceiveTitleForFrame): Output string.
+ (WTR::InjectedBundlePage::didCancelClientRedirectForFrame): Output string.
+ (WTR::InjectedBundlePage::willPerformClientRedirectForFrame): Output string. In WK1 it's
+ "willPerformClientRedirectToURL" so we will have to use that value here.
+ (WTR::InjectedBundlePage::didFinishDocumentLoadForFrame): Output string.
+ (WTR::InjectedBundlePage::didHandleOnloadEventsForFrame): Output string.
+ * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+ (WTR::LayoutTestController::LayoutTestController): Initialize to not dump frame load callbacks.
+ * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+ (WTR::LayoutTestController::dumpFrameLoadCallbacks): Change to use setShouldDumpFrameLoadCallbacks.
+ (WTR::LayoutTestController::setShouldDumpFrameLoadCallbacks): Set bit.
+ (WTR::LayoutTestController::shouldDumpFrameLoadCallbacks): Return bit.
+ (LayoutTestController): Added m_dumpFrameLoadCallbacks to track whether to dump the output.
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::shouldLogFrameLoadDelegates): Similar to DRT.
+ (WTR::TestInvocation::invoke): Based on the URL loaded, set the bit in the dictionary that gets passed
+ to the injected bundle.
+
2012-05-07 Tommy Widenflycht <[email protected]>
[chromium] MediaStream API: Enhance WebUserMediaClientMock and add a test for it
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl (116337 => 116338)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl 2012-05-07 19:12:00 UTC (rev 116337)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl 2012-05-07 19:22:05 UTC (rev 116338)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -41,6 +41,7 @@
void dumpStatusCallbacks();
void dumpTitleChanges();
void dumpFullScreenCallbacks();
+ void dumpFrameLoadCallbacks();
void dumpConfigurationForViewport(in int deviceDPI, in int deviceWidth, in int deviceHeight, in int availableWidth, in int availableHeight);
// Special options.
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (116337 => 116338)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2012-05-07 19:12:00 UTC (rev 116337)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2012-05-07 19:22:05 UTC (rev 116338)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -148,7 +148,7 @@
WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithUTF8CString("BeginTest"));
WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get());
- beginTesting();
+ beginTesting(messageBodyDictionary);
return;
} else if (WKStringIsEqualToUTF8CString(messageName, "Reset")) {
ASSERT(messageBody);
@@ -190,8 +190,21 @@
WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
}
-void InjectedBundle::beginTesting()
+bool InjectedBundle::booleanForKey(WKDictionaryRef dictionary, const char* key)
{
+ WKRetainPtr<WKStringRef> wkKey(AdoptWK, WKStringCreateWithUTF8CString(key));
+ WKTypeRef value = WKDictionaryGetItemForKey(dictionary, wkKey.get());
+ if (WKGetTypeID(value) != WKBooleanGetTypeID()) {
+ stringBuilder()->append("Boolean value for key \"");
+ stringBuilder()->append(key);
+ stringBuilder()->append("\" not found in dictionary\n");
+ return false;
+ }
+ return WKBooleanGetValue(static_cast<WKBooleanRef>(value));
+}
+
+void InjectedBundle::beginTesting(WKDictionaryRef settings)
+{
m_state = Testing;
m_pixelResult.clear();
@@ -215,6 +228,8 @@
WKBundleRemoveAllUserContent(m_bundle, m_pageGroup);
+ m_layoutTestController->setShouldDumpFrameLoadCallbacks(booleanForKey(settings, "DumpFrameLoadDelegates"));
+
page()->reset();
WKBundleClearAllDatabases(m_bundle);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (116337 => 116338)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h 2012-05-07 19:12:00 UTC (rev 116337)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h 2012-05-07 19:22:05 UTC (rev 116338)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -106,8 +106,10 @@
void platformInitialize(WKTypeRef initializationUserData);
void resetLocalSettings();
- void beginTesting();
+ void beginTesting(WKDictionaryRef initialSettings);
+ bool booleanForKey(WKDictionaryRef, const char* key);
+
WKBundleRef m_bundle;
WKBundlePageGroupRef m_pageGroup;
Vector<OwnPtr<InjectedBundlePage> > m_pages;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (116337 => 116338)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2012-05-07 19:12:00 UTC (rev 116337)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2012-05-07 19:22:05 UTC (rev 116338)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -347,6 +347,32 @@
// Loader Client Callbacks
+// String output must be identical to -[WebFrame _drt_descriptionSuitableForTestResult].
+static void dumpFrameDescriptionSuitableForTestResult(WKBundleFrameRef frame)
+{
+ WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame));
+ if (WKBundleFrameIsMainFrame(frame)) {
+ if (WKStringIsEmpty(name.get())) {
+ InjectedBundle::shared().stringBuilder()->append("main frame");
+ return;
+ }
+
+ InjectedBundle::shared().stringBuilder()->append("main frame \"");
+ InjectedBundle::shared().stringBuilder()->append(toWTFString(name));
+ InjectedBundle::shared().stringBuilder()->append("\"");
+ return;
+ }
+
+ if (WKStringIsEmpty(name.get())) {
+ InjectedBundle::shared().stringBuilder()->append("frame (anonymous)");
+ return;
+ }
+
+ InjectedBundle::shared().stringBuilder()->append("frame \"");
+ InjectedBundle::shared().stringBuilder()->append(toWTFString(name));
+ InjectedBundle::shared().stringBuilder()->append("\"");
+}
+
void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didStartProvisionalLoadForFrame(frame);
@@ -462,6 +488,11 @@
if (!InjectedBundle::shared().isTestRunning())
return;
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpFrameLoadCallbacks()) {
+ dumpFrameDescriptionSuitableForTestResult(frame);
+ InjectedBundle::shared().stringBuilder()->append(" - didStartProvisionalLoadForFrame\n");
+ }
+
if (InjectedBundle::shared().topLoadingFrame())
return;
InjectedBundle::shared().setTopLoadingFrame(frame);
@@ -488,6 +519,14 @@
void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame)
{
+ if (!InjectedBundle::shared().isTestRunning())
+ return;
+
+ if (!InjectedBundle::shared().layoutTestController()->shouldDumpFrameLoadCallbacks())
+ return;
+
+ dumpFrameDescriptionSuitableForTestResult(frame);
+ InjectedBundle::shared().stringBuilder()->append(" - didCommitLoadForFrame\n");
}
enum FrameNamePolicy { ShouldNotIncludeFrameName, ShouldIncludeFrameName };
@@ -639,6 +678,11 @@
if (!InjectedBundle::shared().isTestRunning())
return;
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpFrameLoadCallbacks()) {
+ dumpFrameDescriptionSuitableForTestResult(frame);
+ InjectedBundle::shared().stringBuilder()->append(" - didFinishLoadForFrame\n");
+ }
+
if (frame != InjectedBundle::shared().topLoadingFrame())
return;
InjectedBundle::shared().setTopLoadingFrame(0);
@@ -669,6 +713,13 @@
if (!InjectedBundle::shared().isTestRunning())
return;
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpFrameLoadCallbacks()) {
+ dumpFrameDescriptionSuitableForTestResult(frame);
+ InjectedBundle::shared().stringBuilder()->append(" - didReceiveTitle: ");
+ InjectedBundle::shared().stringBuilder()->append(toWTFString(title));
+ InjectedBundle::shared().stringBuilder()->append("\n");
+ }
+
if (!InjectedBundle::shared().layoutTestController()->shouldDumpTitleChanges())
return;
@@ -706,10 +757,28 @@
void InjectedBundlePage::didCancelClientRedirectForFrame(WKBundleFrameRef frame)
{
+ if (!InjectedBundle::shared().isTestRunning())
+ return;
+
+ if (!InjectedBundle::shared().layoutTestController()->shouldDumpFrameLoadCallbacks())
+ return;
+
+ dumpFrameDescriptionSuitableForTestResult(frame);
+ InjectedBundle::shared().stringBuilder()->append(" - didCancelClientRedirectForFrame\n");
}
void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundleFrameRef frame, WKURLRef url, double delay, double date)
{
+ if (!InjectedBundle::shared().isTestRunning())
+ return;
+
+ if (!InjectedBundle::shared().layoutTestController()->shouldDumpFrameLoadCallbacks())
+ return;
+
+ dumpFrameDescriptionSuitableForTestResult(frame);
+ InjectedBundle::shared().stringBuilder()->append(" - willPerformClientRedirectToURL: ");
+ InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKURLCopyString(url))));
+ InjectedBundle::shared().stringBuilder()->append(" \n");
}
void InjectedBundlePage::didSameDocumentNavigationForFrame(WKBundleFrameRef frame, WKSameDocumentNavigationType type)
@@ -721,6 +790,11 @@
if (!InjectedBundle::shared().isTestRunning())
return;
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpFrameLoadCallbacks()) {
+ dumpFrameDescriptionSuitableForTestResult(frame);
+ InjectedBundle::shared().stringBuilder()->append(" - didFinishDocumentLoadForFrame\n");
+ }
+
unsigned pendingFrameUnloadEvents = WKBundleFrameGetPendingUnloadCount(frame);
if (pendingFrameUnloadEvents) {
InjectedBundle::shared().stringBuilder()->append(frameToStr(frame));
@@ -732,6 +806,13 @@
void InjectedBundlePage::didHandleOnloadEventsForFrame(WKBundleFrameRef frame)
{
+ if (!InjectedBundle::shared().isTestRunning())
+ return;
+
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpFrameLoadCallbacks()) {
+ dumpFrameDescriptionSuitableForTestResult(frame);
+ InjectedBundle::shared().stringBuilder()->append(" - didHandleOnloadEventsForFrame\n");
+ }
}
void InjectedBundlePage::didDisplayInsecureContentForFrame(WKBundleFrameRef frame)
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp (116337 => 116338)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp 2012-05-07 19:12:00 UTC (rev 116337)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp 2012-05-07 19:22:05 UTC (rev 116338)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -102,6 +102,7 @@
, m_dumpTitleChanges(false)
, m_dumpPixels(true)
, m_dumpFullScreenCallbacks(false)
+ , m_dumpFrameLoadCallbacks(false)
, m_waitToDump(false)
, m_testRepaint(false)
, m_testRepaintSweepHorizontally(false)
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h (116337 => 116338)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h 2012-05-07 19:12:00 UTC (rev 116337)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h 2012-05-07 19:22:05 UTC (rev 116338)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,8 +72,11 @@
void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; }
void dumpTitleChanges() { m_dumpTitleChanges = true; }
void dumpFullScreenCallbacks() { m_dumpFullScreenCallbacks = true; }
+ void dumpFrameLoadCallbacks() { setShouldDumpFrameLoadCallbacks(true); }
void dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight);
+ void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
+
// Special options.
void keepWebHistory();
void setAcceptsEditing(bool value) { m_shouldAllowEditing = value; }
@@ -151,6 +154,7 @@
bool shouldDumpTitleChanges() const { return m_dumpTitleChanges; }
bool shouldDumpPixels() const { return m_dumpPixels; }
bool shouldDumpFullScreenCallbacks() const { return m_dumpFullScreenCallbacks; }
+ bool shouldDumpFrameLoadCallbacks() const { return m_dumpFrameLoadCallbacks; }
bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; }
bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; }
@@ -225,6 +229,7 @@
bool m_dumpTitleChanges;
bool m_dumpPixels;
bool m_dumpFullScreenCallbacks;
+ bool m_dumpFrameLoadCallbacks;
bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
bool m_testRepaint;
bool m_testRepaintSweepHorizontally;
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (116337 => 116338)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2012-05-07 19:12:00 UTC (rev 116337)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2012-05-07 19:22:05 UTC (rev 116338)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -127,6 +127,10 @@
else
TestController::shared().mainWebView()->resizeTo(normalWidth, normalHeight);
}
+static bool shouldLogFrameLoadDelegates(const char* pathOrURL)
+{
+ return strstr(pathOrURL, "loading/");
+}
static bool shouldOpenWebInspector(const char* pathOrURL)
{
@@ -140,6 +144,10 @@
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("BeginTest"));
WKRetainPtr<WKMutableDictionaryRef> beginTestMessageBody = adoptWK(WKMutableDictionaryCreate());
+ WKRetainPtr<WKStringRef> dumpFrameLoadDelegatesKey = adoptWK(WKStringCreateWithUTF8CString("DumpFrameLoadDelegates"));
+ WKRetainPtr<WKBooleanRef> dumpFrameLoadDelegatesValue = adoptWK(WKBooleanCreate(shouldLogFrameLoadDelegates(m_pathOrURL.c_str())));
+ WKDictionaryAddItem(beginTestMessageBody.get(), dumpFrameLoadDelegatesKey.get(), dumpFrameLoadDelegatesValue.get());
+
WKRetainPtr<WKStringRef> dumpPixelsKey = adoptWK(WKStringCreateWithUTF8CString("DumpPixels"));
WKRetainPtr<WKBooleanRef> dumpPixelsValue = adoptWK(WKBooleanCreate(m_dumpPixels));
WKDictionaryAddItem(beginTestMessageBody.get(), dumpPixelsKey.get(), dumpPixelsValue.get());