3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../canvas-profiler-test.js"></script>
11 function testCanvasGradientCapturing()
13 var gradient = ctx.createLinearGradient(0, 0, 10, 10);
14 console.assert(gradient, "Failed to create a CanvasGradient object");
15 gradient.addColorStop(0, '#fff');
16 gradient.addColorStop(0.3, '#aaa');
17 gradient.addColorStop(1, '#000');
19 var gradientResource = gradient["__resourceObject"];
20 console.assert(gradientResource, "CanvasGradient object is not wrapped");
22 var calls = gradientResource.calls();
23 var expectedLength = 4;
24 console.assert(calls.length === expectedLength, "Expected length of the log: " + expectedLength + ", but was: " + calls.length);
27 function createAndRunCanvas2DProgram()
29 ctx = createCanvas2DContext();
30 console.assert(ctx, "Failed to create 2D context");
32 ctxResource = ctx["__resourceObject"];
33 console.assert(ctxResource, "2D context is not wrapped");
35 rawCtx = ctxResource.wrappedObject();
36 console.assert(rawCtx, "No raw 2D context found");
37 console.assert(ctx !== rawCtx, "Proxy and RAW contexts should not be the same");
39 testCanvasGradientCapturing();
46 InspectorTest.enableCanvasAgent(step1);
49 InspectorTest.evaluateInPage("createAndRunCanvas2DProgram()", step2);
53 InspectorTest.assertEquals("SUCCESS", error.description);
54 InspectorTest.completeTest();
60 <body onload="runTest()">
62 Tests Canvas 2D capturing for CanvasGradient objects.
64 <a href="https://bugs.webkit.org/show_bug.cgi?id=101432">Bug 101432</a>