Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector-enabled / sources / debugger / linkifier.html
blobf4d2871418c81a1eee0575168598701f68be5b5b
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>// It is important that script starts on line 5 (zero-based 4)
7 function nonFormattedFunction() { var i = 2 + 2; var a = 4; return a + i; }
9 function dummyScript()
11 console.log("dummy string");
14 function onload()
16 if (window.testRunner) {
17 testRunner.waitUntilDone();
18 testRunner.showWebInspector();
20 runTest();
23 function test()
25 var scriptFormatter;
26 var linkifier;
27 var link;
28 var script;
29 var uiSourceCode;
31 InspectorTest.scriptFormatter().then(startDebuggerTest);
33 function startDebuggerTest(sf)
35 scriptFormatter = sf;
36 InspectorTest.startDebuggerTest(waitForScripts);
39 function waitForScripts()
41 InspectorTest.showScriptSource("linkifier.html", debuggerTest);
44 function debuggerTest()
46 var scripts = InspectorTest.debuggerModel.scripts;
47 for (var scriptId in scripts) {
48 var scriptCandidate = scripts[scriptId];
49 if (scriptCandidate.sourceURL === InspectorTest.resourceTreeModel.inspectedPageURL() && scriptCandidate.lineOffset === 4) {
50 script = scriptCandidate;
51 break;
55 uiSourceCode = WebInspector.workspace.uiSourceCodeForOriginURL(InspectorTest.resourceTreeModel.inspectedPageURL());
56 var linkifyMe = "at triggerError (http://localhost/show/:22:11)";
57 var fragment = WebInspector.linkifyStringAsFragment(linkifyMe);
58 var anchor = fragment.querySelector('a');
59 InspectorTest.addResult("The string \"" + linkifyMe + " \" linkifies to url: " + anchor.href);
60 InspectorTest.addResult("The lineNumber is " + anchor.lineNumber + " with type " + (typeof anchor.lineNumber));
61 InspectorTest.addResult("The columnNumber is " + anchor.columnNumber + " with type " + (typeof anchor.columnNumber));
63 linkifier = new WebInspector.Linkifier();
64 var count1 = liveLocationsCount();
65 link = linkifier.linkifyScriptLocation(WebInspector.targetManager.mainTarget(), null, InspectorTest.resourceTreeModel.inspectedPageURL(), 8, 0, "dummy-class");
66 var count2 = liveLocationsCount();
68 InspectorTest.addResult("listeners added on raw source code: " + (count2 - count1));
69 InspectorTest.addResult("original location: " + link.textContent);
70 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorAction.prototype, "_updateButton", uiSourceCodeScriptFormatted);
71 scriptFormatter._toggleFormatScriptSource();
74 function uiSourceCodeScriptFormatted()
76 InspectorTest.addResult("pretty printed location: " + link.textContent);
77 scriptFormatter._discardFormattedUISourceCodeScript(WebInspector.panels.sources.visibleView.uiSourceCode());
78 InspectorTest.addResult("reverted location: " + link.textContent);
80 var count1 = liveLocationsCount();
81 linkifier.reset();
82 var count2 = liveLocationsCount();
84 InspectorTest.addResult("listeners removed from raw source code: " + (count1 - count2));
86 InspectorTest.completeDebuggerTest();
89 function liveLocationsCount()
91 return WebInspector.debuggerWorkspaceBinding._ensureInfoForScript(script)._locations.size;
95 </script>
96 </head>
98 <body onload="onload()">
99 <p>
100 Tests that Linkifier works correctly.
103 </body>
104 </html>