Exemple #1
0
void DumpRenderTree::runTest(const String& url, const String& imageHash)
{
    mainFrame->loader()->stopForUserCancel();
    resetToConsistentStateBeforeTesting(url, imageHash);
    if (shouldLogFrameLoadDelegates(url))
        gTestRunner->setDumpFrameLoadCallbacks(true);
    if (!runFromCommandLine) {
        createFile(m_resultsDir + *m_currentTest + ".dump.crash");

        String stdoutFile = m_resultsDir + *m_currentTest + ".dump";
        String stderrFile = m_resultsDir + *m_currentTest + ".stderr";

        // FIXME: we should preserve the original stdout and stderr here but aren't doing
        // that yet due to issues with dup, etc.
        freopen(stdoutFile.utf8().data(), "wb", stdout);
        freopen(stderrFile.utf8().data(), "wb", stderr);
    }
    FILE* current = fopen(m_currentTestFile.utf8().data(), "w");
    if (current) {
        fwrite(m_currentTest->utf8().data(), 1, m_currentTest->utf8().length(), current);
        fclose(current);
    }
    BlackBerry::Platform::NetworkRequest request;
    STATIC_LOCAL_STRING(s_get, "GET");
    request.setRequestUrl(url, s_get);
    m_page->load(request);
}
Exemple #2
0
void DumpRenderTree::open(const QUrl& url)
{
    DumpRenderTreeSupportQt::dumpResourceLoadCallbacksPath(QFileInfo(url.toString()).path());
    resetToConsistentStateBeforeTesting(url);

    if (isWebInspectorTest(m_page->mainFrame()->url()))
        layoutTestController()->closeWebInspector();

    if (isWebInspectorTest(url))
        layoutTestController()->showWebInspector();

    if (isDumpAsTextTest(url)) {
        layoutTestController()->dumpAsText();
        setDumpPixels(false);
    }

    if (isGlobalHistoryTest(url))
        layoutTestController()->dumpHistoryCallbacks();

    // W3C SVG tests expect to be 480x360
    bool isW3CTest = url.toString().contains("svg/W3C-SVG-1.1");
    int width = isW3CTest ? 480 : LayoutTestController::maxViewWidth;
    int height = isW3CTest ? 360 : LayoutTestController::maxViewHeight;
    m_mainView->resize(QSize(width, height));
    m_page->setPreferredContentsSize(QSize());
    m_page->setViewportSize(QSize(width, height));

    QFocusEvent ev(QEvent::FocusIn);
    m_page->event(&ev);

    QWebSettings::clearMemoryCaches();
#if !(QT_VERSION <= QT_VERSION_CHECK(4, 6, 2))
    QFontDatabase::removeAllApplicationFonts();
#endif
    WebKit::initializeTestFonts();

    DumpRenderTreeSupportQt::dumpFrameLoader(url.toString().contains("loading/"));
    setTextOutputEnabled(true);
    m_page->mainFrame()->load(url);
}