summaryrefslogtreecommitdiffstats
path: root/devtools/client/shadereditor/test/browser_webgl-actor-test-05.js
blob: 96e445e01b29a9a45a4bd5fab4d58a691b0059cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

/**
 * Tests that the source contents can be retrieved from the vertex and fragment
 * shader actors.
 */

function* ifWebGLSupported() {
  let { target, front } = yield initBackend(SIMPLE_CANVAS_URL);
  front.setup({ reload: true });

  let programActor = yield once(front, "program-linked");
  let vertexShader = yield programActor.getVertexShader();
  let fragmentShader = yield programActor.getFragmentShader();

  let vertSource = yield vertexShader.getText();
  ok(vertSource.includes("gl_Position"),
    "The correct vertex shader source was retrieved.");

  let fragSource = yield fragmentShader.getText();
  ok(fragSource.includes("gl_FragColor"),
    "The correct fragment shader source was retrieved.");

  yield removeTab(target.tab);
  finish();
}