| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> | 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script src="../../../http/tests/inspector/workspace-test.js"></script> | 5 <script src="../../../http/tests/inspector/workspace-test.js"></script> |
| 6 <script src="../../../http/tests/inspector/isolated-filesystem-test.js"></script
> | 6 <script src="../../../http/tests/inspector/isolated-filesystem-test.js"></script
> |
| 7 <script src="../../../http/tests/inspector/live-edit-test.js"></script> | 7 <script src="../../../http/tests/inspector/live-edit-test.js"></script> |
| 8 <script> | 8 <script> |
| 9 | 9 |
| 10 function test() | 10 function test() |
| 11 { | 11 { |
| 12 var target; | 12 var target; |
| 13 var resourceScriptMapping; | 13 var resourceScriptMapping; |
| 14 var defaultScriptMapping; | 14 var defaultScriptMapping; |
| 15 var persistence; | 15 var persistence; |
| 16 var fileSystemProjectId = Persistence.FileSystemWorkspaceBinding.projectId("
file:///var/www"); | 16 var fileSystemProjectId = Persistence.FileSystemWorkspaceBinding.projectId("
file:///var/www"); |
| 17 | 17 |
| 18 function createWorkspaceWithTarget() | 18 function createWorkspaceWithTarget() |
| 19 { | 19 { |
| 20 target = InspectorTest.createWorkspaceWithTarget(false); | 20 target = InspectorTest.createWorkspaceWithTarget(false); |
| 21 var entry = InspectorTest.testDebuggerWorkspaceBinding._targetToData.get
(target); | 21 var entry = InspectorTest.testDebuggerWorkspaceBinding._targetToData.get
(target); |
| 22 resourceScriptMapping = entry._resourceMapping; | 22 resourceScriptMapping = entry._resourceMapping; |
| 23 defaultScriptMapping = entry._defaultMapping; | 23 defaultScriptMapping = entry._defaultMapping; |
| 24 if (persistence) | 24 if (persistence) |
| 25 persistence.dispose(); | 25 persistence.dispose(); |
| 26 persistence = new Persistence.Persistence(InspectorTest.testWorkspace, B
indings.breakpointManager, Workspace.fileSystemMapping); | 26 persistence = new Persistence.Persistence(InspectorTest.testWorkspace, B
indings.breakpointManager, Persistence.fileSystemMapping); |
| 27 } | 27 } |
| 28 | 28 |
| 29 function dumpFileSystemUISourceCodesMappings() | 29 function dumpFileSystemUISourceCodesMappings() |
| 30 { | 30 { |
| 31 var uiSourceCodes = InspectorTest.testWorkspace.project(fileSystemProjec
tId).uiSourceCodes(); | 31 var uiSourceCodes = InspectorTest.testWorkspace.project(fileSystemProjec
tId).uiSourceCodes(); |
| 32 InspectorTest.addResult("UISourceCode uri to url mappings:"); | 32 InspectorTest.addResult("UISourceCode uri to url mappings:"); |
| 33 for (var uiSourceCode of uiSourceCodes) { | 33 for (var uiSourceCode of uiSourceCodes) { |
| 34 var binding = persistence.binding(uiSourceCode); | 34 var binding = persistence.binding(uiSourceCode); |
| 35 var url = binding ? binding.network.url() : ""; | 35 var url = binding ? binding.network.url() : ""; |
| 36 InspectorTest.addResult(" " + uiSourceCode.url() + " -> " + url); | 36 InspectorTest.addResult(" " + uiSourceCode.url() + " -> " + url); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 54 InspectorTest.addResult("Adding network resource."); | 54 InspectorTest.addResult("Adding network resource."); |
| 55 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ht
ml/foo.js", Common.resourceTypes.Script, "<foo content>", target); | 55 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ht
ml/foo.js", Common.resourceTypes.Script, "<foo content>", target); |
| 56 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ba
r.js", Common.resourceTypes.Script, "<foo content>", target); | 56 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ba
r.js", Common.resourceTypes.Script, "<foo content>", target); |
| 57 dumpFileSystemUISourceCodesMappings(); | 57 dumpFileSystemUISourceCodesMappings(); |
| 58 | 58 |
| 59 var uiSourceCode = InspectorTest.testWorkspace.uiSourceCode(file
SystemProjectId, "file:///var/www/html/foo.js"); | 59 var uiSourceCode = InspectorTest.testWorkspace.uiSourceCode(file
SystemProjectId, "file:///var/www/html/foo.js"); |
| 60 networkUISourceCode = InspectorTest.testWorkspace.uiSourceCode(B
indings.NetworkProject.projectId(target, target.resourceTreeModel.mainFrame, fal
se), "http://localhost/html/foo.js"); | 60 networkUISourceCode = InspectorTest.testWorkspace.uiSourceCode(B
indings.NetworkProject.projectId(target, target.resourceTreeModel.mainFrame, fal
se), "http://localhost/html/foo.js"); |
| 61 InspectorTest.addResult("Adding mapping between network and file
system resources."); | 61 InspectorTest.addResult("Adding mapping between network and file
system resources."); |
| 62 | 62 |
| 63 var fileSystemPath = Persistence.FileSystemWorkspaceBinding.file
SystemPath(uiSourceCode.project().id()); | 63 var fileSystemPath = Persistence.FileSystemWorkspaceBinding.file
SystemPath(uiSourceCode.project().id()); |
| 64 Workspace.fileSystemMapping.addMappingForResource(networkUISourc
eCode.url(), fileSystemPath, uiSourceCode.url()); | 64 Persistence.fileSystemMapping.addMappingForResource(networkUISou
rceCode.url(), fileSystemPath, uiSourceCode.url()); |
| 65 var setting = JSON.stringify(Workspace.fileSystemMapping._fileSy
stemMappingSetting.get()); | 65 var setting = JSON.stringify(Persistence.fileSystemMapping._file
SystemMappingSetting.get()); |
| 66 | 66 |
| 67 InspectorTest.addResult("Emulate reloading inspector."); | 67 InspectorTest.addResult("Emulate reloading inspector."); |
| 68 fs.reportRemoved(); | 68 fs.reportRemoved(); |
| 69 createWorkspaceWithTarget(); | 69 createWorkspaceWithTarget(); |
| 70 Workspace.fileSystemMapping._fileSystemMappingSetting.set(JSON.p
arse(setting)); | 70 Persistence.fileSystemMapping._fileSystemMappingSetting.set(JSON
.parse(setting)); |
| 71 Workspace.fileSystemMapping._loadFromSettings(); | 71 Persistence.fileSystemMapping._loadFromSettings(); |
| 72 fs.reportCreated(fileSystemCreated2); | 72 fs.reportCreated(fileSystemCreated2); |
| 73 } | 73 } |
| 74 | 74 |
| 75 function fileSystemCreated2() | 75 function fileSystemCreated2() |
| 76 { | 76 { |
| 77 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ht
ml/foo.js", Common.resourceTypes.Script, "<foo content>", target); | 77 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ht
ml/foo.js", Common.resourceTypes.Script, "<foo content>", target); |
| 78 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ba
r.js", Common.resourceTypes.Script, "<foo content>", target); | 78 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ba
r.js", Common.resourceTypes.Script, "<foo content>", target); |
| 79 | 79 |
| 80 dumpFileSystemUISourceCodesMappings(); | 80 dumpFileSystemUISourceCodesMappings(); |
| 81 | 81 |
| 82 InspectorTest.addResult("Removing mapping between network and fi
le system resources."); | 82 InspectorTest.addResult("Removing mapping between network and fi
le system resources."); |
| 83 var uiSourceCode = InspectorTest.testWorkspace.uiSourceCode(file
SystemProjectId, "file:///var/www/html/foo.js"); | 83 var uiSourceCode = InspectorTest.testWorkspace.uiSourceCode(file
SystemProjectId, "file:///var/www/html/foo.js"); |
| 84 Workspace.fileSystemMapping.removeMappingForURL(uiSourceCode.url
()); | 84 Persistence.fileSystemMapping.removeMappingForURL(uiSourceCode.u
rl()); |
| 85 | 85 |
| 86 InspectorTest.addResult("Emulate reloading inspector."); | 86 InspectorTest.addResult("Emulate reloading inspector."); |
| 87 fs.reportRemoved(); | 87 fs.reportRemoved(); |
| 88 createWorkspaceWithTarget(); | 88 createWorkspaceWithTarget(); |
| 89 fs.reportCreated(fileSystemCreated3); | 89 fs.reportCreated(fileSystemCreated3); |
| 90 } | 90 } |
| 91 | 91 |
| 92 function fileSystemCreated3() | 92 function fileSystemCreated3() |
| 93 { | 93 { |
| 94 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ht
ml/foo.js", Common.resourceTypes.Script, "<foo content>", target); | 94 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ht
ml/foo.js", Common.resourceTypes.Script, "<foo content>", target); |
| 95 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ba
r.js", Common.resourceTypes.Script, "<foo content>", target); | 95 InspectorTest.addMockUISourceCodeViaNetwork("http://localhost/ba
r.js", Common.resourceTypes.Script, "<foo content>", target); |
| 96 dumpFileSystemUISourceCodesMappings(); | 96 dumpFileSystemUISourceCodesMappings(); |
| 97 | 97 |
| 98 Workspace.fileSystemMapping.removeMappingForURL(networkUISourceC
ode.url()); | 98 Persistence.fileSystemMapping.removeMappingForURL(networkUISourc
eCode.url()); |
| 99 fs.reportRemoved(); | 99 fs.reportRemoved(); |
| 100 next(); | 100 next(); |
| 101 } | 101 } |
| 102 }, | 102 }, |
| 103 | 103 |
| 104 function testRemoveProject(next) | 104 function testRemoveProject(next) |
| 105 { | 105 { |
| 106 function dumpWorkspaceUISourceCodes() | 106 function dumpWorkspaceUISourceCodes() |
| 107 { | 107 { |
| 108 InspectorTest.addResult("Dumping uiSourceCodes origin URLs:"); | 108 InspectorTest.addResult("Dumping uiSourceCodes origin URLs:"); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 ]); | 159 ]); |
| 160 }; | 160 }; |
| 161 </script> | 161 </script> |
| 162 </head> | 162 </head> |
| 163 <body onload="runTest()"> | 163 <body onload="runTest()"> |
| 164 <p>Tests file system project mappings.</p> | 164 <p>Tests file system project mappings.</p> |
| 165 </body> | 165 </body> |
| 166 </html> | 166 </html> |
| OLD | NEW |