Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / scripts-sorting.html
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script src="../../../http/tests/inspector/workspace-test.js"></script>
6
7 <script>
8 function test()
9 {
10     function dumpNavigator(sourcesNavigatorView)
11     {
12         InspectorTest.dumpNavigatorView(sourcesNavigatorView, "sources", "  ");
13     }
14
15     function createNavigatorView(constructor)
16     {
17         var navigatorView = new constructor();
18         navigatorView.setWorkspace(InspectorTest.testWorkspace);
19         navigatorView.show(WebInspector.inspectorView.element);
20         return navigatorView;
21     }
22
23     InspectorTest.createWorkspace(true);
24     sourcesNavigatorView = createNavigatorView(WebInspector.SourcesNavigatorView);
25     contentScriptsNavigatorView = createNavigatorView(WebInspector.ContentScriptsNavigatorView);
26
27     var uiSourceCodes = [];
28     function addUISourceCode(url, isContentScript)
29     {
30         var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, "");
31         var uiSourceCode = InspectorTest.testNetworkWorkspaceBinding.addFileForURL(url, contentProvider, isContentScript);
32         uiSourceCodes.push(uiSourceCode);
33     }
34
35     function dumpNavigator()
36     {
37         InspectorTest.dumpNavigatorView(sourcesNavigatorView, "sources", "  ");
38         InspectorTest.dumpNavigatorView(contentScriptsNavigatorView, "contentScripts", "  ");
39     }
40
41     function dumpScriptsList()
42     {
43         InspectorTest.addResult("");
44         dumpNavigator();
45
46         sourcesNavigatorView.revealUISourceCode(uiSourceCodes[0]);
47         contentScriptsNavigatorView.revealUISourceCode(uiSourceCodes[0]);
48
49         dumpNavigator();
50
51         for (var i = 0; i < uiSourceCodes.length; ++i) {
52             sourcesNavigatorView.revealUISourceCode(uiSourceCodes[i]);
53             contentScriptsNavigatorView.revealUISourceCode(uiSourceCodes[i]);
54         }
55
56         dumpNavigator();
57     }
58
59     var scripts = [
60         "block.js?block=foo",
61         "ga.js",
62         "lenta.ban?pg=4883&ifr=1",
63         "lenta.ban?pg=5309&ifr=1",
64         "top100.jcn?80674",
65         "_js/production/motor.js?1308927432",
66         "i/xgemius.js",
67         "i/js/jquery-1.5.1.min.js",
68         "i/js/jquery.cookie.js",
69         "foo/path/bar.js?file=bar/zzz.js",
70         "foo/path/foo.js?file=bar/aaa.js" ];
71     for (var i = 0; i < scripts.length; ++i)
72         addUISourceCode("http://foo.com/" + scripts[i]);
73
74     var scripts2 = [
75         "foo/path/bar.js?file=bar/zzz.js",
76         "foo/path/foo.js?file=bar/aaa.js" ];
77     for (var i = 0; i < scripts2.length; ++i)
78         addUISourceCode("http://bar.com/" + scripts2[i]);
79     addUISourceCode("*Non*URL*path");
80
81     var extensions = [
82         "extension-schema://extension-name/bar.js",
83         "extension-schema://extension-name/folder/baz.js" ];
84     for (var i = 0; i < extensions.length; ++i)
85         addUISourceCode(extensions[i], true);
86     addUISourceCode("*Another*Non*URL*path", true);
87     dumpScriptsList();
88     InspectorTest.completeTest();
89 }
90 </script>
91
92 </head>
93 <body onload="runTest()">
94 <p>
95 Tests scripts sorting in the scripts panel.
96 </p>
97 </body>
98
99 </html>