summaryrefslogtreecommitdiffstats
path: root/WebKitTools/WebKitTestRunner
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/WebKitTestRunner')
-rw-r--r--WebKitTools/WebKitTestRunner/Configurations/InjectedBundle.xcconfig2
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl9
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp61
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h21
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp146
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h7
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp14
-rw-r--r--WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h12
-rw-r--r--WebKitTools/WebKitTestRunner/TestController.cpp40
-rw-r--r--WebKitTools/WebKitTestRunner/TestController.h4
-rw-r--r--WebKitTools/WebKitTestRunner/TestInvocation.cpp6
-rw-r--r--WebKitTools/WebKitTestRunner/TestInvocation.h1
-rw-r--r--WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj18
-rw-r--r--WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm2
14 files changed, 279 insertions, 64 deletions
diff --git a/WebKitTools/WebKitTestRunner/Configurations/InjectedBundle.xcconfig b/WebKitTools/WebKitTestRunner/Configurations/InjectedBundle.xcconfig
index 4d3d1ee..dcf4be0 100644
--- a/WebKitTools/WebKitTestRunner/Configurations/InjectedBundle.xcconfig
+++ b/WebKitTools/WebKitTestRunner/Configurations/InjectedBundle.xcconfig
@@ -21,4 +21,4 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-PRODUCT_NAME = InjectedBundle
+PRODUCT_NAME = WebKitTestRunnerInjectedBundle
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
index f3c5e88..a0e36ad 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
@@ -33,6 +33,7 @@ module WTR {
void notifyDone();
// Other dumping.
+ void dumpBackForwardList();
void dumpChildFrameScrollPositions();
void dumpEditingCallbacks();
void dumpSelectionRect();
@@ -45,14 +46,15 @@ module WTR {
void setCanOpenWindows(in boolean value);
void setCloseRemainingWindowsWhenComplete(in boolean value);
void setXSSAuditorEnabled(in boolean value);
- unsigned long windowCount();
// Special DOM functions.
+ void clearBackForwardList();
object computedStyleIncludingVisitedInfo(in object element);
DOMString counterValueForElementById(in DOMString elementId);
- DOMString markerTextForListItem(in object element);
void execCommand(in DOMString name, in DOMString argument);
boolean isCommandEnabled(in DOMString name);
+ DOMString markerTextForListItem(in object element);
+ unsigned long windowCount();
// Repaint testing.
void testRepaint();
@@ -66,6 +68,9 @@ module WTR {
// UserContent testing.
void addUserScript(in DOMString source, in boolean runAtStart, in boolean allFrames);
void addUserStyleSheet(in DOMString source, in boolean allFrames);
+
+ // Compositing testing.
+ DOMString layerTreeAsText();
};
}
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
index af8bb69..6bc1802 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
@@ -27,6 +27,7 @@
#include "ActivateFonts.h"
#include "InjectedBundlePage.h"
+#include "StringFunctions.h"
#include <WebKit2/WKBundle.h>
#include <WebKit2/WKBundlePage.h>
#include <WebKit2/WKBundlePagePrivate.h>
@@ -46,22 +47,21 @@ InjectedBundle& InjectedBundle::shared()
InjectedBundle::InjectedBundle()
: m_bundle(0)
- , m_mainPage(0)
, m_state(Idle)
{
}
-void InjectedBundle::_didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
+void InjectedBundle::didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
{
static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didCreatePage(page);
}
-void InjectedBundle::_willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
+void InjectedBundle::willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
{
static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->willDestroyPage(page);
}
-void InjectedBundle::_didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
+void InjectedBundle::didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
{
static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didReceiveMessage(messageName, messageBody);
}
@@ -73,9 +73,9 @@ void InjectedBundle::initialize(WKBundleRef bundle)
WKBundleClient client = {
0,
this,
- _didCreatePage,
- _willDestroyPage,
- _didReceiveMessage
+ didCreatePage,
+ willDestroyPage,
+ didReceiveMessage
};
WKBundleSetClient(m_bundle, &client);
@@ -85,20 +85,25 @@ void InjectedBundle::initialize(WKBundleRef bundle)
void InjectedBundle::didCreatePage(WKBundlePageRef page)
{
- // FIXME: we really need the main page ref to be sent over from the ui process
- OwnPtr<InjectedBundlePage> pageWrapper = adoptPtr(new InjectedBundlePage(page));
- if (!m_mainPage)
- m_mainPage = pageWrapper.release();
- else
- m_otherPages.add(page, pageWrapper.leakPtr());
+ m_pages.append(adoptPtr(new InjectedBundlePage(page)));
}
void InjectedBundle::willDestroyPage(WKBundlePageRef page)
{
- if (m_mainPage && m_mainPage->page() == page)
- m_mainPage.clear();
- else
- delete m_otherPages.take(page);
+ size_t size = m_pages.size();
+ for (size_t i = 0; i < size; ++i) {
+ if (m_pages[i]->page() == page) {
+ m_pages.remove(i);
+ break;
+ }
+ }
+}
+
+InjectedBundlePage* InjectedBundle::page() const
+{
+ // It might be better to have the UI process send over a reference to the main
+ // page instead of just assuming it's the first one.
+ return m_pages[0].get();
}
void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
@@ -134,14 +139,14 @@ void InjectedBundle::beginTesting()
WKBundleRemoveAllUserContent(m_bundle);
- m_mainPage->reset();
+ page()->reset();
}
void InjectedBundle::done()
{
m_state = Stopping;
- m_mainPage->stopLoading();
+ page()->stopLoading();
WKRetainPtr<WKStringRef> doneMessageName(AdoptWK, WKStringCreateWithUTF8CString("Done"));
WKRetainPtr<WKStringRef> doneMessageBody(AdoptWK, WKStringCreateWithUTF8CString(m_outputStream.str().c_str()));
@@ -153,10 +158,20 @@ void InjectedBundle::done()
void InjectedBundle::closeOtherPages()
{
- Vector<WKBundlePageRef> pages;
- copyKeysToVector(m_otherPages, pages);
- for (size_t i = 0; i < pages.size(); ++i)
- WKBundlePageClose(pages[i]);
+ Vector<WKBundlePageRef> pagesToClose;
+ size_t size = m_pages.size();
+ for (size_t i = 1; i < size; ++i)
+ pagesToClose.append(m_pages[i]->page());
+ size = pagesToClose.size();
+ for (size_t i = 0; i < size; ++i)
+ WKBundlePageClose(pagesToClose[i]);
+}
+
+void InjectedBundle::dumpBackForwardListsForAllPages()
+{
+ size_t size = m_pages.size();
+ for (size_t i = 0; i < size; ++i)
+ m_pages[i]->dumpBackForwardList();
}
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
index 6c5c69e..2c6d14b 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
@@ -30,9 +30,9 @@
#include "GCController.h"
#include "LayoutTestController.h"
#include <WebKit2/WKBase.h>
-#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
#include <sstream>
@@ -53,10 +53,12 @@ public:
GCController* gcController() { return m_gcController.get(); }
EventSendingController* eventSendingController() { return m_eventSendingController.get(); }
- InjectedBundlePage* page() { return m_mainPage.get(); }
- size_t pageCount() { return !!m_mainPage + m_otherPages.size(); }
+ InjectedBundlePage* page() const;
+ size_t pageCount() const { return m_pages.size(); }
void closeOtherPages();
+ void dumpBackForwardListsForAllPages();
+
void done();
std::ostringstream& os() { return m_outputStream; }
@@ -66,19 +68,18 @@ private:
InjectedBundle();
~InjectedBundle();
- static void _didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo);
- static void _willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo);
- static void _didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo);
+ static void didCreatePage(WKBundleRef, WKBundlePageRef, const void* clientInfo);
+ static void willDestroyPage(WKBundleRef, WKBundlePageRef, const void* clientInfo);
+ static void didReceiveMessage(WKBundleRef, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo);
- void didCreatePage(WKBundlePageRef page);
- void willDestroyPage(WKBundlePageRef page);
+ void didCreatePage(WKBundlePageRef);
+ void willDestroyPage(WKBundlePageRef);
void didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody);
void beginTesting();
WKBundleRef m_bundle;
- HashMap<WKBundlePageRef, InjectedBundlePage*> m_otherPages;
- OwnPtr<InjectedBundlePage> m_mainPage;
+ Vector<OwnPtr<InjectedBundlePage> > m_pages;
RefPtr<LayoutTestController> m_layoutTestController;
RefPtr<GCController> m_gcController;
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 22af6ff..d852dd2 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -30,6 +30,9 @@
#include <cmath>
#include <JavaScriptCore/JSRetainPtr.h>
#include <WebKit2/WKArray.h>
+#include <WebKit2/WKBundle.h>
+#include <WebKit2/WKBundleBackForwardList.h>
+#include <WebKit2/WKBundleBackForwardListItem.h>
#include <WebKit2/WKBundleFrame.h>
#include <WebKit2/WKBundleFramePrivate.h>
#include <WebKit2/WKBundlePagePrivate.h>
@@ -38,6 +41,16 @@ using namespace std;
namespace WTR {
+template<typename T> static inline WKRetainPtr<T> adoptWK(T item)
+{
+ return WKRetainPtr<T>(AdoptWK, item);
+}
+
+static bool hasPrefix(const string& searchString, const string& prefix)
+{
+ return searchString.length() >= prefix.length() && searchString.substr(0, prefix.length()) == prefix;
+}
+
static JSValueRef propertyValue(JSContextRef context, JSObjectRef object, const char* propertyName)
{
if (!object)
@@ -171,13 +184,13 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
0,
0,
0,
+ didDisplayInsecureContentForFrame,
+ didRunInsecureContentForFrame,
didClearWindowForFrame,
didCancelClientRedirectForFrame,
willPerformClientRedirectForFrame,
didChangeLocationWithinPageForFrame,
- didHandleOnloadEventsForFrame,
- didDisplayInsecureContentForFrame,
- didRunInsecureContentForFrame
+ didHandleOnloadEventsForFrame
};
WKBundlePageSetLoaderClient(m_page, &loaderClient);
@@ -189,7 +202,8 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
willRunJavaScriptAlert,
willRunJavaScriptConfirm,
willRunJavaScriptPrompt,
- 0 /*mouseDidMoveOverElement*/
+ 0, /*mouseDidMoveOverElement*/
+ 0, /*pageDidScroll*/
};
WKBundlePageSetUIClient(m_page, &uiClient);
@@ -227,6 +241,8 @@ void InjectedBundlePage::reset()
WKBundlePageSetPageZoomFactor(m_page, 1);
WKBundlePageSetTextZoomFactor(m_page, 1);
+
+ m_previousTestBackForwardListItem = adoptWK(WKBundleBackForwardListCopyItemAtIndex(WKBundlePageGetBackForwardList(m_page), 0));
}
// Loader Client Callbacks
@@ -296,12 +312,12 @@ void InjectedBundlePage::didHandleOnloadEventsForFrame(WKBundlePageRef page, WKB
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didHandleOnloadEventsForFrame(frame);
}
-void InjectedBundlePage::didDisplayInsecureContentForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo)
+void InjectedBundlePage::didDisplayInsecureContentForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void* clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didDisplayInsecureContentForFrame(frame);
}
-void InjectedBundlePage::didRunInsecureContentForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo)
+void InjectedBundlePage::didRunInsecureContentForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void* clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didRunInsecureContentForFrame(frame);
}
@@ -361,8 +377,38 @@ void InjectedBundlePage::dumpAllFrameScrollPositions()
dumpDescendantFrameScrollPositions(frame);
}
+static JSRetainPtr<JSStringRef> toJS(const char* string)
+{
+ return JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithUTF8CString(string));
+}
+
+static bool hasDocumentElement(WKBundleFrameRef frame)
+{
+ JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
+ JSObjectRef globalObject = JSContextGetGlobalObject(context);
+
+ JSValueRef documentValue = JSObjectGetProperty(context, globalObject, toJS("document").get(), 0);
+ if (!documentValue)
+ return false;
+
+ ASSERT(JSValueIsObject(context, documentValue));
+ JSObjectRef document = JSValueToObject(context, documentValue, 0);
+
+ JSValueRef documentElementValue = JSObjectGetProperty(context, document, toJS("documentElement").get(), 0);
+ if (!documentElementValue)
+ return false;
+
+ return JSValueToBoolean(context, documentElementValue);
+}
+
static void dumpFrameText(WKBundleFrameRef frame)
{
+ // If the frame doesn't have a document element, its inner text will be an empty string, so
+ // we'll end up just appending a single newline below. But DumpRenderTree doesn't append
+ // anything in this case, so we shouldn't either.
+ if (!hasDocumentElement(frame))
+ return;
+
WKRetainPtr<WKStringRef> text(AdoptWK, WKBundleFrameCopyInnerText(frame));
InjectedBundle::shared().os() << text << "\n";
}
@@ -412,6 +458,9 @@ void InjectedBundlePage::dump()
else if (InjectedBundle::shared().layoutTestController()->shouldDumpMainFrameScrollPosition())
dumpFrameScrollPosition(WKBundlePageGetMainFrame(m_page));
+ if (InjectedBundle::shared().layoutTestController()->shouldDumpBackForwardListsForAllWindows())
+ InjectedBundle::shared().dumpBackForwardListsForAllPages();
+
InjectedBundle::shared().done();
}
@@ -764,4 +813,89 @@ void InjectedBundlePage::didChangeSelection(WKStringRef notificationName)
InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidChangeSelection:" << notificationName << "\n";
}
+static bool compareByTargetName(WKBundleBackForwardListItemRef item1, WKBundleBackForwardListItemRef item2)
+{
+ return toSTD(adoptWK(WKBundleBackForwardListItemCopyTarget(item1))) < toSTD(adoptWK(WKBundleBackForwardListItemCopyTarget(item2)));
+}
+
+static void dumpBackForwardListItem(WKBundleBackForwardListItemRef item, unsigned indent, bool isCurrentItem)
+{
+ unsigned column = 0;
+ if (isCurrentItem) {
+ InjectedBundle::shared().os() << "curr->";
+ column = 6;
+ }
+ for (unsigned i = column; i < indent; i++)
+ InjectedBundle::shared().os() << ' ';
+
+ string url = toSTD(adoptWK(WKURLCopyString(adoptWK(WKBundleBackForwardListItemCopyURL(item)).get())));
+ if (hasPrefix(url, "file:")) {
+ string directoryName = "/LayoutTests/";
+ size_t start = url.find(directoryName);
+ if (start == string::npos)
+ start = 0;
+ else
+ start += directoryName.size();
+ InjectedBundle::shared().os() << "(file test):" << url.substr(start);
+ } else
+ InjectedBundle::shared().os() << url;
+
+ string target = toSTD(adoptWK(WKBundleBackForwardListItemCopyTarget(item)));
+ if (target.length())
+ InjectedBundle::shared().os() << " (in frame \"" << target << "\")";
+
+ // FIXME: Need WKBackForwardListItemIsTargetItem.
+ if (WKBundleBackForwardListItemIsTargetItem(item))
+ InjectedBundle::shared().os() << " **nav target**";
+
+ InjectedBundle::shared().os() << '\n';
+
+ if (WKRetainPtr<WKArrayRef> kids = adoptWK(WKBundleBackForwardListItemCopyChildren(item))) {
+ // Sort to eliminate arbitrary result ordering which defeats reproducible testing.
+ size_t size = WKArrayGetSize(kids.get());
+ Vector<WKBundleBackForwardListItemRef> sortedKids(size);
+ for (size_t i = 0; i < size; ++i)
+ sortedKids[i] = static_cast<WKBundleBackForwardListItemRef>(WKArrayGetItemAtIndex(kids.get(), i));
+ stable_sort(sortedKids.begin(), sortedKids.end(), compareByTargetName);
+ for (size_t i = 0; i < size; ++i)
+ dumpBackForwardListItem(sortedKids[i], indent + 4, false);
+ }
+}
+
+void InjectedBundlePage::dumpBackForwardList()
+{
+ InjectedBundle::shared().os() << "\n============== Back Forward List ==============\n";
+
+ WKBundleBackForwardListRef list = WKBundlePageGetBackForwardList(m_page);
+
+ // Print out all items in the list after m_previousTestBackForwardListItem.
+ // Gather items from the end of the list, then print them out from oldest to newest.
+ Vector<WKRetainPtr<WKBundleBackForwardListItemRef> > itemsToPrint;
+ for (unsigned i = WKBundleBackForwardListGetForwardListCount(list); i; --i) {
+ WKRetainPtr<WKBundleBackForwardListItemRef> item = adoptWK(WKBundleBackForwardListCopyItemAtIndex(list, i));
+ // Something is wrong if the item from the last test is in the forward part of the list.
+ ASSERT(!WKBundleBackForwardListItemIsSame(item.get(), m_previousTestBackForwardListItem.get()));
+ itemsToPrint.append(item);
+ }
+
+ ASSERT(!WKBundleBackForwardListItemIsSame(adoptWK(WKBundleBackForwardListCopyItemAtIndex(list, 0)).get(), m_previousTestBackForwardListItem.get()));
+
+ itemsToPrint.append(adoptWK(WKBundleBackForwardListCopyItemAtIndex(list, 0)));
+
+ int currentItemIndex = itemsToPrint.size() - 1;
+
+ int backListCount = WKBundleBackForwardListGetBackListCount(list);
+ for (int i = -1; i >= -backListCount; --i) {
+ WKRetainPtr<WKBundleBackForwardListItemRef> item = adoptWK(WKBundleBackForwardListCopyItemAtIndex(list, i));
+ if (WKBundleBackForwardListItemIsSame(item.get(), m_previousTestBackForwardListItem.get()))
+ break;
+ itemsToPrint.append(item);
+ }
+
+ for (int i = itemsToPrint.size() - 1; i >= 0; i--)
+ dumpBackForwardListItem(itemsToPrint[i].get(), 8, i == currentItemIndex);
+
+ InjectedBundle::shared().os() << "===============================================\n";
+}
+
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
index 737ad18..b95744f9 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
@@ -45,6 +45,8 @@ public:
void reset();
+ void dumpBackForwardList();
+
private:
// Loader Client
static void didStartProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*);
@@ -60,8 +62,8 @@ private:
static void willPerformClientRedirectForFrame(WKBundlePageRef, WKBundleFrameRef, WKURLRef url, double delay, double date, const void*);
static void didChangeLocationWithinPageForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
static void didHandleOnloadEventsForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
- static void didDisplayInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
- static void didRunInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
+ static void didDisplayInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*);
+ static void didRunInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*);
void didStartProvisionalLoadForFrame(WKBundleFrameRef);
void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef);
void didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef, WKErrorRef);
@@ -119,6 +121,7 @@ private:
WKBundlePageRef m_page;
WKRetainPtr<WKBundleScriptWorldRef> m_world;
+ WKRetainPtr<WKBundleBackForwardListItemRef> m_previousTestBackForwardListItem;
bool m_isLoading;
};
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index f8cbd4f..e828c46 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -29,6 +29,7 @@
#include "InjectedBundlePage.h"
#include "JSLayoutTestController.h"
#include "StringFunctions.h"
+#include <WebKit2/WKBundleBackForwardList.h>
#include <WebKit2/WKBundleFrame.h>
#include <WebKit2/WKBundleFramePrivate.h>
#include <WebKit2/WKBundlePagePrivate.h>
@@ -85,6 +86,7 @@ PassRefPtr<LayoutTestController> LayoutTestController::create()
LayoutTestController::LayoutTestController()
: m_whatToDump(RenderTree)
, m_shouldDumpAllFrameScrollPositions(false)
+ , m_shouldDumpBackForwardListsForAllWindows(false)
, m_shouldAllowEditing(true)
, m_shouldCloseExtraWindows(false)
, m_dumpEditingCallbacks(false)
@@ -148,6 +150,13 @@ bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef anima
return WKBundleFramePauseAnimationOnElementWithId(mainFrame, toWK(animationName).get(), toWK(elementId).get(), time);
}
+JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const
+{
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
+ WKRetainPtr<WKStringRef> text(AdoptWK, WKBundleFrameCopyLayerTreeAsText(mainFrame));
+ return toJS(text);
+}
+
void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
{
WKRetainPtr<WKStringRef> sourceWK = toWK(source);
@@ -233,6 +242,11 @@ unsigned LayoutTestController::windowCount()
return InjectedBundle::shared().pageCount();
}
+void LayoutTestController::clearBackForwardList()
+{
+ WKBundleBackForwardListClear(WKBundlePageGetBackForwardList(InjectedBundle::shared().page()->page()));
+}
+
// Object Creation
void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
index c892ba0..dfafb55 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
@@ -60,6 +60,7 @@ public:
void notifyDone();
// Other dumping.
+ void dumpBackForwardList() { m_shouldDumpBackForwardListsForAllWindows = true; }
void dumpChildFrameScrollPositions() { m_shouldDumpAllFrameScrollPositions = true; }
void dumpEditingCallbacks() { m_dumpEditingCallbacks = true; }
void dumpSelectionRect() { } // Will need to do something when we support pixel tests.
@@ -72,14 +73,15 @@ public:
void setCanOpenWindows(bool);
void setCloseRemainingWindowsWhenComplete(bool value) { m_shouldCloseExtraWindows = value; }
void setXSSAuditorEnabled(bool);
- unsigned windowCount();
// Special DOM functions.
JSValueRef computedStyleIncludingVisitedInfo(JSValueRef element);
JSRetainPtr<JSStringRef> counterValueForElementById(JSStringRef elementId);
- JSRetainPtr<JSStringRef> markerTextForListItem(JSValueRef element);
+ void clearBackForwardList();
void execCommand(JSStringRef name, JSStringRef argument);
bool isCommandEnabled(JSStringRef name);
+ JSRetainPtr<JSStringRef> markerTextForListItem(JSValueRef element);
+ unsigned windowCount();
// Repaint testing.
void testRepaint() { m_testRepaint = true; }
@@ -90,6 +92,9 @@ public:
unsigned numberOfActiveAnimations() const;
bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId);
+ // Compositing testing.
+ JSRetainPtr<JSStringRef> layerTreeAsText() const;
+
// UserContent testing.
void addUserScript(JSStringRef source, bool runAtStart, bool allFrames);
void addUserStyleSheet(JSStringRef source, bool allFrames);
@@ -98,9 +103,9 @@ public:
WhatToDump whatToDump() const { return m_whatToDump; }
bool shouldDumpAllFrameScrollPositions() const { return m_shouldDumpAllFrameScrollPositions; }
+ bool shouldDumpBackForwardListsForAllWindows() const { return m_shouldDumpBackForwardListsForAllWindows; }
bool shouldDumpEditingCallbacks() const { return m_dumpEditingCallbacks; }
bool shouldDumpMainFrameScrollPosition() const { return m_whatToDump == RenderTree; }
-
bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; }
bool shouldDumpTitleChanges() const { return m_dumpTitleChanges; }
@@ -122,6 +127,7 @@ private:
WhatToDump m_whatToDump;
bool m_shouldDumpAllFrameScrollPositions;
+ bool m_shouldDumpBackForwardListsForAllWindows;
bool m_shouldAllowEditing;
bool m_shouldCloseExtraWindows;
diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp
index aff8798..c88062a 100644
--- a/WebKitTools/WebKitTestRunner/TestController.cpp
+++ b/WebKitTools/WebKitTestRunner/TestController.cpp
@@ -98,7 +98,7 @@ static void closeOtherPage(WKPageRef page, const void* clientInfo)
delete view;
}
-static WKPageRef createOtherPage(WKPageRef oldPage, const void*)
+static WKPageRef createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*)
{
PlatformWebView* view = new PlatformWebView(WKPageGetPageNamespace(oldPage));
WKPageRef newPage = view->page();
@@ -116,12 +116,20 @@ static WKPageRef createOtherPage(WKPageRef oldPage, const void*)
0, // runJavaScriptPrompt
0, // setStatusText
0, // mouseDidMoveOverElement
- 0, // contentsSizeChanged
0, // didNotHandleKeyEvent
+ 0, // toolbarsAreVisible
+ 0, // setToolbarsAreVisible
+ 0, // menuBarIsVisible
+ 0, // setMenuBarIsVisible
+ 0, // statusBarIsVisible
+ 0, // setStatusBarIsVisible
+ 0, // isResizable
+ 0, // setIsResizable
getWindowFrameOtherPage,
setWindowFrameOtherPage,
0, // runBeforeUnloadConfirmPanel
- 0 // didDraw
+ 0, // didDraw
+ 0 // pageDidScroll
};
WKPageSetPageUIClient(newPage, &otherPageUIClient);
@@ -181,7 +189,7 @@ void TestController::initialize(int argc, const char* argv[])
0,
this,
didReceiveMessageFromInjectedBundle,
- 0
+ didReceiveSynchronousMessageFromInjectedBundle
};
WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient);
@@ -201,12 +209,20 @@ void TestController::initialize(int argc, const char* argv[])
0, // runJavaScriptPrompt
0, // setStatusText
0, // mouseDidMoveOverElement
- 0, // contentsSizeChanged
0, // didNotHandleKeyEvent
+ 0, // toolbarsAreVisible
+ 0, // setToolbarsAreVisible
+ 0, // menuBarIsVisible
+ 0, // setMenuBarIsVisible
+ 0, // statusBarIsVisible
+ 0, // setStatusBarIsVisible
+ 0, // isResizable
+ 0, // setIsResizable
getWindowFrameMainPage,
setWindowFrameMainPage,
0, // runBeforeUnloadConfirmPanel
- 0 // didDraw
+ 0, // didDraw
+ 0 // pageDidScroll
};
WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
@@ -224,6 +240,8 @@ void TestController::initialize(int argc, const char* argv[])
0, // didFirstLayoutForFrame
0, // didFirstVisuallyNonEmptyLayoutForFrame
0, // didRemoveFrameFromHierarchy
+ 0, // didDisplayInsecureContentForFrame
+ 0, // didRunInsecureContentForFrame
0, // didStartProgress
0, // didChangeProgress
0, // didFinishProgress
@@ -312,11 +330,21 @@ void TestController::didReceiveMessageFromInjectedBundle(WKContextRef context, W
static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveMessageFromInjectedBundle(messageName, messageBody);
}
+void TestController::didReceiveSynchronousMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void* clientInfo)
+{
+ *returnData = static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody).leakRef();
+}
+
void TestController::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody)
{
m_currentInvocation->didReceiveMessageFromInjectedBundle(messageName, messageBody);
}
+WKRetainPtr<WKTypeRef> TestController::didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody)
+{
+ return m_currentInvocation->didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody);
+}
+
// WKPageLoaderClient
void TestController::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef, const void* clientInfo)
diff --git a/WebKitTools/WebKitTestRunner/TestController.h b/WebKitTools/WebKitTestRunner/TestController.h
index a9e6ab3..b12f1b2 100644
--- a/WebKitTools/WebKitTestRunner/TestController.h
+++ b/WebKitTools/WebKitTestRunner/TestController.h
@@ -71,8 +71,10 @@ private:
void resetStateToConsistentValues();
// WKContextInjectedBundleClient
- static void didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void*);
+ static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void*);
+ static void didReceiveSynchronousMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void*);
void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
+ WKRetainPtr<WKTypeRef> didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
// WKPageLoaderClient
static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void*);
diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.cpp b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
index c1bf894..04a56f1 100644
--- a/WebKitTools/WebKitTestRunner/TestInvocation.cpp
+++ b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
@@ -182,4 +182,10 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
ASSERT_NOT_REACHED();
}
+WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedBundle(WKStringRef /*messageName*/, WKTypeRef /*messageBody*/)
+{
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.h b/WebKitTools/WebKitTestRunner/TestInvocation.h
index 1b33e49..fec1f7a 100644
--- a/WebKitTools/WebKitTestRunner/TestInvocation.h
+++ b/WebKitTools/WebKitTestRunner/TestInvocation.h
@@ -38,6 +38,7 @@ public:
void invoke();
void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
+ WKRetainPtr<WKTypeRef> didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
private:
void dump(const char*);
diff --git a/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj b/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
index 599e09e..a15fe41 100644
--- a/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
+++ b/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
@@ -95,7 +95,7 @@
BC14E4E8120E03D800826C0C /* JSGCController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSGCController.cpp; path = DerivedSources/WebKitTestRunner/JSGCController.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
BC14E4E9120E03D800826C0C /* JSGCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSGCController.h; path = DerivedSources/WebKitTestRunner/JSGCController.h; sourceTree = BUILT_PRODUCTS_DIR; };
BC25184611D15767002EBC01 /* InjectedBundleMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMain.cpp; sourceTree = "<group>"; };
- BC25186211D15D54002EBC01 /* InjectedBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InjectedBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+ BC25186211D15D54002EBC01 /* WebKitTestRunnerInjectedBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebKitTestRunnerInjectedBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
BC25186311D15D54002EBC01 /* InjectedBundle-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "InjectedBundle-Info.plist"; sourceTree = "<group>"; };
BC25197111D15E61002EBC01 /* InjectedBundle.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = InjectedBundle.xcconfig; sourceTree = "<group>"; };
BC251A1711D16774002EBC01 /* WebKitTestRunnerPrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitTestRunnerPrefix.h; sourceTree = "<group>"; };
@@ -203,7 +203,7 @@
isa = PBXGroup;
children = (
8DD76FA10486AA7600D96B5E /* WebKitTestRunner */,
- BC25186211D15D54002EBC01 /* InjectedBundle.bundle */,
+ BC25186211D15D54002EBC01 /* WebKitTestRunnerInjectedBundle.bundle */,
);
name = Products;
sourceTree = "<group>";
@@ -343,9 +343,9 @@
productReference = 8DD76FA10486AA7600D96B5E /* WebKitTestRunner */;
productType = "com.apple.product-type.tool";
};
- BC25186111D15D54002EBC01 /* InjectedBundle */ = {
+ BC25186111D15D54002EBC01 /* WebKitTestRunnerInjectedBundle */ = {
isa = PBXNativeTarget;
- buildConfigurationList = BC25186611D15D55002EBC01 /* Build configuration list for PBXNativeTarget "InjectedBundle" */;
+ buildConfigurationList = BC25186611D15D55002EBC01 /* Build configuration list for PBXNativeTarget "WebKitTestRunnerInjectedBundle" */;
buildPhases = (
BC25185E11D15D54002EBC01 /* Resources */,
BC25185F11D15D54002EBC01 /* Sources */,
@@ -356,9 +356,9 @@
dependencies = (
BC952ED711F3C38B003398B4 /* PBXTargetDependency */,
);
- name = InjectedBundle;
+ name = WebKitTestRunnerInjectedBundle;
productName = InjectedBundle;
- productReference = BC25186211D15D54002EBC01 /* InjectedBundle.bundle */;
+ productReference = BC25186211D15D54002EBC01 /* WebKitTestRunnerInjectedBundle.bundle */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
@@ -381,7 +381,7 @@
projectRoot = "";
targets = (
8DD76F960486AA7600D96B5E /* WebKitTestRunner */,
- BC25186111D15D54002EBC01 /* InjectedBundle */,
+ BC25186111D15D54002EBC01 /* WebKitTestRunnerInjectedBundle */,
BC952D7711F3BF5D003398B4 /* Derived Sources */,
);
};
@@ -462,7 +462,7 @@
/* Begin PBXTargetDependency section */
BC25194211D15D94002EBC01 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
- target = BC25186111D15D54002EBC01 /* InjectedBundle */;
+ target = BC25186111D15D54002EBC01 /* WebKitTestRunnerInjectedBundle */;
targetProxy = BC25194111D15D94002EBC01 /* PBXContainerItemProxy */;
};
BC952ED711F3C38B003398B4 /* PBXTargetDependency */ = {
@@ -558,7 +558,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- BC25186611D15D55002EBC01 /* Build configuration list for PBXNativeTarget "InjectedBundle" */ = {
+ BC25186611D15D55002EBC01 /* Build configuration list for PBXNativeTarget "WebKitTestRunnerInjectedBundle" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BC25186411D15D55002EBC01 /* Debug */,
diff --git a/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm b/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
index dbe35e2..be9aa33 100644
--- a/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
+++ b/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
@@ -36,7 +36,7 @@ void TestController::platformInitialize()
void TestController::initializeInjectedBundlePath()
{
- NSString *nsBundlePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"InjectedBundle.bundle"];
+ NSString *nsBundlePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"WebKitTestRunnerInjectedBundle.bundle"];
m_injectedBundlePath.adopt(WKStringCreateWithCFString((CFStringRef)nsBundlePath));
}