Title: [95180] trunk/Tools
Revision
95180
Author
joc...@chromium.org
Date
2011-09-15 02:10:00 -0700 (Thu, 15 Sep 2011)

Log Message

[chromium] extract normalization of LayoutTests URLs to a method of TestShell
https://bugs.webkit.org/show_bug.cgi?id=68145

This will allow for other classes in DumpRenderTree to reuse this functionality

Reviewed by David Levin.

* DumpRenderTree/chromium/TestShell.cpp:
(normalizeLayoutTestURLInternal):
(dumpHistoryItem):
(TestShell::normalizeLayoutTestURL):
* DumpRenderTree/chromium/TestShell.h:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (95179 => 95180)


--- trunk/Tools/ChangeLog	2011-09-15 08:37:49 UTC (rev 95179)
+++ trunk/Tools/ChangeLog	2011-09-15 09:10:00 UTC (rev 95180)
@@ -1,3 +1,18 @@
+2011-09-15  Jochen Eisinger  <joc...@chromium.org>
+
+        [chromium] extract normalization of LayoutTests URLs to a method of TestShell
+        https://bugs.webkit.org/show_bug.cgi?id=68145
+
+        This will allow for other classes in DumpRenderTree to reuse this functionality
+
+        Reviewed by David Levin.
+
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (normalizeLayoutTestURLInternal):
+        (dumpHistoryItem):
+        (TestShell::normalizeLayoutTestURL):
+        * DumpRenderTree/chromium/TestShell.h:
+
 2011-09-14  Ada Chan  <adac...@apple.com>
 
         Add test for WKBundleFrameCopyWebArchive().

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.cpp (95179 => 95180)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2011-09-15 08:37:49 UTC (rev 95179)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2011-09-15 09:10:00 UTC (rev 95180)
@@ -396,6 +396,21 @@
     return target1 < target2;
 }
 
+static string normalizeLayoutTestURLInternal(const string& url)
+{
+    string result = url;
+    size_t pos;
+    if (!url.find(fileUrlPattern) && ((pos = url.find(layoutTestsPattern)) != string::npos)) {
+        // adjust file URLs to match upstream results.
+        result.replace(0, pos + layoutTestsPatternSize, fileTestPrefix);
+    } else if (!url.find(dataUrlPattern)) {
+        // URL-escape data URLs to match results upstream.
+        string path = webkit_support::EscapePath(url.substr(dataUrlPatternSize));
+        result.replace(dataUrlPatternSize, url.length(), path);
+    }
+    return result;
+}
+
 static string dumpHistoryItem(const WebHistoryItem& item, int indent, bool isCurrent)
 {
     string result;
@@ -406,17 +421,7 @@
     } else
         result.append(indent, ' ');
 
-    string url = ""
-    size_t pos;
-    if (!url.find(fileUrlPattern) && ((pos = url.find(layoutTestsPattern)) != string::npos)) {
-        // adjust file URLs to match upstream results.
-        url.replace(0, pos + layoutTestsPatternSize, fileTestPrefix);
-    } else if (!url.find(dataUrlPattern)) {
-        // URL-escape data URLs to match results upstream.
-        string path = webkit_support::EscapePath(url.substr(dataUrlPatternSize));
-        url.replace(dataUrlPatternSize, url.length(), path);
-    }
-
+    string url = ""
     result.append(url);
     if (!item.target().isEmpty()) {
         result.append(" (in frame \"");
@@ -689,3 +694,8 @@
 {
     return m_windowList.size();
 }
+
+string TestShell::normalizeLayoutTestURL(const string& url)
+{
+    return normalizeLayoutTestURLInternal(url);
+}

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.h (95179 => 95180)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.h	2011-09-15 08:37:49 UTC (rev 95179)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.h	2011-09-15 09:10:00 UTC (rev 95180)
@@ -176,6 +176,10 @@
     typedef Vector<WebViewHost*> WindowList;
     WindowList windowList() const { return m_windowList; }
 
+    // Returns a string representation of an URL's spec that does not depend on
+    // the location of the layout test in the file system.
+    std::string normalizeLayoutTestURL(const std::string&);
+
 private:
     WebViewHost* createNewWindow(const WebKit::WebURL&, DRTDevToolsAgent*);
     void createMainWindow();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to