[Qt] Flaky security tests

https://bugs.webkit.org/show_bug.cgi?id=100388

Reviewed by Jocelyn Turcotte.

Tools:

Disable text dumping and load a blank URL to ensure the documentLoader is cleared
before we start dumping text for the new page. Otherwise messages from the old page
may end up in the text output of the new test.

This matches what WebKitTestRunner does, and reuses the Qt code for waiting for flag.

* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::DumpRenderTree::DumpRenderTree):
(WebCore::runUntil):
(WebCore::DumpRenderTree::resetToConsistentStateBeforeTesting):
(WebCore::DumpRenderTree::finishedResetting):
(WebCore::DumpRenderTree::dump):
* DumpRenderTree/qt/DumpRenderTreeQt.h:
(DumpRenderTree):
* DumpRenderTree/qt/TestRunnerQt.cpp:
(TestRunner::resetDumping):
(TestRunner::reset):
* DumpRenderTree/qt/TestRunnerQt.h:
(TestRunner):

LayoutTests:

Unskip no longer flaky tests.

* platform/qt/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132819 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 18f61b34
2012-10-29 Allan Sandfeld Jensen <allan.jensen@digia.com>
[Qt] Flaky security tests
https://bugs.webkit.org/show_bug.cgi?id=100388
Reviewed by Jocelyn Turcotte.
Unskip no longer flaky tests.
* platform/qt/TestExpectations:
2012-10-29 Christophe Dumez <christophe.dumez@intel.com>
[WK2][WKTR] Enable Shadow DOM at runtime if compiled with SHADOW_DOM support
......@@ -2450,11 +2450,6 @@ webkit.org/b/90007 http/tests/security/mixedContent/insecure-audio-video-in-main
# Skip tests in fast/text/shaping
webkit.org/b/90951 fast/text/shaping
# Flaky tests
webkit.org/b/91376 http/tests/security/sandboxed-iframe-modify-self.html [ Failure Pass ]
webkit.org/b/91379 http/tests/security/contentSecurityPolicy/policy-does-not-affect-child.html [ Failure Pass ]
webkit.org/b/91379 http/tests/security/contentSecurityPolicy/object-src-none-allowed.html [ Failure Pass ]
webkit.org/b/99756 fast/events/touch/touch-slider.html [ Failure ]
webkit.org/b/93247 [ Debug ] fast/lists/list-marker-remove-crash.html [ Crash ]
......
2012-10-29 Allan Sandfeld Jensen <allan.jensen@digia.com>
[Qt] Flaky security tests
https://bugs.webkit.org/show_bug.cgi?id=100388
Reviewed by Jocelyn Turcotte.
Disable text dumping and load a blank URL to ensure the documentLoader is cleared
before we start dumping text for the new page. Otherwise messages from the old page
may end up in the text output of the new test.
This matches what WebKitTestRunner does, and reuses the Qt code for waiting for flag.
* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::DumpRenderTree::DumpRenderTree):
(WebCore::runUntil):
(WebCore::DumpRenderTree::resetToConsistentStateBeforeTesting):
(WebCore::DumpRenderTree::finishedResetting):
(WebCore::DumpRenderTree::dump):
* DumpRenderTree/qt/DumpRenderTreeQt.h:
(DumpRenderTree):
* DumpRenderTree/qt/TestRunnerQt.cpp:
(TestRunner::resetDumping):
(TestRunner::reset):
* DumpRenderTree/qt/TestRunnerQt.h:
(TestRunner):
2012-10-29 Christophe Dumez <christophe.dumez@intel.com>
[WK2][WKTR] Enable Shadow DOM at runtime if compiled with SHADOW_DOM support
......
......@@ -46,6 +46,7 @@
#include <QBuffer>
#include <QCryptographicHash>
#include <QDir>
#include <QElapsedTimer>
#include <QFile>
#include <QFileInfo>
#include <QFocusEvent>
......@@ -393,6 +394,7 @@ DumpRenderTree::DumpRenderTree()
, m_enableTextOutput(false)
, m_standAloneMode(false)
, m_graphicsBased(false)
, m_finishedResetting(false)
, m_persistentStoragePath(QString(getenv("DUMPRENDERTREE_TEMP")))
{
QByteArray viewMode = getenv("QT_DRT_WEBVIEW_MODE");
......@@ -508,14 +510,37 @@ void DumpRenderTree::dryRunPrint(QWebFrame* frame)
#endif
}
static void runUntil(bool& condition, double timeout)
{
int timeoutInMSecs = timeout * 1000;
QElapsedTimer timer;
timer.start();
while (!condition) {
if (timer.elapsed() > timeoutInMSecs)
return;
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, timeoutInMSecs - timer.elapsed());
}
}
void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url)
{
// reset so that any current loads are stopped
// NOTE: that this has to be done before the testRunner is
// reset or we get timeouts for some tests.
m_page->blockSignals(true);
m_page->triggerAction(QWebPage::Stop);
m_page->blockSignals(false);
// Disable text-output first, because some tests can performed actions
// causing text dump out when stopped, and we do not want them dumping
// into the next test.
setTextOutputEnabled(false);
m_controller->resetDumping();
// Reset the page so that any current loads are stopped. We set to an
// empty page here instead of issuing a stop action, since setUrl also
// clears the current document.
// NOTE: that this has to be done before the testRunner is reset or we get timeouts for some tests.
m_finishedResetting = false;
connect(m_page, SIGNAL(loadFinished(bool)), this, SLOT(finishedResetting(bool)));
m_page->mainFrame()->setUrl(QUrl("about:blank"));
runUntil(m_finishedResetting, 5);
disconnect(m_page, SIGNAL(loadFinished(bool)), this, SLOT(finishedResetting(bool)));
QList<QWebSecurityOrigin> knownOrigins = QWebSecurityOrigin::allOrigins();
for (int i = 0; i < knownOrigins.size(); ++i)
......@@ -573,6 +598,11 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url)
DumpRenderTreeSupportQt::clearOpener(m_page->mainFrame());
}
void DumpRenderTree::finishedResetting(bool)
{
m_finishedResetting = true;
}
static bool isGlobalHistoryTest(const QUrl& url)
{
if (url.path().contains("globalhistory/"))
......@@ -896,6 +926,8 @@ static const char *methodNameStringForFailedTest(TestRunner *controller)
void DumpRenderTree::dump()
{
if (!isTextOutputEnabled())
return;
// Prevent any further frame load or resource load callbacks from appearing after we dump the result.
DumpRenderTreeSupportQt::dumpFrameLoader(false);
DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(false);
......
......@@ -130,6 +130,7 @@ private Q_SLOTS:
void dryRunPrint(QWebFrame*);
void loadNextTestInStandAloneMode();
void geolocationPermissionSet();
void finishedResetting(bool);
private:
void setStandAloneMode(bool flag) { m_standAloneMode = flag; }
......@@ -158,6 +159,7 @@ private:
bool m_enableTextOutput;
bool m_standAloneMode;
bool m_graphicsBased;
bool m_finishedResetting;
QString m_persistentStoragePath;
QString m_redirectOutputFileName;
QString m_redirectErrorFileName;
......
......@@ -48,21 +48,35 @@ TestRunner::TestRunner(WebCore::DumpRenderTree* drt)
DumpRenderTreeSupportQt::dumpNotification(true);
}
void TestRunner::reset()
void TestRunner::resetDumping()
{
m_hasDumped = false;
m_loadFinished = false;
m_textDump = false;
m_dumpBackForwardList = false;
m_dumpChildrenAsText = false;
m_dumpChildFrameScrollPositions = false;
m_canOpenWindows = false;
m_waitForDone = false;
m_disallowIncreaseForApplicationCacheQuota = false;
m_dumpTitleChanges = false;
m_dumpDatabaseCallbacks = false;
m_dumpApplicationCacheDelegateCallbacks = false;
m_dumpStatusCallbacks = false;
DumpRenderTreeSupportQt::dumpEditingCallbacks(false);
DumpRenderTreeSupportQt::dumpFrameLoader(false);
DumpRenderTreeSupportQt::dumpProgressFinishedCallback(false);
DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(false);
DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(false);
DumpRenderTreeSupportQt::dumpResourceResponseMIMETypes(false);
DumpRenderTreeSupportQt::dumpWillCacheResponseCallbacks(false);
DumpRenderTreeSupportQt::dumpHistoryCallbacks(false);
DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(false);
DumpRenderTreeSupportQt::setCustomPolicyDelegate(false, false);
}
void TestRunner::reset()
{
m_hasDumped = false;
m_loadFinished = false;
m_textDump = false;
m_canOpenWindows = false;
m_waitForDone = false;
m_disallowIncreaseForApplicationCacheQuota = false;
m_timeoutTimer.stop();
m_topLoadingFrame = 0;
m_waitForPolicy = false;
......@@ -76,21 +90,11 @@ void TestRunner::reset()
m_isPrinting = false;
m_geolocationPermission = false;
DumpRenderTreeSupportQt::dumpEditingCallbacks(false);
DumpRenderTreeSupportQt::dumpFrameLoader(false);
DumpRenderTreeSupportQt::dumpProgressFinishedCallback(false);
DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(false);
DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(false);
DumpRenderTreeSupportQt::dumpResourceResponseMIMETypes(false);
DumpRenderTreeSupportQt::dumpWillCacheResponseCallbacks(false);
DumpRenderTreeSupportQt::setDeferMainResourceDataLoad(true);
DumpRenderTreeSupportQt::setWillSendRequestReturnsNullOnRedirect(false);
DumpRenderTreeSupportQt::setWillSendRequestReturnsNull(false);
DumpRenderTreeSupportQt::setWillSendRequestClearHeaders(QStringList());
DumpRenderTreeSupportQt::clearScriptWorlds();
DumpRenderTreeSupportQt::setCustomPolicyDelegate(false, false);
DumpRenderTreeSupportQt::dumpHistoryCallbacks(false);
DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(false);
DumpRenderTreeSupportQt::resetGeolocationMock(m_drt->webPage());
setIconDatabaseEnabled(false);
clearAllDatabases();
......
......@@ -78,6 +78,7 @@ public:
bool isPrinting() { return m_isPrinting; }
void reset();
void resetDumping();
static const unsigned int maxViewWidth;
static const unsigned int maxViewHeight;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment