| 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 = WebInspector.debuggerModel.target(); | 10 var target = WebInspector.debuggerModel.target(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 var originalUISourceCode; | 49 var originalUISourceCode; |
| 50 uiLocation(script, 0, 5); | 50 uiLocation(script, 0, 5); |
| 51 | 51 |
| 52 function originalUISourceCodeAdded(uiSourceCode) | 52 function originalUISourceCodeAdded(uiSourceCode) |
| 53 { | 53 { |
| 54 originalUISourceCode = uiSourceCode; | 54 originalUISourceCode = uiSourceCode; |
| 55 } | 55 } |
| 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, originalUISourceCo
de.uiLocationToRawLocation(target, 10, 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, WebInspector.r
esourceTypes.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, uiSourceCode.u
iLocationToRawLocation(target, 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; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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 { |
| 101 InspectorTest.addResult("Adding script for finished request."); | 101 InspectorTest.addResult("Adding script for finished request."); |
| 102 script = InspectorTest.createScriptMock(url, 0, 0, false, "<scri
pt source>"); | 102 script = InspectorTest.createScriptMock(url, 0, 0, false, "<scri
pt source>"); |
| 103 resourceScriptMapping.addScript(script); | 103 resourceScriptMapping.addScript(script); |
| 104 InspectorTest.checkUILocation(mockUISourceCode, 0, 5, uiLocation
(script, 0, 5)); | 104 InspectorTest.checkUILocation(mockUISourceCode, 0, 5, uiLocation
(script, 0, 5)); |
| 105 InspectorTest.checkRawLocation(script, 10, 0, mockUISourceCode.u
iLocationToRawLocation(target, 10, 0)); | 105 InspectorTest.checkRawLocation(script, 10, 0, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, mockUISourceCode, 10, 0
)); |
| 106 InspectorTest.dumpUISourceCode(mockUISourceCode, next); | 106 InspectorTest.dumpUISourceCode(mockUISourceCode, next); |
| 107 } | 107 } |
| 108 }, | 108 }, |
| 109 | 109 |
| 110 function testHTMLWithPendingResource(next) | 110 function testHTMLWithPendingResource(next) |
| 111 { | 111 { |
| 112 var script1; | 112 var script1; |
| 113 var script2; | 113 var script2; |
| 114 resetModels(); | 114 resetModels(); |
| 115 var resourceScriptMapping = createResourceScriptMapping(); | 115 var resourceScriptMapping = createResourceScriptMapping(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 127 resourceScriptMapping.addScript(script1); | 127 resourceScriptMapping.addScript(script1); |
| 128 | 128 |
| 129 uiLocation(script1, 0, 5); | 129 uiLocation(script1, 0, 5); |
| 130 | 130 |
| 131 function originalUISourceCodeAdded(uiSourceCode) | 131 function originalUISourceCodeAdded(uiSourceCode) |
| 132 { | 132 { |
| 133 originalUISourceCode1 = uiSourceCode; | 133 originalUISourceCode1 = uiSourceCode; |
| 134 } | 134 } |
| 135 | 135 |
| 136 InspectorTest.checkUILocation(originalUISourceCode1, 0, 5, uiLoc
ation(script1, 0, 5)); | 136 InspectorTest.checkUILocation(originalUISourceCode1, 0, 5, uiLoc
ation(script1, 0, 5)); |
| 137 InspectorTest.checkRawLocation(script1, 10, 0, originalUISourceC
ode1.uiLocationToRawLocation(target, 10, 0)); | 137 InspectorTest.checkRawLocation(script1, 10, 0, InspectorTest.tes
tDebuggerWorkspaceBinding.uiLocationToRawLocation(target, originalUISourceCode1,
10, 0)); |
| 138 InspectorTest.dumpUISourceCode(originalUISourceCode1, step2); | 138 InspectorTest.dumpUISourceCode(originalUISourceCode1, step2); |
| 139 } | 139 } |
| 140 | 140 |
| 141 function step2() | 141 function step2() |
| 142 { | 142 { |
| 143 InspectorTest.addResult("Adding second script for pending reques
t."); | 143 InspectorTest.addResult("Adding second script for pending reques
t."); |
| 144 script2 = InspectorTest.createScriptMock(url, 0, 45, false, "<sc
ript source 2>"); | 144 script2 = InspectorTest.createScriptMock(url, 0, 45, false, "<sc
ript source 2>"); |
| 145 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalUIS
ourceCodeAdded); | 145 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalUIS
ourceCodeAdded); |
| 146 defaultScriptMapping.addScript(script2); | 146 defaultScriptMapping.addScript(script2); |
| 147 resourceScriptMapping.addScript(script2); | 147 resourceScriptMapping.addScript(script2); |
| 148 | 148 |
| 149 function originalUISourceCodeAdded(uiSourceCode) | 149 function originalUISourceCodeAdded(uiSourceCode) |
| 150 { | 150 { |
| 151 originalUISourceCode2 = uiSourceCode; | 151 originalUISourceCode2 = uiSourceCode; |
| 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, originalUISourceC
ode1.uiLocationToRawLocation(target, 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, WebInspector.r
esourceTypes.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, uiSourceCode.
uiLocationToRawLocation(target, 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(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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 { |
| 198 InspectorTest.addResult("Adding first script for finished reques
t."); | 198 InspectorTest.addResult("Adding first script for finished reques
t."); |
| 199 script1 = InspectorTest.createScriptMock(url, 1, 10, false, "<sc
ript source 1>"); | 199 script1 = InspectorTest.createScriptMock(url, 1, 10, false, "<sc
ript source 1>"); |
| 200 resourceScriptMapping.addScript(script1); | 200 resourceScriptMapping.addScript(script1); |
| 201 InspectorTest.checkUILocation(mockUISourceCode, 1, 20, uiLocatio
n(script1, 1, 20)); | 201 InspectorTest.checkUILocation(mockUISourceCode, 1, 20, uiLocatio
n(script1, 1, 20)); |
| 202 InspectorTest.checkRawLocation(script1, 1, 0, mockUISourceCode.u
iLocationToRawLocation(target, 1, 0)); | 202 InspectorTest.checkRawLocation(script1, 1, 0, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, mockUISourceCode, 1, 0)
); |
| 203 InspectorTest.checkRawLocation(script1, 6, 0, mockUISourceCode.u
iLocationToRawLocation(target, 6, 0)); | 203 InspectorTest.checkRawLocation(script1, 6, 0, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, mockUISourceCode, 6, 0)
); |
| 204 InspectorTest.dumpUISourceCode(mockUISourceCode, step3); | 204 InspectorTest.dumpUISourceCode(mockUISourceCode, step3); |
| 205 } | 205 } |
| 206 | 206 |
| 207 function step3() | 207 function step3() |
| 208 { | 208 { |
| 209 InspectorTest.addResult("Adding second script for finished reque
st."); | 209 InspectorTest.addResult("Adding second script for finished reque
st."); |
| 210 script2 = InspectorTest.createScriptMock(url, 5, 45, false, "<sc
ript\nsource\n2>"); | 210 script2 = InspectorTest.createScriptMock(url, 5, 45, false, "<sc
ript\nsource\n2>"); |
| 211 resourceScriptMapping.addScript(script2); | 211 resourceScriptMapping.addScript(script2); |
| 212 InspectorTest.checkUILocation(mockUISourceCode, 1, 20, uiLocatio
n(script1, 1, 20)); | 212 InspectorTest.checkUILocation(mockUISourceCode, 1, 20, uiLocatio
n(script1, 1, 20)); |
| 213 InspectorTest.checkRawLocation(script1, 1, 0, mockUISourceCode.u
iLocationToRawLocation(target, 1, 0)); | 213 InspectorTest.checkRawLocation(script1, 1, 0, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, mockUISourceCode, 1, 0)
); |
| 214 InspectorTest.checkRawLocation(script2, 6, 0, mockUISourceCode.u
iLocationToRawLocation(target, 6, 0)); | 214 InspectorTest.checkRawLocation(script2, 6, 0, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, mockUISourceCode, 6, 0)
); |
| 215 InspectorTest.dumpUISourceCode(mockUISourceCode, next); | 215 InspectorTest.dumpUISourceCode(mockUISourceCode, next); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 ]); | 218 ]); |
| 219 }; | 219 }; |
| 220 | |
| 221 </script> | 220 </script> |
| 222 </head> | 221 </head> |
| 223 <body onload="runTest()"> | 222 <body onload="runTest()"> |
| 224 <p>Tests ResourceScriptMapping class.</p> | 223 <p>Tests ResourceScriptMapping class.</p> |
| 225 </body> | 224 </body> |
| 226 </html> | 225 </html> |
| OLD | NEW |