summaryrefslogtreecommitdiffstats
path: root/Tools/WebKitTestRunner/InjectedBundle
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/WebKitTestRunner/InjectedBundle')
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/JSWrapper.cpp1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/GCController.cpp1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp14
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h8
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp2
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp30
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp6
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp14
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/win/InjectedBundleWin.cpp1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/win/LayoutTestControllerWin.cpp1
15 files changed, 59 insertions, 24 deletions
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/JSWrapper.cpp b/Tools/WebKitTestRunner/InjectedBundle/Bindings/JSWrapper.cpp
index a62cb2e..e3cf58c 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/JSWrapper.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/JSWrapper.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "JSWrapper.h"
#include <JavaScriptCore/JSContextRefPrivate.h>
diff --git a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
index 73de45b..cc1720e 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "EventSendingController.h"
#include "InjectedBundle.h"
diff --git a/Tools/WebKitTestRunner/InjectedBundle/GCController.cpp b/Tools/WebKitTestRunner/InjectedBundle/GCController.cpp
index 0eba2df..10c21db 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/GCController.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/GCController.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "GCController.h"
#include "InjectedBundle.h"
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
index 00933bd..ec6b723 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundle.h"
#include "ActivateFonts.h"
@@ -49,6 +50,7 @@ InjectedBundle::InjectedBundle()
: m_bundle(0)
, m_topLoadingFrame(0)
, m_state(Idle)
+ , m_dumpPixels(false)
{
}
@@ -128,7 +130,9 @@ void InjectedBundle::resetLocalSettings()
void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
{
if (WKStringIsEqualToUTF8CString(messageName, "BeginTest")) {
- ASSERT(!messageBody);
+ ASSERT(messageBody);
+ ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+ m_dumpPixels = WKBooleanGetValue(static_cast<WKBooleanRef>(messageBody));
WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithUTF8CString("Ack"));
WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithUTF8CString("BeginTest"));
@@ -138,6 +142,7 @@ void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messag
return;
} else if (WKStringIsEqualToUTF8CString(messageName, "Reset")) {
m_state = Idle;
+ m_dumpPixels = false;
resetLocalSettings();
@@ -154,6 +159,7 @@ void InjectedBundle::beginTesting()
m_state = Testing;
m_outputStream.str("");
+ m_pixelResult.clear();
m_layoutTestController = LayoutTestController::create();
m_gcController = GCController::create();
@@ -161,6 +167,7 @@ void InjectedBundle::beginTesting()
WKBundleSetShouldTrackVisitedLinks(m_bundle, false);
WKBundleRemoveAllVisitedLinks(m_bundle);
+ WKBundleOverrideAllowUniversalAccessFromFileURLsForTestRunner(m_bundle, m_pageGroup, true);
WKBundleRemoveAllUserContent(m_bundle, m_pageGroup);
@@ -181,9 +188,8 @@ void InjectedBundle::done()
WKRetainPtr<WKStringRef> textOutput(AdoptWK, WKStringCreateWithUTF8CString(m_outputStream.str().c_str()));
WKDictionaryAddItem(doneMessageBody.get(), textOutputKey.get(), textOutput.get());
- WKRetainPtr<WKStringRef> textOnlyKey(AdoptWK, WKStringCreateWithUTF8CString("TextOnly"));
- WKRetainPtr<WKBooleanRef> textOnly(AdoptWK, WKBooleanCreate(!m_layoutTestController->shouldDumpPixels()));
- WKDictionaryAddItem(doneMessageBody.get(), textOnlyKey.get(), textOnly.get());
+ WKRetainPtr<WKStringRef> pixelResultKey = adoptWK(WKStringCreateWithUTF8CString("PixelResult"));
+ WKDictionaryAddItem(doneMessageBody.get(), pixelResultKey.get(), m_pixelResult.get());
WKBundlePostMessage(m_bundle, doneMessageName.get(), doneMessageBody.get());
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
index 41b1b31..3090614 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
@@ -30,6 +30,7 @@
#include "GCController.h"
#include "LayoutTestController.h"
#include <WebKit2/WKBase.h>
+#include <WebKit2/WKRetainPtr.h>
#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
@@ -62,12 +63,15 @@ public:
void done();
std::ostringstream& os() { return m_outputStream; }
+ void setPixelResult(WKImageRef image) { m_pixelResult = image; }
bool isTestRunning() { return m_state == Testing; }
WKBundleFrameRef topLoadingFrame() { return m_topLoadingFrame; }
void setTopLoadingFrame(WKBundleFrameRef frame) { m_topLoadingFrame = frame; }
+ bool shouldDumpPixels() const { return m_dumpPixels; }
+
private:
InjectedBundle();
~InjectedBundle();
@@ -105,6 +109,10 @@ private:
Stopping
};
State m_state;
+
+ bool m_dumpPixels;
+
+ WKRetainPtr<WKImageRef> m_pixelResult;
};
} // namespace WTR
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp
index 4e7f58b..7244077 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp
@@ -23,6 +23,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+
#include "InjectedBundle.h"
#include <WebKit2/WKBundleInitialize.h>
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 3ce081e..3b73174 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -23,13 +23,13 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundlePage.h"
#include "InjectedBundle.h"
#include "StringFunctions.h"
#include <cmath>
#include <JavaScriptCore/JSRetainPtr.h>
-#include <WebCore/KURL.h>
#include <WebKit2/WKArray.h>
#include <WebKit2/WKBundle.h>
#include <WebKit2/WKBundleBackForwardList.h>
@@ -43,11 +43,6 @@ 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;
@@ -218,6 +213,8 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
0, /*mouseDidMoveOverElement*/
0, /*pageDidScroll*/
0, /*paintCustomOverhangArea*/
+ 0, /*shouldGenerateFileForUpload*/
+ 0, /*generateFileForUpload*/
};
WKBundlePageSetUIClient(m_page, &uiClient);
@@ -526,6 +523,9 @@ void InjectedBundlePage::dump()
if (InjectedBundle::shared().layoutTestController()->shouldDumpBackForwardListsForAllWindows())
InjectedBundle::shared().dumpBackForwardListsForAllPages();
+ if (InjectedBundle::shared().shouldDumpPixels() && InjectedBundle::shared().layoutTestController()->shouldDumpPixels())
+ InjectedBundle::shared().setPixelResult(adoptWK(WKBundlePageCreateSnapshotInViewCoordinates(m_page, WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page)), kWKImageOptionsShareable)).get());
+
InjectedBundle::shared().done();
}
@@ -634,15 +634,15 @@ WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef, WKB
if (InjectedBundle::shared().isTestRunning() && InjectedBundle::shared().layoutTestController()->willSendRequestReturnsNull())
return 0;
- string urlString = toSTD(adoptWK(WKURLCopyString(adoptWK(WKURLRequestCopyURL(request)).get())));
- WebCore::KURL url(WebCore::ParsedURLString, urlString.c_str());
-
- if (!url.host().isEmpty()
- && (equalIgnoringCase(url.protocol(), "http") || (equalIgnoringCase(url.protocol(), "https")))
- && (url.host() != "127.0.0.1")
- && (url.host() != "255.255.255.255") // used in some tests that expect to get back an error
- && (!equalIgnoringCase(url.host(), "localhost"))) {
- InjectedBundle::shared().os() << "Blocked access to external URL " << urlString << "\n";
+ WKRetainPtr<WKURLRef> url = adoptWK(WKURLRequestCopyURL(request));
+ WKRetainPtr<WKStringRef> host = adoptWK(WKURLCopyHostName(url.get()));
+ WKRetainPtr<WKStringRef> scheme = adoptWK(WKURLCopyScheme(url.get()));
+ if (host && !WKStringIsEmpty(host.get())
+ && (WKStringIsEqualToUTF8CStringIgnoringCase(scheme.get(), "http") || WKStringIsEqualToUTF8CStringIgnoringCase(scheme.get(), "https"))
+ && !WKStringIsEqualToUTF8CString(host.get(), "127.0.0.1")
+ && !WKStringIsEqualToUTF8CString(host.get(), "255.255.255.255") // Used in some tests that expect to get back an error.
+ && !WKStringIsEqualToUTF8CStringIgnoringCase(host.get(), "localhost")) {
+ InjectedBundle::shared().os() << "Blocked access to external URL " << url << "\n";
return 0;
}
diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index 96a0d47..7c49d03 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "LayoutTestController.h"
#include "InjectedBundle.h"
@@ -301,6 +302,11 @@ void LayoutTestController::setXSSAuditorEnabled(bool enabled)
WKBundleOverrideXSSAuditorEnabledForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), true);
}
+void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
+{
+ WKBundleOverrideAllowUniversalAccessFromFileURLsForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
+}
+
unsigned LayoutTestController::windowCount()
{
return InjectedBundle::shared().pageCount();
diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
index 6733380..b37f102 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
@@ -74,6 +74,7 @@ public:
void setCanOpenWindows(bool);
void setCloseRemainingWindowsWhenComplete(bool value) { m_shouldCloseExtraWindows = value; }
void setXSSAuditorEnabled(bool);
+ void setAllowUniversalAccessFromFileURLs(bool);
// Special DOM functions.
JSValueRef computedStyleIncludingVisitedInfo(JSValueRef element);
diff --git a/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp b/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp
index 9c4bc68..cb6b633 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp
@@ -27,6 +27,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ActivateFonts.h"
#include <QApplication>
@@ -56,8 +57,9 @@ void activateFonts()
if (appFontSet && numFonts >= 0 && appFontSet->nfont == numFonts)
return;
- QByteArray fontDir = getenv("WEBKIT_TESTFONTS");
- if (fontDir.isEmpty() || !QDir(fontDir).exists()) {
+ char* const fontDir = getenv("WEBKIT_TESTFONTS");
+ const QString fontDirString = QString::fromLocal8Bit(fontDir);
+ if (fontDirString.isEmpty() || !QDir(fontDirString).exists()) {
fprintf(stderr,
"\n\n"
"----------------------------------------------------------------------\n"
@@ -76,7 +78,7 @@ void activateFonts()
configFile += "/Tools/DumpRenderTree/qt/fonts.conf";
if (!FcConfigParseAndLoad (config, (FcChar8*) configFile.data(), true))
qFatal("Couldn't load font configuration file");
- if (!FcConfigAppFontAddDir (config, (FcChar8*) fontDir.data()))
+ if (!FcConfigAppFontAddDir (config, (FcChar8*) fontDir))
qFatal("Couldn't add font dir!");
FcConfigSetCurrent(config);
@@ -84,17 +86,19 @@ void activateFonts()
numFonts = appFontSet->nfont;
#endif
- QApplication::setGraphicsSystem("raster");
+ QApplication::setGraphicsSystem(QLatin1String("raster"));
QApplication::setStyle(new QWindowsStyle);
- QFont f("Sans Serif");
+ QFont f(QLatin1String("Sans Serif"));
f.setPointSize(9);
f.setWeight(QFont::Normal);
f.setStyle(QFont::StyleNormal);
QApplication::setFont(f);
+#if defined(Q_WS_X11)
QX11Info::setAppDpiX(0, 96);
QX11Info::setAppDpiY(0, 96);
+#endif
}
}
diff --git a/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp b/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp
index 52502ed..78ec37c 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundle.h"
namespace WTR {
diff --git a/Tools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp b/Tools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp
index b515326..91f49ea 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/qt/LayoutTestControllerQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "LayoutTestController.h"
#include "InjectedBundle.h"
diff --git a/Tools/WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp b/Tools/WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp
index d9f08c9..410d60f 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ActivateFonts.h"
#include <string>
diff --git a/Tools/WebKitTestRunner/InjectedBundle/win/InjectedBundleWin.cpp b/Tools/WebKitTestRunner/InjectedBundle/win/InjectedBundleWin.cpp
index af8eaed..c70514a 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/win/InjectedBundleWin.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/win/InjectedBundleWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundle.h"
namespace WTR {
diff --git a/Tools/WebKitTestRunner/InjectedBundle/win/LayoutTestControllerWin.cpp b/Tools/WebKitTestRunner/InjectedBundle/win/LayoutTestControllerWin.cpp
index 39cd727..7c500f2 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/win/LayoutTestControllerWin.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/win/LayoutTestControllerWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "LayoutTestController.h"
#include "InjectedBundle.h"