| OLD | NEW |
| (Empty) |
| 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 <script> | |
| 7 function test() | |
| 8 { | |
| 9 function dumpNavigator(sourcesNavigatorView) | |
| 10 { | |
| 11 InspectorTest.dumpNavigatorView(sourcesNavigatorView, "sources", " "); | |
| 12 } | |
| 13 | |
| 14 function createNavigatorView() | |
| 15 { | |
| 16 var navigatorView = new WebInspector.SourcesNavigatorView(); | |
| 17 navigatorView.setWorkspace(InspectorTest.testWorkspace); | |
| 18 navigatorView.show(WebInspector.inspectorView.element); | |
| 19 return navigatorView; | |
| 20 } | |
| 21 | |
| 22 function createContentProvider(url) | |
| 23 { | |
| 24 var contentProvider = new WebInspector.StaticContentProvider(WebInspecto
r.resourceTypes.Script, ""); | |
| 25 contentProvider.requestContent = function(callback) | |
| 26 { | |
| 27 InspectorTest.addResult("Source requested for " + url); | |
| 28 callback(""); | |
| 29 }; | |
| 30 return contentProvider; | |
| 31 } | |
| 32 | |
| 33 function createMockWorkspace() | |
| 34 { | |
| 35 InspectorTest.createWorkspaceWithTarget(true); | |
| 36 InspectorTest.testDebuggerProjectDelegate = new WebInspector.DebuggerPro
jectDelegate(InspectorTest.testWorkspace, "debugger:", WebInspector.projectTypes
.Debugger); | |
| 37 return InspectorTest.testWorkspace; | |
| 38 } | |
| 39 | |
| 40 function addNetworkFile(workspace, url) | |
| 41 { | |
| 42 return InspectorTest.testNetworkProject.addFileForURL(url, createContent
Provider(url)); | |
| 43 } | |
| 44 | |
| 45 function addDebuggerFile(workspace, url) | |
| 46 { | |
| 47 var path = InspectorTest.testDebuggerProjectDelegate.addContentProvider(
"", url, url, url, createContentProvider(url)); | |
| 48 return InspectorTest.testWorkspace.uiSourceCode("debugger:", path) | |
| 49 } | |
| 50 | |
| 51 InspectorTest.runTestSuite([ | |
| 52 function testInitialLoad(next) | |
| 53 { | |
| 54 var workspace = createMockWorkspace(); | |
| 55 | |
| 56 addNetworkFile(workspace, "foobar.js"); | |
| 57 | |
| 58 var sourcesNavigatorView = createNavigatorView(); | |
| 59 | |
| 60 addNetworkFile(workspace, "foo.js"); | |
| 61 addNetworkFile(workspace, "bar.js"); | |
| 62 var uiSourceCode = addNetworkFile(workspace, "baz.js"); | |
| 63 sourcesNavigatorView.revealUISourceCode(uiSourceCode); | |
| 64 | |
| 65 dumpNavigator(sourcesNavigatorView); | |
| 66 next(); | |
| 67 }, | |
| 68 | |
| 69 function testReset(next) | |
| 70 { | |
| 71 var workspace = createMockWorkspace(); | |
| 72 var sourcesNavigatorView = createNavigatorView(); | |
| 73 | |
| 74 var uiSourceCode = addNetworkFile(workspace, "foo.js"); | |
| 75 addNetworkFile(workspace, "bar.js"); | |
| 76 addNetworkFile(workspace, "baz.js"); | |
| 77 | |
| 78 dumpNavigator(sourcesNavigatorView); | |
| 79 InspectorTest.addResult("Revealing in navigator."); | |
| 80 sourcesNavigatorView.revealUISourceCode(uiSourceCode); | |
| 81 dumpNavigator(sourcesNavigatorView); | |
| 82 | |
| 83 InspectorTest.testNetworkProject._reset(); | |
| 84 dumpNavigator(sourcesNavigatorView); | |
| 85 uiSourceCode = addNetworkFile(workspace, "bar.js"); | |
| 86 sourcesNavigatorView.revealUISourceCode(uiSourceCode); | |
| 87 dumpNavigator(sourcesNavigatorView); | |
| 88 | |
| 89 next(); | |
| 90 }, | |
| 91 | |
| 92 function testDebuggerUISourceCodeAddedAndRemoved(next) | |
| 93 { | |
| 94 var workspace = createMockWorkspace(); | |
| 95 var sourcesNavigatorView = createNavigatorView(); | |
| 96 | |
| 97 var uiSourceCode = addNetworkFile(workspace, "foo.js"); | |
| 98 var debuggerUISourceCode = addDebuggerFile(workspace, "compiled.js")
; | |
| 99 sourcesNavigatorView.revealUISourceCode(uiSourceCode); | |
| 100 sourcesNavigatorView.revealUISourceCode(debuggerUISourceCode); | |
| 101 dumpNavigator(sourcesNavigatorView); | |
| 102 | |
| 103 // Plug compiler source mapping. | |
| 104 addNetworkFile(workspace, "source.js"); | |
| 105 | |
| 106 dumpNavigator(sourcesNavigatorView); | |
| 107 next(); | |
| 108 } | |
| 109 ]); | |
| 110 }; | |
| 111 </script> | |
| 112 </head> | |
| 113 <body onload="runTest()"> | |
| 114 <p>Tests that scripts panel UI elements work as intended.</p> | |
| 115 </body> | |
| 116 </html> | |
| OLD | NEW |