コード例 #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);
}
コード例 #2
0
SocketStreamHandle::SocketStreamHandle(const String& groupName, const KURL& url, SocketStreamHandleClient* client)
    : SocketStreamHandleBase(url, client)
{
    LOG(Network, "SocketStreamHandle %p new client %p", this, m_client);

    // Find a playerId to pass to the platform client. It can be from any page
    // in the PageGroup, since they all share the same network profile and
    // resources.
    PageGroup* pageGroup = PageGroup::pageGroup(groupName);
    ASSERT(pageGroup && !pageGroup->pages().isEmpty());
    Page* page = *(pageGroup->pages().begin());
    ASSERT(page && page->mainFrame());
    int playerId = static_cast<FrameLoaderClientBlackBerry*>(page->mainFrame()->loader()->client())->playerId();

    // Create a platform socket stream
    BlackBerry::Platform::NetworkStreamFactory* factory = page->chrome()->platformPageClient()->networkStreamFactory();
    ASSERT(factory);
    m_socketStream = adoptPtr(factory->createSocketStream(playerId));
    ASSERT(m_socketStream);
    m_socketStream->setListener(this);

    // Open the socket
    BlackBerry::Platform::NetworkRequest request;
    request.setRequestUrl(url.string().latin1().data(), "CONNECT");

    m_socketStream->setRequest(request);

    m_socketStream->streamOpen();
}