Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger / navigator-view.html
blob9da0b87f9ad76e39ba39b7cb13b9cb69da902aef
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>
7 <script>
8 function test()
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)
42 children[i].expand();
45 var rootURL = "http://localhost:8080/LayoutTests/inspector/debugger/";
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();
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);
73 dumpNavigator();
75 InspectorTest.addResult("Revealing first resource:");
76 revealUISourceCode(uiSourceCodes[0]);
77 dumpNavigator();
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);
83 dumpNavigator();
85 InspectorTest.addResult("Second:");
86 addUISourceCode(rootURL2 + "foo/bar/script.js?a=2", false);
87 dumpNavigator();
88 InspectorTest.addResult("Others:");
89 addUISourceCode(rootURL2 + "foo/bar/script.js?a=1", false);
90 addUISourceCode(rootURL2 + "foo/baz/script.js", false);
91 dumpNavigator();
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);
97 dumpNavigator();
99 InspectorTest.addResult("Revealing all resources:");
100 for (var i = 0; i < uiSourceCodes.length; ++i)
101 revealUISourceCode(uiSourceCodes[i]);
102 dumpNavigator();
104 InspectorTest.addResult("Removing all resources:");
105 InspectorTest.testNetworkProject._reset(InspectorTest.mainTarget);
106 dumpNavigator();
108 InspectorTest.completeTest();
110 </script>
112 </head>
113 <body onload="runTest()">
115 Tests scripts panel file selectors.
116 </p>
117 </body>
119 </html>