Title: [94676] trunk/Tools
Revision
94676
Author
[email protected]
Date
2011-09-07 10:04:22 -0700 (Wed, 07 Sep 2011)

Log Message

[Qt][DRT] Normalize file:///tmp/LayoutTests in LayoutTestController::pathToLocalResource()
https://bugs.webkit.org/show_bug.cgi?id=67254

Patch by Jarred Nicholls <[email protected]> on 2011-09-07
Reviewed by Csaba Osztrogonác.

Translate file:///tmp/LayoutTests/* urls into the repository LayoutTests directory, which is
derived from the running location of DumpRenderTree binary.

* DumpRenderTree/qt/LayoutTestControllerQt.cpp:
(LayoutTestController::pathToLocalResource):
(LayoutTestController::setUserStyleSheetLocation): pass the url through pathToLocalResource

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (94675 => 94676)


--- trunk/Tools/ChangeLog	2011-09-07 16:43:19 UTC (rev 94675)
+++ trunk/Tools/ChangeLog	2011-09-07 17:04:22 UTC (rev 94676)
@@ -1,3 +1,17 @@
+2011-09-07  Jarred Nicholls  <[email protected]>
+
+        [Qt][DRT] Normalize file:///tmp/LayoutTests in LayoutTestController::pathToLocalResource()
+        https://bugs.webkit.org/show_bug.cgi?id=67254
+
+        Reviewed by Csaba Osztrogonác.
+
+        Translate file:///tmp/LayoutTests/* urls into the repository LayoutTests directory, which is
+        derived from the running location of DumpRenderTree binary.
+
+        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+        (LayoutTestController::pathToLocalResource):
+        (LayoutTestController::setUserStyleSheetLocation): pass the url through pathToLocalResource
+
 2011-09-07  Csaba Osztrogonác  <[email protected]>
 
         REGRESSION(r94288) build-webkit doesn't work on Symbian

Modified: trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp (94675 => 94676)


--- trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp	2011-09-07 16:43:19 UTC (rev 94675)
+++ trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp	2011-09-07 17:04:22 UTC (rev 94676)
@@ -33,6 +33,7 @@
 #include "DumpRenderTreeQt.h"
 #include "WorkQueue.h"
 #include "WorkQueueItemQt.h"
+#include <QCoreApplication>
 #include <QDir>
 #include <QLocale>
 #include <qwebsettings.h>
@@ -241,8 +242,19 @@
 
 QString LayoutTestController::pathToLocalResource(const QString& url)
 {
-    // Function introduced in r28690.
-    return QDir::toNativeSeparators(url);
+    QString localTmpUrl(QLatin1String("file:///tmp/LayoutTests"));
+
+    // Translate a request for /tmp/LayoutTests to the repository LayoutTests directory.
+    // Do not rely on a symlink to be created via the test runner, which will not work on Windows.
+    if (url.startsWith(localTmpUrl)) {
+        // DumpRenderTree lives in WebKit/WebKitBuild/<build_mode>/bin.
+        // Translate from WebKit/WebKitBuild/Release/bin => WebKit/LayoutTests.
+        QFileInfo layoutTestsRoot(QCoreApplication::applicationDirPath() + QLatin1String("/../../../LayoutTests/"));
+        if (layoutTestsRoot.exists())
+            return QLatin1String("file://") + layoutTestsRoot.absolutePath() + url.mid(localTmpUrl.length());
+    }
+
+    return url;
 }
 
 void LayoutTestController::dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight)
@@ -687,7 +699,8 @@
 
 void LayoutTestController::setUserStyleSheetLocation(const QString& url)
 {
-    m_userStyleSheetLocation = QUrl::fromEncoded(url.toAscii(), QUrl::StrictMode);
+    QByteArray urlData = pathToLocalResource(url).toLatin1();
+    m_userStyleSheetLocation = QUrl::fromEncoded(urlData, QUrl::StrictMode);
 
     if (m_userStyleSheetEnabled)
         setUserStyleSheetEnabled(true);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to