summaryrefslogtreecommitdiffstats
path: root/WebKitTools/WebKitTestRunner/InjectedBundle
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2010-11-04 12:00:17 -0700
committerJohn Reck <jreck@google.com>2010-11-09 11:35:04 -0800
commite14391e94c850b8bd03680c23b38978db68687a8 (patch)
tree3fed87e6620fecaf3edc7259ae58a11662bedcb2 /WebKitTools/WebKitTestRunner/InjectedBundle
parent1bd705833a68f07850cf7e204b26f8d328d16951 (diff)
downloadexternal_webkit-e14391e94c850b8bd03680c23b38978db68687a8.zip
external_webkit-e14391e94c850b8bd03680c23b38978db68687a8.tar.gz
external_webkit-e14391e94c850b8bd03680c23b38978db68687a8.tar.bz2
Merge Webkit at r70949: Initial merge by git.
Change-Id: I77b8645c083b5d0da8dba73ed01d4014aab9848e
Diffstat (limited to 'WebKitTools/WebKitTestRunner/InjectedBundle')
-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
7 files changed, 224 insertions, 46 deletions
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;