void DumpRenderTree::processLine(const QString &input) { TestCommand command = parseInputLine(std::string(input.toLatin1().constData())); QString pathOrURL = QLatin1String(command.pathOrURL.c_str()); m_dumpPixelsForCurrentTest = command.shouldDumpPixels; m_expectedHash = QLatin1String(command.expectedPixelHash.c_str()); if (pathOrURL.startsWith(QLatin1String("http:")) || pathOrURL.startsWith(QLatin1String("https:")) || pathOrURL.startsWith(QLatin1String("file:")) || pathOrURL == QLatin1String("about:blank")) { open(QUrl(pathOrURL)); } else { QFileInfo fi(pathOrURL); if (!fi.exists()) { QDir currentDir = QDir::currentPath(); // Try to be smart about where the test is located if (currentDir.dirName() == QLatin1String("LayoutTests")) fi = QFileInfo(currentDir, pathOrURL.replace(QRegExp(".*?LayoutTests/(.*)"), "\\1")); else if (!pathOrURL.contains(QLatin1String("LayoutTests"))) fi = QFileInfo(currentDir, pathOrURL.prepend(QLatin1String("LayoutTests/"))); if (!fi.exists()) { emit ready(); return; } } open(QUrl::fromLocalFile(fi.absoluteFilePath())); } fflush(stdout); }
bool TestController::runTest(const char* inputLine) { TestCommand command = parseInputLine(std::string(inputLine)); m_state = RunningTest; m_currentInvocation = adoptPtr(new TestInvocation(command.pathOrURL)); if (command.shouldDumpPixels || m_shouldDumpPixelsForAllTests) m_currentInvocation->setIsPixelTest(command.expectedPixelHash); m_currentInvocation->invoke(); m_currentInvocation.clear(); return true; }