Changeset 53526 in webkit
- Timestamp:
- Jan 20, 2010 12:20:59 AM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r53518 r53526 1 2010-01-19 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] Don't use QSocketNotifier in the DRT for reading stdin 6 7 QSocketNotifier is not available on Windows. Instead we read 8 stdin synchronously after each test using signals and slots. 9 10 * DumpRenderTree/qt/DumpRenderTreeQt.cpp: 11 * DumpRenderTree/qt/DumpRenderTreeQt.h: 12 * DumpRenderTree/qt/main.cpp: 13 1 14 2010-01-19 Adam Barth <abarth@webkit.org> 2 15 -
trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
r53281 r53526 311 311 : m_dumpPixels(false) 312 312 , m_stdin(0) 313 , m_notifier(0)314 313 , m_enableTextOutput(false) 314 , m_singleFileMode(false) 315 315 { 316 316 qt_drt_overwritePluginDirectories(); … … 360 360 delete m_mainView; 361 361 delete m_stdin; 362 delete m_notifier;363 }364 365 void DumpRenderTree::open()366 {367 if (!m_stdin) {368 m_stdin = new QFile;369 m_stdin->open(stdin, QFile::ReadOnly);370 }371 372 if (!m_notifier) {373 m_notifier = new QSocketNotifier(STDIN_FILENO, QSocketNotifier::Read);374 connect(m_notifier, SIGNAL(activated(int)), this, SLOT(readStdin(int)));375 }376 362 } 377 363 … … 459 445 } 460 446 461 void DumpRenderTree::readStdin(int /* socket */) 462 { 463 // Read incoming data from stdin... 464 QByteArray line = m_stdin->readLine(); 465 if (line.endsWith('\n')) 466 line.truncate(line.size()-1); 467 //fprintf(stderr, "\n opening %s\n", line.constData()); 468 if (line.isEmpty()) 469 quit(); 470 471 if (line.startsWith("http:") || line.startsWith("https:")) 447 void DumpRenderTree::readLine() 448 { 449 if (!m_stdin) { 450 m_stdin = new QFile; 451 m_stdin->open(stdin, QFile::ReadOnly); 452 453 if (!m_stdin->isReadable()) { 454 emit quit(); 455 return; 456 } 457 } 458 459 QByteArray line = m_stdin->readLine().trimmed(); 460 461 if (line.isEmpty()) { 462 emit quit(); 463 return; 464 } 465 466 processLine(QString::fromLocal8Bit(line.constData(), line.length())); 467 } 468 469 void DumpRenderTree::processLine(const QString &input) 470 { 471 QString line = input; 472 473 if (line.startsWith(QLatin1String("http:")) 474 || line.startsWith(QLatin1String("https:")) 475 || line.startsWith(QLatin1String("file:"))) { 472 476 open(QUrl(line)); 473 else {477 } else { 474 478 QFileInfo fi(line); 479 480 if (!fi.exists()) { 481 QDir currentDir = QDir::currentPath(); 482 483 // Try to be smart about where the test is located 484 if (currentDir.dirName() == QLatin1String("LayoutTests")) 485 fi = QFileInfo(currentDir, line.replace(QRegExp(".*?LayoutTests/(.*)"), "\\1")); 486 else if (!line.contains(QLatin1String("LayoutTests"))) 487 fi = QFileInfo(currentDir, line.prepend(QLatin1String("LayoutTests/"))); 488 489 if (!fi.exists()) { 490 if (isSingleFileMode()) 491 emit quit(); 492 else 493 emit ready(); 494 495 return; 496 } 497 498 } 499 475 500 open(QUrl::fromLocalFile(fi.absoluteFilePath())); 476 501 } … … 618 643 QWebFrame *mainFrame = m_page->mainFrame(); 619 644 620 //fprintf(stderr, " Dumping\n"); 621 if (!m_notifier) { 622 // Dump markup in single file mode... 645 if (isSingleFileMode()) { 623 646 QString markup = mainFrame->toHtml(); 624 647 fprintf(stdout, "Source:\n\n%s\n", markup.toUtf8().constData()); … … 698 721 fflush(stderr); 699 722 700 if (!m_notifier) 701 quit(); // Exit now in single file mode... 723 if (isSingleFileMode()) 724 emit quit(); 725 else 726 emit ready(); 702 727 } 703 728 -
trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
r52611 r53526 69 69 virtual ~DumpRenderTree(); 70 70 71 // Initialize in multi-file mode, used by run-webkit-tests.72 void open();73 74 71 // Initialize in single-file mode. 75 72 void open(const QUrl& url); … … 77 74 void setTextOutputEnabled(bool enable) { m_enableTextOutput = enable; } 78 75 bool isTextOutputEnabled() { return m_enableTextOutput; } 76 77 void setSingleFileMode(bool flag) { m_singleFileMode = flag; } 78 bool isSingleFileMode() { return m_singleFileMode; } 79 79 80 80 void setDumpPixels(bool); … … 101 101 public Q_SLOTS: 102 102 void initJSObjects(); 103 void readStdin(int); 103 104 void readLine(); 105 void processLine(const QString&); 106 104 107 void dump(); 105 108 void titleChanged(const QString &s); … … 110 113 Q_SIGNALS: 111 114 void quit(); 115 void ready(); 112 116 113 117 private: … … 127 131 128 132 QFile *m_stdin; 129 QSocketNotifier* m_notifier;130 133 131 134 QList<QObject*> windows; 132 135 bool m_enableTextOutput; 136 bool m_singleFileMode; 133 137 }; 134 138 -
trunk/WebKitTools/DumpRenderTree/qt/main.cpp
r52150 r53526 41 41 #include <qwebdatabase.h> 42 42 #include <qdesktopservices.h> 43 #include <qtimer.h> 43 44 #include <qwindowsstyle.h> 44 45 … … 134 135 QStringList args = app.arguments(); 135 136 if (args.count() < 2) { 136 qDebug() << "Usage: DumpRenderTree [-v ] filename";137 qDebug() << "Usage: DumpRenderTree [-v|--pixel-tests] filename"; 137 138 exit(0); 138 139 } 139 140 140 // supress debug output from Qt if not started with -v141 // Suppress debug output from Qt if not started with -v 141 142 if (!args.contains(QLatin1String("-v"))) 142 143 qInstallMsgHandler(messageHandler); … … 144 145 WebCore::DumpRenderTree dumper; 145 146 146 if (args.contains( "--pixel-tests"))147 if (args.contains(QLatin1String("--pixel-tests"))) 147 148 dumper.setDumpPixels(true); 148 149 … … 151 152 QWebDatabase::removeAllDatabases(); 152 153 153 if (args.last() == QLatin1String("-")) { 154 dumper.open(); 154 if (args.contains(QLatin1String("-"))) { 155 QObject::connect(&dumper, SIGNAL(ready()), &dumper, SLOT(readLine()), Qt::QueuedConnection); 156 QTimer::singleShot(0, &dumper, SLOT(readLine())); 155 157 } else { 156 if (!args.last().startsWith("/") 157 && !args.last().startsWith("file:") 158 && !args.last().startsWith("http:") 159 && !args.last().startsWith("https:")) { 160 QString path = QDir::currentPath(); 161 if (!path.endsWith('/')) 162 path.append('/'); 163 args.last().prepend(path); 158 dumper.setSingleFileMode(true); 159 for (int i = 1; i < args.size(); ++i) { 160 if (!args.at(i).startsWith('-')) { 161 dumper.processLine(args.at(i)); 162 break; 163 } 164 164 } 165 dumper.open(QUrl(args.last()));166 165 } 166 167 167 return app.exec(); 168 168 169 #ifdef Q_WS_X11 169 170 FcConfigSetCurrent(0);
Note: See TracChangeset
for help on using the changeset viewer.