| 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> | 5 <script> |
| 6 function test() | 6 function test() |
| 7 { | 7 { |
| 8 var script; | 8 var script; |
| 9 | 9 |
| 10 InspectorTest.startDebuggerTest(waitForScripts); | 10 InspectorTest.startDebuggerTest(waitForScripts); |
| 11 | 11 |
| 12 function waitForScripts() | 12 function waitForScripts() |
| 13 { | 13 { |
| 14 InspectorTest.showScriptSource("linkifier.html", debuggerTest); | 14 InspectorTest.showScriptSource("linkifier.html", debuggerTest); |
| 15 } | 15 } |
| 16 | 16 |
| 17 function debuggerTest() | 17 function debuggerTest() |
| 18 { | 18 { |
| 19 var target = WebInspector.targetManager.mainTarget(); | 19 var target = SDK.targetManager.mainTarget(); |
| 20 var url = target.inspectedURL(); | 20 var url = target.inspectedURL(); |
| 21 var scripts = InspectorTest.debuggerModel.scripts; | 21 var scripts = InspectorTest.debuggerModel.scripts; |
| 22 for (var scriptId in scripts) { | 22 for (var scriptId in scripts) { |
| 23 var scriptCandidate = scripts[scriptId]; | 23 var scriptCandidate = scripts[scriptId]; |
| 24 if (scriptCandidate.sourceURL === url) { | 24 if (scriptCandidate.sourceURL === url) { |
| 25 script = scriptCandidate; | 25 script = scriptCandidate; |
| 26 break; | 26 break; |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 dumpLiveLocationsCount(); | 30 dumpLiveLocationsCount(); |
| 31 | 31 |
| 32 var linkifier = new WebInspector.Linkifier(); | 32 var linkifier = new Components.Linkifier(); |
| 33 InspectorTest.addResult("Created linkifier"); | 33 InspectorTest.addResult("Created linkifier"); |
| 34 dumpLiveLocationsCount(); | 34 dumpLiveLocationsCount(); |
| 35 | 35 |
| 36 var linkA = linkifier.linkifyScriptLocation(target, null, url, 10); | 36 var linkA = linkifier.linkifyScriptLocation(target, null, url, 10); |
| 37 InspectorTest.addResult("Linkified script location A"); | 37 InspectorTest.addResult("Linkified script location A"); |
| 38 dumpLiveLocationsCount(); | 38 dumpLiveLocationsCount(); |
| 39 | 39 |
| 40 var linkB = linkifier.linkifyScriptLocation(target, null, url, 15); | 40 var linkB = linkifier.linkifyScriptLocation(target, null, url, 15); |
| 41 InspectorTest.addResult("Linkified script location B"); | 41 InspectorTest.addResult("Linkified script location B"); |
| 42 dumpLiveLocationsCount(); | 42 dumpLiveLocationsCount(); |
| 43 | 43 |
| 44 linkifier.disposeAnchor(target, linkA); | 44 linkifier.disposeAnchor(target, linkA); |
| 45 InspectorTest.addResult("Disposed link A"); | 45 InspectorTest.addResult("Disposed link A"); |
| 46 dumpLiveLocationsCount(); | 46 dumpLiveLocationsCount(); |
| 47 | 47 |
| 48 linkifier.reset(); | 48 linkifier.reset(); |
| 49 InspectorTest.addResult("Reseted linkifier"); | 49 InspectorTest.addResult("Reseted linkifier"); |
| 50 dumpLiveLocationsCount(); | 50 dumpLiveLocationsCount(); |
| 51 | 51 |
| 52 linkifier.dispose(); | 52 linkifier.dispose(); |
| 53 InspectorTest.addResult("Disposed linkifier"); | 53 InspectorTest.addResult("Disposed linkifier"); |
| 54 dumpLiveLocationsCount(); | 54 dumpLiveLocationsCount(); |
| 55 | 55 |
| 56 // Ensures urls with lots of slashes does not bog down the regex. | 56 // Ensures urls with lots of slashes does not bog down the regex. |
| 57 WebInspector.linkifyStringAsFragment("/".repeat(1000)); | 57 Components.linkifyStringAsFragment("/".repeat(1000)); |
| 58 WebInspector.linkifyStringAsFragment("/a/".repeat(1000)); | 58 Components.linkifyStringAsFragment("/a/".repeat(1000)); |
| 59 | 59 |
| 60 InspectorTest.completeTest(); | 60 InspectorTest.completeTest(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 function dumpLiveLocationsCount() | 63 function dumpLiveLocationsCount() |
| 64 { | 64 { |
| 65 InspectorTest.addResult("Live locations count: " + WebInspector.debugger
WorkspaceBinding._ensureInfoForScript(script)._locations.size); | 65 InspectorTest.addResult("Live locations count: " + Bindings.debuggerWork
spaceBinding._ensureInfoForScript(script)._locations.size); |
| 66 InspectorTest.addResult(""); | 66 InspectorTest.addResult(""); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 </script> | 70 </script> |
| 71 </head> | 71 </head> |
| 72 | 72 |
| 73 <body onload="runTest()"> | 73 <body onload="runTest()"> |
| 74 <p> | 74 <p> |
| 75 Tests that Linkifier works correctly. | 75 Tests that Linkifier works correctly. |
| 76 <p> | 76 <p> |
| 77 | 77 |
| 78 </body> | 78 </body> |
| 79 </html> | 79 </html> |
| OLD | NEW |