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>
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);
18 var uiSourceCodes = [];
19 function addUISourceCode(url, isContentScript)
21 var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, "");
22 var uiSourceCode = InspectorTest.testNetworkWorkspaceBinding.addFileForURL(url, contentProvider, isContentScript);
23 uiSourceCodes.push(uiSourceCode);
26 function revealUISourceCode(uiSourceCode)
28 sourcesNavigatorView.revealUISourceCode(uiSourceCode);
29 contentScriptsNavigatorView.revealUISourceCode(uiSourceCode);
32 function dumpNavigator()
34 InspectorTest.dumpNavigatorView(sourcesNavigatorView, "sources", " ");
35 InspectorTest.dumpNavigatorView(contentScriptsNavigatorView, "contentScripts", " ");
38 function expandDomains(tree)
40 var children = sourcesNavigatorView._scriptsTree.children;
41 for (var i = 0; i < children.length; ++i)
45 var rootURL = "http://localhost:8080/LayoutTests/inspector/debugger/";
47 InspectorTest.addResult("Adding first resource:");
48 addUISourceCode(rootURL + "foo/bar/script.js", false);
50 InspectorTest.addResult("Expanding domains:");
53 InspectorTest.addResult("Adding second resource:");
54 addUISourceCode(rootURL + "foo/bar/script.js?a=2", false);
56 InspectorTest.addResult("Adding other resources:");
57 addUISourceCode(rootURL + "foo/bar/script.js?a=1", false);
58 addUISourceCode(rootURL + "foo/baz/script.js", false);
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);
74 InspectorTest.addResult("Revealing first resource:");
75 revealUISourceCode(uiSourceCodes[0]);
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);
84 InspectorTest.addResult("Second:");
85 addUISourceCode(rootURL2 + "foo/bar/script.js?a=2", false);
87 InspectorTest.addResult("Others:");
88 addUISourceCode(rootURL2 + "foo/bar/script.js?a=1", false);
89 addUISourceCode(rootURL2 + "foo/baz/script.js", false);
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);
98 InspectorTest.addResult("Revealing all resources:");
99 for (var i = 0; i < uiSourceCodes.length; ++i)
100 revealUISourceCode(uiSourceCodes[i]);
103 InspectorTest.addResult("Removing all resources:");
104 InspectorTest.testNetworkWorkspaceBinding.reset();
107 InspectorTest.completeTest();
112 <body onload="runTest()">
114 Tests scripts panel file selectors.