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
.createWorkspaceWithTarget(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
.testNetworkProject
.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
.rootElement().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 // Verify that adding invalid URL does not throw exception.
69 addUISourceCode("http://example.com/the%2fdir/foo?bar=100%&baz=a%20%2fb", false);
70 addUISourceCode("http://example.com/path%20with%20spaces/white%20space.html", false);
71 addUISourceCode("?a=b", false);
72 addUISourceCode("very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url", false);
75 InspectorTest
.addResult("Revealing first resource:");
76 revealUISourceCode(uiSourceCodes
[0]);
79 // Here we keep http://localhost:8080/LayoutTests/inspector/debugger2/ folder collapsed while adding resources into it.
80 InspectorTest
.addResult("Adding some resources to change the way debugger folder looks like, first:");
81 var rootURL2
= "http://localhost:8080/LayoutTests/inspector/debugger2/";
82 addUISourceCode(rootURL2
+ "foo/bar/script.js", false);
85 InspectorTest
.addResult("Second:");
86 addUISourceCode(rootURL2
+ "foo/bar/script.js?a=2", false);
88 InspectorTest
.addResult("Others:");
89 addUISourceCode(rootURL2
+ "foo/bar/script.js?a=1", false);
90 addUISourceCode(rootURL2
+ "foo/baz/script.js", false);
93 var rootURL3
= "http://localhost:8080/LayoutTests/inspector/debugger3/";
94 addUISourceCode(rootURL3
+ "hasOwnProperty/__proto__/constructor/foo.js", false);
95 addUISourceCode(rootURL3
+ "hasOwnProperty/__proto__/foo.js", false);
96 addUISourceCode(rootURL3
+ "hasOwnProperty/foo.js", false);
99 InspectorTest
.addResult("Revealing all resources:");
100 for (var i
= 0; i
< uiSourceCodes
.length
; ++i
)
101 revealUISourceCode(uiSourceCodes
[i
]);
104 InspectorTest
.addResult("Removing all resources:");
105 InspectorTest
.testNetworkProject
._reset(InspectorTest
.mainTarget
);
108 InspectorTest
.completeTest();
113 <body onload=
"runTest()">
115 Tests scripts panel file selectors.