Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / timeline / timeline-timer-fired-from-eval-call-site.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/timeline-test.js"></script>
5 <script>
6
7 function performActions(callback)
8 {
9     window.callWhenDone = callback;
10     var content = "" + 
11         "var fn2 = function() {" +
12         "    console.markTimeline(\"Script evaluated\");" +
13         "    window.callWhenDone();" +
14         "};\\n" +
15         "var fn1 = function() {" +
16         "    window.setTimeout(fn2, 1);" +
17         "};\\n" +
18         "window.setTimeout(fn1, 1);\\n" +
19         "//# sourceURL=fromEval.js";
20     content = "eval('" + content + "');";
21     var scriptElement = document.createElement('script');
22     var contentNode = document.createTextNode(content);
23     scriptElement.appendChild(contentNode);
24     document.body.appendChild(scriptElement);
25     document.body.removeChild(scriptElement);
26 }
27
28 function test()
29 {
30     InspectorTest.invokeAsyncWithTimeline("performActions", finish);
31
32     function finish()
33     {
34         function formatter(record)
35         {
36             if (record.type() === "TimerFire") {
37                 var fnCallSite = record.children()[0].data();
38                 InspectorTest.addResult(record.type() + " " + fnCallSite.scriptName + ":" + fnCallSite.scriptLine);
39             }
40         }
41         InspectorTest.printTimelineRecords(null, formatter);
42         InspectorTest.completeTest();
43     }
44 }
45
46 if (!window.testRunner)
47     setTimeout(performActions, 3000);
48
49 </script>
50 </head>
51
52 <body onload="runTest()">
53 <p>
54 Tests the Timeline API instrumentation of a TimerFired events inside evaluated scripts.
55 </p>
56
57 </body>
58 </html>