summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/inspector/debugger/ui-source-code-display-name.html
blob: f8f5f67e2d70d25f8d5f7bc94db9ebb18d14b24e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script>
function test()
{
    WebInspector.showPanel("sources");

    function createContentProvider(url)
    {
        var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, "");
        contentProvider.requestContent = function(callback)
        {
            InspectorTest.addResult("Source requested for " + url);
            callback("");
        };
        return contentProvider;
    }

    var workspace = new WebInspector.Workspace();
    workspace.networkWorkspaceProvider = new WebInspector.SimpleWorkspaceProvider(workspace, WebInspector.projectTypes.Network);

    function addNetworkFile(url)
    {
        return workspace.networkWorkspaceProvider.addFileForURL(url, createContentProvider(url), false);
    }

    function dumpUISourceCodeDisplayName(url)
    {
        var uiSourceCode = addNetworkFile(url);
        InspectorTest.addResult("UISourceCode display name for url \"" + url + "\" is \"" + WebInspector.TabbedEditorContainer.prototype._titleForFile(uiSourceCode) + "\".");
    }

    const baseURL = "http://localhost:8080/folder/";
    dumpUISourceCodeDisplayName(baseURL + "filename?parameter=value&nnn=1");
    dumpUISourceCodeDisplayName(baseURL + "very-long-filename-123456?nn=1");
    dumpUISourceCodeDisplayName(baseURL + "too-long-filename-1234567890?nn=1");
    dumpUISourceCodeDisplayName(baseURL + "long-filename?parameter=value&nnn=1");
    dumpUISourceCodeDisplayName(baseURL + "too-long-filename-1234567890?parameter=value&nnn=1");
    InspectorTest.completeTest();
};
</script>
</head>
<body onload="runTest()">
<p>Tests UISourceCode display name.</p>
</body>
</html>