| <script src="../../http/tests/inspector/resources/inspector-test.js"></script> |
| window.contextWebGL = document.createElement("canvas").getContext("webgl"); |
| window.contextWebGL.clearColor(0, 1, 0, 0.5); // Half-transparent green |
| window.contextWebGL.clear(window.contextWebGL.COLOR_BUFFER_BIT); |
| let suite = InspectorTest.createAsyncSuite("Canvas.requestContentWebGL"); |
| name: "Canvas.requestContentWebGL.validCanvasId", |
| description: "Get the base64 encoded data for the WebGL canvas on the page.", |
| let canvas = Array.from(WI.canvasManager.canvasCollection).find((canvas) => canvas.contextType === WI.Canvas.ContextType.WebGL); |
| reject(`Missing Canvas.`); |
| CanvasAgent.requestContent(canvas.identifier) |
| .then(({content}) => InspectorTest.expectGreaterThan(content.length, "data:image/png;base64,".length, "Content should not be empty.")) |
| suite.runTestCasesAndFinish(); |
| <p>Test that CanvasAgent.requestContent can retrieve a dataURL with the current content of the WebGL canvas.</p> |