| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../http/tests/inspector/resources/inspector-test.js"></script> |
| <script> |
| function load() { |
| window.context2d = document.createElement("canvas").getContext("2d"); |
| |
| runTest(); |
| } |
| |
| function test() { |
| let suite = InspectorTest.createAsyncSuite("Canvas.requestClientNodes"); |
| |
| suite.addTestCase({ |
| name: "Canvas.requestClientNodes.Initial", |
| description: "Check that creating a CSS canvas client node is tracked correctly.", |
| test(resolve, reject) { |
| let canvas = WI.canvasManager.canvases[0]; |
| InspectorTest.assert(canvas, "There should be at least one canvas."); |
| |
| canvas.requestClientNodes((clientNodes) => { |
| InspectorTest.expectEqual(clientNodes.length, 0, "There should initially be no client nodes."); |
| resolve(); |
| }); |
| } |
| }); |
| |
| suite.addTestCase({ |
| name: "Canvas.CSSCanvasClients.InvalidCanvasId", |
| description: "Invalid canvas identifiers should cause an error.", |
| test(resolve, reject) { |
| const canvasId = "DOES_NOT_EXIST"; |
| CanvasAgent.requestClientNodes(canvasId, (error, clientNodeIds) => { |
| InspectorTest.expectThat(error, "Should produce an error."); |
| InspectorTest.log("Error: " + error); |
| resolve(); |
| }); |
| } |
| }); |
| |
| suite.runTestCasesAndFinish(); |
| } |
| </script> |
| </head> |
| <body onload="load()"> |
| <p>Test that CanvasAgent tracks changes in the client nodes of a CSS canvas.</p> |
| </body> |
| </html> |