Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / profiler / cpu-profiler-profiling.html
1 <html>
2 <head>
3   <script src="../../http/tests/inspector/inspector-test.js"></script>
4   <script src="profiler-test.js"></script>
5 <script>
6
7 function pageFunction() {
8     (function () {
9         console.profile("profile");
10         console.profileEnd("profile");
11     })();
12 }
13
14 function test()
15 {
16     function checkFunction(name, tree)
17     {
18         var node = tree.children[0];
19         if (!node)
20             InspectorTest.addResult("no node");
21         while (node) {
22             if (node.functionName === name) {
23                 InspectorTest.addResult("found " + name);
24                 return;
25             }
26             node = node.traverseNextNode(true, null, true);
27         }
28         InspectorTest.addResult(name + " not found");
29     }
30
31     InspectorTest.runProfilerTestSuite([
32         function testProfiling(next)
33         {
34             function findPageFunctionInProfileView(view)
35             {
36                 var tree = view.profileDataGridTree;
37                 if (!tree)
38                     InspectorTest.addResult("no tree");
39                 checkFunction("pageFunction", tree);
40                 checkFunction("(anonymous function)", tree);
41                 next();
42             }
43             InspectorTest.showProfileWhenAdded("profile");
44             InspectorTest.waitUntilProfileViewIsShown("profile", findPageFunctionInProfileView);
45             InspectorTest.evaluateInPage("pageFunction()", function done() {});
46         }
47     ]);
48 }
49
50 </script>
51 </head>
52 <body onload="runTest()">
53 <p>
54 Tests that CPU profiling works.
55
56 <a href="https://bugs.webkit.org/show_bug.cgi?id=52634">Bug 52634.</a>
57 </p>
58 </body>
59 </html>