summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp')
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp63
1 files changed, 56 insertions, 7 deletions
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index b8de6a5..0ea5632 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -32,13 +32,16 @@
#include "DumpRenderTree.h"
#include "WorkQueue.h"
#include "WorkQueueItem.h"
+#include <QDir>
extern void qt_dump_editing_callbacks(bool b);
extern void qt_dump_resource_load_callbacks(bool b);
extern void qt_drt_setJavaScriptProfilingEnabled(QWebFrame*, bool enabled);
extern bool qt_drt_pauseAnimation(QWebFrame*, const QString& name, double time, const QString& elementId);
extern bool qt_drt_pauseTransitionOfProperty(QWebFrame*, const QString& name, double time, const QString& elementId);
+extern bool qt_drt_pauseSVGAnimation(QWebFrame*, const QString& animationId, double time, const QString& elementId);
extern int qt_drt_numberOfActiveAnimations(QWebFrame*);
+
extern void qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains);
extern QString qt_drt_counterValueForElementById(QWebFrame* qFrame, const QString& id);
@@ -63,6 +66,7 @@ void LayoutTestController::reset()
m_timeoutTimer.stop();
m_topLoadingFrame = 0;
m_waitForPolicy = false;
+ m_handleErrorPages = false;
qt_dump_editing_callbacks(false);
qt_dump_resource_load_callbacks(false);
}
@@ -72,7 +76,7 @@ void LayoutTestController::processWork()
// qDebug() << ">>>processWork";
// if we didn't start a new load, then we finished all the commands, so we're ready to dump state
- if (!WorkQueue::shared()->processWork() && !shouldWaitUntilDone()) {
+ if (WorkQueue::shared()->processWork() && !shouldWaitUntilDone()) {
emit done();
m_isLoading = false;
}
@@ -81,7 +85,7 @@ void LayoutTestController::processWork()
// Called on loadFinished on mainFrame.
void LayoutTestController::maybeDump(bool success)
{
- Q_ASSERT(sender() == m_topLoadingFrame);
+ Q_ASSERT(sender() == m_topLoadingFrame->page());
// as the function is called on loadFinished, the test might
// already have dumped and thus no longer be active, thus
@@ -107,7 +111,7 @@ void LayoutTestController::waitUntilDone()
{
//qDebug() << ">>>>waitForDone";
m_waitForDone = true;
- m_timeoutTimer.start(11000, this);
+ m_timeoutTimer.start(15000, this);
}
QString LayoutTestController::counterValueForElementById(const QString& id)
@@ -123,10 +127,14 @@ void LayoutTestController::keepWebHistory()
void LayoutTestController::notifyDone()
{
qDebug() << ">>>>notifyDone";
+
if (!m_timeoutTimer.isActive())
return;
+
m_timeoutTimer.stop();
emit done();
+
+ // FIXME: investigate why always resetting these result in timeouts
m_isLoading = false;
m_waitForDone = false;
m_waitForPolicy = false;
@@ -142,6 +150,12 @@ void LayoutTestController::clearBackForwardList()
m_drt->webPage()->history()->clear();
}
+QString LayoutTestController::pathToLocalResource(const QString& url)
+{
+ // Function introduced in r28690.
+ return QLatin1String("file://") + QUrl(url).toLocalFile();
+}
+
void LayoutTestController::dumpEditingCallbacks()
{
qDebug() << ">>>dumpEditingCallbacks";
@@ -179,10 +193,16 @@ void LayoutTestController::queueReload()
WorkQueue::shared()->queue(new ReloadItem(m_drt->webPage()));
}
-void LayoutTestController::queueScript(const QString &url)
+void LayoutTestController::queueLoadingScript(const QString& script)
+{
+ //qDebug() << ">>>queueLoadingScript" << script;
+ WorkQueue::shared()->queue(new LoadingScriptItem(script, m_drt->webPage()));
+}
+
+void LayoutTestController::queueNonLoadingScript(const QString& script)
{
- //qDebug() << ">>>queueScript" << url;
- WorkQueue::shared()->queue(new ScriptItem(url, m_drt->webPage()));
+ //qDebug() << ">>>queueNonLoadingScript" << script;
+ WorkQueue::shared()->queue(new NonLoadingScriptItem(script, m_drt->webPage()));
}
void LayoutTestController::provisionalLoad()
@@ -195,7 +215,9 @@ void LayoutTestController::provisionalLoad()
void LayoutTestController::timerEvent(QTimerEvent *ev)
{
if (ev->timerId() == m_timeoutTimer.timerId()) {
- //qDebug() << ">>>>>>>>>>>>> timeout";
+ const char* message = "FAIL: Timed out waiting for notifyDone to be called\n";
+ fprintf(stderr, "%s", message);
+ fprintf(stdout, "%s", message);
notifyDone();
} else
QObject::timerEvent(ev);
@@ -215,6 +237,22 @@ QString LayoutTestController::decodeHostName(const QString& host)
return decoded;
}
+void LayoutTestController::showWebInspector()
+{
+ m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
+ m_drt->webPage()->webInspector()->show();
+}
+
+void LayoutTestController::hideWebInspector()
+{
+ m_drt->webPage()->webInspector()->hide();
+}
+
+void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
+{
+ m_drt->webPage()->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, enabled);
+}
+
void LayoutTestController::setJavaScriptProfilingEnabled(bool enable)
{
m_topLoadingFrame->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
@@ -260,6 +298,15 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(const QString& p
return qt_drt_pauseTransitionOfProperty(frame, propertyName, time, elementId);
}
+bool LayoutTestController::sampleSVGAnimationForElementAtTime(const QString& animationId,
+ double time,
+ const QString& elementId)
+{
+ QWebFrame* frame = m_drt->webPage()->mainFrame();
+ Q_ASSERT(frame);
+ return qt_drt_pauseSVGAnimation(frame, animationId, time, elementId);
+}
+
unsigned LayoutTestController::numberOfActiveAnimations() const
{
QWebFrame* frame = m_drt->webPage()->mainFrame();
@@ -313,4 +360,6 @@ void LayoutTestController::overridePreference(const QString& name, const QVarian
settings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, value.toBool());
else if (name == "WebKitDefaultFontSize")
settings->setFontSize(QWebSettings::DefaultFontSize, value.toInt());
+ else if (name == "WebKitUsesPageCachePreferenceKey")
+ QWebSettings::setMaximumPagesInCache(value.toInt());
}