8a26a86a620dee37f26391dc0557c39d57447a64
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / profiler / canvas2d / canvas-has-uninstrumented-canvases.html
1 <html>
2 <head>
3     <script src="../../../http/tests/inspector/inspector-test.js"></script>
4     <script src="../canvas-profiler-test.js"></script>
5 <script>
6
7 var canvas;
8
9 function createCanvasElement()
10 {
11     canvas = document.createElement("canvas");
12     console.assert(canvas, "Failed to create a canvas element");
13 }
14
15 function getCanvasContext()
16 {
17     var context = canvas.getContext("2d");
18     console.assert(context, "Failed to create a canvas context");
19 }
20
21 function test()
22 {
23     InspectorTest.evaluateInConsole("createCanvasElement()", step1);
24     function step1()
25     {
26         InspectorTest.enableCanvasAgent(step2);
27     }
28     function step2()
29     {
30         CanvasAgent.hasUninstrumentedCanvases(hasUninstrumentedCanvasesCallback1);
31     }
32     function hasUninstrumentedCanvasesCallback1(error, result)
33     {
34         InspectorTest.addResult("hasUninstrumentedCanvases: " + result);
35         InspectorTest.assertTrue(!error, "Unexpected error");
36         InspectorTest.assertEquals(false, result, "There should be no uninstrumented canvases");
37         InspectorTest.disableCanvasAgent(step3);
38     }
39     function step3()
40     {
41         InspectorTest.evaluateInConsole("getCanvasContext()", step4);
42     }
43     function step4()
44     {
45         InspectorTest.enableCanvasAgent(step5);
46     }
47     function step5()
48     {
49         CanvasAgent.hasUninstrumentedCanvases(hasUninstrumentedCanvasesCallback2);
50     }
51     function hasUninstrumentedCanvasesCallback2(error, result)
52     {
53         InspectorTest.addResult("hasUninstrumentedCanvases: " + result);
54         InspectorTest.assertTrue(!error, "Unexpected error");
55         InspectorTest.assertEquals(true, result, "There is an uninstrumented canvas!");
56         InspectorTest.completeTest();
57     }
58 }
59
60 </script>
61 </head>
62 <body onload="runTest()">
63 <p>
64 Tests Canvas hasUninstrumentedCanvases protocol method.
65 </p>
66 <a href="https://bugs.webkit.org/show_bug.cgi?id=105721">Bug 105721</a>
67
68 </body>
69 </html>