Changeset 95180 in webkit


Ignore:
Timestamp:
Sep 15, 2011 2:10:00 AM (13 years ago)
Author:
jochen@chromium.org
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:
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r95122 r95180  
     12011-09-15  Jochen Eisinger  <jochen@chromium.org>
     2
     3        [chromium] extract normalization of LayoutTests URLs to a method of TestShell
     4        https://bugs.webkit.org/show_bug.cgi?id=68145
     5
     6        This will allow for other classes in DumpRenderTree to reuse this functionality
     7
     8        Reviewed by David Levin.
     9
     10        * DumpRenderTree/chromium/TestShell.cpp:
     11        (normalizeLayoutTestURLInternal):
     12        (dumpHistoryItem):
     13        (TestShell::normalizeLayoutTestURL):
     14        * DumpRenderTree/chromium/TestShell.h:
     15
    1162011-09-14  Ada Chan  <adachan@apple.com>
    217
  • trunk/Tools/DumpRenderTree/chromium/TestShell.cpp

    r93235 r95180  
    397397}
    398398
     399static string normalizeLayoutTestURLInternal(const string& url)
     400{
     401    string result = url;
     402    size_t pos;
     403    if (!url.find(fileUrlPattern) && ((pos = url.find(layoutTestsPattern)) != string::npos)) {
     404        // adjust file URLs to match upstream results.
     405        result.replace(0, pos + layoutTestsPatternSize, fileTestPrefix);
     406    } else if (!url.find(dataUrlPattern)) {
     407        // URL-escape data URLs to match results upstream.
     408        string path = webkit_support::EscapePath(url.substr(dataUrlPatternSize));
     409        result.replace(dataUrlPatternSize, url.length(), path);
     410    }
     411    return result;
     412}
     413
    399414static string dumpHistoryItem(const WebHistoryItem& item, int indent, bool isCurrent)
    400415{
     
    407422        result.append(indent, ' ');
    408423
    409     string url = item.urlString().utf8();
    410     size_t pos;
    411     if (!url.find(fileUrlPattern) && ((pos = url.find(layoutTestsPattern)) != string::npos)) {
    412         // adjust file URLs to match upstream results.
    413         url.replace(0, pos + layoutTestsPatternSize, fileTestPrefix);
    414     } else if (!url.find(dataUrlPattern)) {
    415         // URL-escape data URLs to match results upstream.
    416         string path = webkit_support::EscapePath(url.substr(dataUrlPatternSize));
    417         url.replace(dataUrlPatternSize, url.length(), path);
    418     }
    419 
     424    string url = normalizeLayoutTestURLInternal(item.urlString().utf8());
    420425    result.append(url);
    421426    if (!item.target().isEmpty()) {
     
    690695    return m_windowList.size();
    691696}
     697
     698string TestShell::normalizeLayoutTestURL(const string& url)
     699{
     700    return normalizeLayoutTestURLInternal(url);
     701}
  • trunk/Tools/DumpRenderTree/chromium/TestShell.h

    r90137 r95180  
    177177    WindowList windowList() const { return m_windowList; }
    178178
     179    // Returns a string representation of an URL's spec that does not depend on
     180    // the location of the layout test in the file system.
     181    std::string normalizeLayoutTestURL(const std::string&);
     182
    179183private:
    180184    WebViewHost* createNewWindow(const WebKit::WebURL&, DRTDevToolsAgent*);
Note: See TracChangeset for help on using the changeset viewer.