| 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> | 6 <script> |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 var defaultScriptMapping; | 9 var defaultScriptMapping; |
| 10 var target = InspectorTest.debuggerModel.target(); | 10 var target = InspectorTest.debuggerModel.target(); |
| 11 | 11 |
| 12 function createResourceScriptMapping() | 12 function createResourceScriptMapping() |
| 13 { | 13 { |
| 14 InspectorTest.createWorkspace(); | 14 InspectorTest.createWorkspace(); |
| 15 InspectorTest.testTargetManager.addTarget(target); | 15 InspectorTest.testTargetManager.addTarget(target); |
| 16 defaultScriptMapping = InspectorTest.testDebuggerWorkspaceBinding._targe
tToData.get(target)._defaultMapping; | 16 defaultScriptMapping = InspectorTest.testDebuggerWorkspaceBinding._targe
tToData.get(target)._defaultMapping; |
| 17 var resourceScriptMapping = new WebInspector.ResourceScriptMapping(Inspe
ctorTest.debuggerModel, InspectorTest.testWorkspace, InspectorTest.testNetworkMa
pping, InspectorTest.testDebuggerWorkspaceBinding); | 17 var resourceScriptMapping = new Bindings.ResourceScriptMapping(Inspector
Test.debuggerModel, InspectorTest.testWorkspace, InspectorTest.testNetworkMappin
g, InspectorTest.testDebuggerWorkspaceBinding); |
| 18 return resourceScriptMapping; | 18 return resourceScriptMapping; |
| 19 } | 19 } |
| 20 | 20 |
| 21 function uiLocation(script, lineNumber, columnNumber) | 21 function uiLocation(script, lineNumber, columnNumber) |
| 22 { | 22 { |
| 23 var location = script.debuggerModel.createRawLocation(script, lineNumber
, columnNumber); | 23 var location = script.debuggerModel.createRawLocation(script, lineNumber
, columnNumber); |
| 24 return InspectorTest.testDebuggerWorkspaceBinding.rawLocationToUILocatio
n(location); | 24 return InspectorTest.testDebuggerWorkspaceBinding.rawLocationToUILocatio
n(location); |
| 25 } | 25 } |
| 26 | 26 |
| 27 function resetModels() | 27 function resetModels() |
| (...skipping 28 matching lines...) Expand all Loading... |
| 56 | 56 |
| 57 InspectorTest.checkUILocation(originalUISourceCode, 0, 5, uiLoca
tion(script, 0, 5)); | 57 InspectorTest.checkUILocation(originalUISourceCode, 0, 5, uiLoca
tion(script, 0, 5)); |
| 58 InspectorTest.checkRawLocation(script, 10, 0, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, originalUISourceCode, 1
0, 0)); | 58 InspectorTest.checkRawLocation(script, 10, 0, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, originalUISourceCode, 1
0, 0)); |
| 59 InspectorTest.dumpUISourceCode(originalUISourceCode, step2); | 59 InspectorTest.dumpUISourceCode(originalUISourceCode, step2); |
| 60 } | 60 } |
| 61 | 61 |
| 62 function step2() | 62 function step2() |
| 63 { | 63 { |
| 64 InspectorTest.addResult("Adding uiSourceCode for finished resour
ce."); | 64 InspectorTest.addResult("Adding uiSourceCode for finished resour
ce."); |
| 65 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCod
eAdded); | 65 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCod
eAdded); |
| 66 InspectorTest.addMockUISourceCodeToWorkspace(url, WebInspector.r
esourceTypes.Script, "<content script resource content>"); | 66 InspectorTest.addMockUISourceCodeToWorkspace(url, Common.resourc
eTypes.Script, "<content script resource content>"); |
| 67 | 67 |
| 68 function uiSourceCodeAdded(uiSourceCode) | 68 function uiSourceCodeAdded(uiSourceCode) |
| 69 { | 69 { |
| 70 InspectorTest.checkUILocation(uiSourceCode, 0, 5, uiLocation
(script, 0, 5)); | 70 InspectorTest.checkUILocation(uiSourceCode, 0, 5, uiLocation
(script, 0, 5)); |
| 71 InspectorTest.checkRawLocation(script, 10, 0, InspectorTest.
testDebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode, 10, 0
)); | 71 InspectorTest.checkRawLocation(script, 10, 0, InspectorTest.
testDebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode, 10, 0
)); |
| 72 InspectorTest.dumpUISourceCode(uiSourceCode, next); | 72 InspectorTest.dumpUISourceCode(uiSourceCode, next); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 }, | 75 }, |
| 76 | 76 |
| 77 function testScriptWithFinishedResource(next) | 77 function testScriptWithFinishedResource(next) |
| 78 { | 78 { |
| 79 var script; | 79 var script; |
| 80 resetModels(); | 80 resetModels(); |
| 81 var mockUISourceCode; | 81 var mockUISourceCode; |
| 82 var resourceScriptMapping = createResourceScriptMapping(); | 82 var resourceScriptMapping = createResourceScriptMapping(); |
| 83 var url = "foo.js"; | 83 var url = "foo.js"; |
| 84 step1(); | 84 step1(); |
| 85 | 85 |
| 86 function step1() | 86 function step1() |
| 87 { | 87 { |
| 88 InspectorTest.addResult("Adding uiSourceCode for finished resour
ce."); | 88 InspectorTest.addResult("Adding uiSourceCode for finished resour
ce."); |
| 89 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCod
eForResourceAdded); | 89 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCod
eForResourceAdded); |
| 90 InspectorTest.addMockUISourceCodeToWorkspace(url, WebInspector.r
esourceTypes.Script, "<script resource content>"); | 90 InspectorTest.addMockUISourceCodeToWorkspace(url, Common.resourc
eTypes.Script, "<script resource content>"); |
| 91 } | 91 } |
| 92 | 92 |
| 93 function uiSourceCodeForResourceAdded(uiSourceCode) | 93 function uiSourceCodeForResourceAdded(uiSourceCode) |
| 94 { | 94 { |
| 95 mockUISourceCode = uiSourceCode; | 95 mockUISourceCode = uiSourceCode; |
| 96 InspectorTest.dumpUISourceCode(uiSourceCode, step2); | 96 InspectorTest.dumpUISourceCode(uiSourceCode, step2); |
| 97 } | 97 } |
| 98 | 98 |
| 99 function step2() | 99 function step2() |
| 100 { | 100 { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 152 } |
| 153 InspectorTest.checkUILocation(originalUISourceCode2, 0, 45, uiLo
cation(script2, 0, 45)); | 153 InspectorTest.checkUILocation(originalUISourceCode2, 0, 45, uiLo
cation(script2, 0, 45)); |
| 154 InspectorTest.checkRawLocation(script1, 10, 0, InspectorTest.tes
tDebuggerWorkspaceBinding.uiLocationToRawLocation(target, originalUISourceCode1,
10, 0)); | 154 InspectorTest.checkRawLocation(script1, 10, 0, InspectorTest.tes
tDebuggerWorkspaceBinding.uiLocationToRawLocation(target, originalUISourceCode1,
10, 0)); |
| 155 InspectorTest.dumpUISourceCode(originalUISourceCode2, step3); | 155 InspectorTest.dumpUISourceCode(originalUISourceCode2, step3); |
| 156 } | 156 } |
| 157 | 157 |
| 158 function step3() | 158 function step3() |
| 159 { | 159 { |
| 160 InspectorTest.addResult("Adding uiSourceCode for finished resour
ce."); | 160 InspectorTest.addResult("Adding uiSourceCode for finished resour
ce."); |
| 161 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCod
eAdded); | 161 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCod
eAdded); |
| 162 InspectorTest.addMockUISourceCodeToWorkspace(url, WebInspector.r
esourceTypes.Document, "<resource content>"); | 162 InspectorTest.addMockUISourceCodeToWorkspace(url, Common.resourc
eTypes.Document, "<resource content>"); |
| 163 | 163 |
| 164 function uiSourceCodeAdded(uiSourceCode) | 164 function uiSourceCodeAdded(uiSourceCode) |
| 165 { | 165 { |
| 166 InspectorTest.checkUILocation(uiSourceCode, 0, 5, uiLocation
(script1, 0, 5)); | 166 InspectorTest.checkUILocation(uiSourceCode, 0, 5, uiLocation
(script1, 0, 5)); |
| 167 InspectorTest.checkRawLocation(script1, 10, 0, InspectorTest
.testDebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode, 10,
0)); | 167 InspectorTest.checkRawLocation(script1, 10, 0, InspectorTest
.testDebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode, 10,
0)); |
| 168 InspectorTest.dumpUISourceCode(uiSourceCode, next); | 168 InspectorTest.dumpUISourceCode(uiSourceCode, next); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 }, | 171 }, |
| 172 | 172 |
| 173 function testHTMLWithFinishedResource(next) | 173 function testHTMLWithFinishedResource(next) |
| 174 { | 174 { |
| 175 var script1; | 175 var script1; |
| 176 var script2; | 176 var script2; |
| 177 resetModels(); | 177 resetModels(); |
| 178 var mockUISourceCode; | 178 var mockUISourceCode; |
| 179 var resourceScriptMapping = createResourceScriptMapping(); | 179 var resourceScriptMapping = createResourceScriptMapping(); |
| 180 var url = "index.html"; | 180 var url = "index.html"; |
| 181 step1(); | 181 step1(); |
| 182 | 182 |
| 183 function step1() | 183 function step1() |
| 184 { | 184 { |
| 185 InspectorTest.addResult("Adding uiSourceCode for finished resour
ce."); | 185 InspectorTest.addResult("Adding uiSourceCode for finished resour
ce."); |
| 186 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCod
eForResourceAdded); | 186 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCod
eForResourceAdded); |
| 187 InspectorTest.addMockUISourceCodeToWorkspace(url, WebInspector.r
esourceTypes.Document, "<resource content>"); | 187 InspectorTest.addMockUISourceCodeToWorkspace(url, Common.resourc
eTypes.Document, "<resource content>"); |
| 188 } | 188 } |
| 189 | 189 |
| 190 function uiSourceCodeForResourceAdded(uiSourceCode) | 190 function uiSourceCodeForResourceAdded(uiSourceCode) |
| 191 { | 191 { |
| 192 mockUISourceCode = uiSourceCode; | 192 mockUISourceCode = uiSourceCode; |
| 193 InspectorTest.dumpUISourceCode(uiSourceCode, step2); | 193 InspectorTest.dumpUISourceCode(uiSourceCode, step2); |
| 194 } | 194 } |
| 195 | 195 |
| 196 function step2() | 196 function step2() |
| 197 { | 197 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 ]); | 218 ]); |
| 219 }; | 219 }; |
| 220 </script> | 220 </script> |
| 221 </head> | 221 </head> |
| 222 <body onload="runTest()"> | 222 <body onload="runTest()"> |
| 223 <p>Tests ResourceScriptMapping class.</p> | 223 <p>Tests ResourceScriptMapping class.</p> |
| 224 </body> | 224 </body> |
| 225 </html> | 225 </html> |
| OLD | NEW |