Upstream version 11.39.250.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / navigator-view.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     InspectorTest.createWorkspace(true);
11     var sourcesNavigatorView = new WebInspector.SourcesNavigatorView();
12     sourcesNavigatorView.setWorkspace(InspectorTest.testWorkspace);
13     sourcesNavigatorView.show(WebInspector.inspectorView.element);
14     var contentScriptsNavigatorView = new WebInspector.ContentScriptsNavigatorView();
15     contentScriptsNavigatorView.setWorkspace(InspectorTest.testWorkspace);
16     contentScriptsNavigatorView.show(WebInspector.inspectorView.element);
17
18     var uiSourceCodes = [];
19     function addUISourceCode(url, isContentScript)
20     {
21         var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, "");
22         var uiSourceCode = InspectorTest.testNetworkWorkspaceBinding.addFileForURL(url, contentProvider, isContentScript);
23         uiSourceCodes.push(uiSourceCode);
24     }
25
26     function revealUISourceCode(uiSourceCode)
27     {
28         sourcesNavigatorView.revealUISourceCode(uiSourceCode);
29         contentScriptsNavigatorView.revealUISourceCode(uiSourceCode);
30     }
31
32     function dumpNavigator()
33     {
34         InspectorTest.dumpNavigatorView(sourcesNavigatorView, "sources", "  ");
35         InspectorTest.dumpNavigatorView(contentScriptsNavigatorView, "contentScripts", "  ");
36     }
37
38     function expandDomains(tree)
39     {
40         var children = sourcesNavigatorView._scriptsTree.children;
41         for (var i = 0; i < children.length; ++i)
42           children[i].expand();
43     }
44
45     var rootURL = "http://localhost:8080/LayoutTests/inspector/debugger/";
46
47     InspectorTest.addResult("Adding first resource:");
48     addUISourceCode(rootURL + "foo/bar/script.js", false);
49     dumpNavigator();
50     InspectorTest.addResult("Expanding domains:");
51     expandDomains();
52     dumpNavigator();
53     InspectorTest.addResult("Adding second resource:");
54     addUISourceCode(rootURL + "foo/bar/script.js?a=2", false);
55     dumpNavigator();
56     InspectorTest.addResult("Adding other resources:");
57     addUISourceCode(rootURL + "foo/bar/script.js?a=1", false);
58     addUISourceCode(rootURL + "foo/baz/script.js", false);
59     dumpNavigator();
60
61     InspectorTest.addResult("Adding content scripts and some random resources:");
62     addUISourceCode(rootURL + "foo/bar/contentScript2.js?a=1", true);
63     addUISourceCode(rootURL + "foo/bar/contentScript.js?a=2", true);
64     addUISourceCode(rootURL + "foo/bar/contentScript.js?a=1", true);
65     addUISourceCode("http://example.com/", false);
66     addUISourceCode("http://example.com/?a=b", false);
67     addUISourceCode("http://example.com/the%2fdir/foo?bar=100&baz=a%20%2fb", false);
68     addUISourceCode("http://example.com/the%2fdir/foo?bar=100%25&baz=a%20%2fb", false);
69     addUISourceCode("http://example.com/path%20with%20spaces/white%20space.html", false);
70     addUISourceCode("?a=b", false);
71     addUISourceCode("very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url", false);
72     dumpNavigator();
73
74     InspectorTest.addResult("Revealing first resource:");
75     revealUISourceCode(uiSourceCodes[0]);
76     dumpNavigator();
77
78     // Here we keep http://localhost:8080/LayoutTests/inspector/debugger2/ folder collapsed while adding resources into it.
79     InspectorTest.addResult("Adding some resources to change the way debugger folder looks like, first:");
80     var rootURL2 = "http://localhost:8080/LayoutTests/inspector/debugger2/";
81     addUISourceCode(rootURL2 + "foo/bar/script.js", false);
82     dumpNavigator();
83
84     InspectorTest.addResult("Second:");
85     addUISourceCode(rootURL2 + "foo/bar/script.js?a=2", false);
86     dumpNavigator();
87     InspectorTest.addResult("Others:");
88     addUISourceCode(rootURL2 + "foo/bar/script.js?a=1", false);
89     addUISourceCode(rootURL2 + "foo/baz/script.js", false);
90     dumpNavigator();
91
92     var rootURL3 = "http://localhost:8080/LayoutTests/inspector/debugger3/";
93     addUISourceCode(rootURL3 + "hasOwnProperty/__proto__/constructor/foo.js", false);
94     addUISourceCode(rootURL3 + "hasOwnProperty/__proto__/foo.js", false);
95     addUISourceCode(rootURL3 + "hasOwnProperty/foo.js", false);
96     dumpNavigator();
97
98     InspectorTest.addResult("Revealing all resources:");
99     for (var i = 0; i < uiSourceCodes.length; ++i)
100         revealUISourceCode(uiSourceCodes[i]);
101     dumpNavigator();
102
103     InspectorTest.addResult("Removing all resources:");
104     InspectorTest.testNetworkWorkspaceBinding.reset();
105     dumpNavigator();
106
107     InspectorTest.completeTest();
108 }
109 </script>
110
111 </head>
112 <body onload="runTest()">
113 <p>
114 Tests scripts panel file selectors.
115 </p>
116 </body>
117
118 </html>