browser/devtools/shadereditor/test/browser_webgl-actor-test-10.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:286aababea7a
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Tests if the WebGL context is correctly instrumented every time the
6 * target navigates.
7 */
8
9 function ifWebGLSupported() {
10 let [target, debuggee, front] = yield initBackend(SIMPLE_CANVAS_URL);
11
12 front.setup({ reload: true });
13 yield testHighlighting((yield once(front, "program-linked")));
14 ok(true, "Canvas was correctly instrumented on the first navigation.");
15
16 reload(target);
17 yield testHighlighting((yield once(front, "program-linked")));
18 ok(true, "Canvas was correctly instrumented on the second navigation.");
19
20 reload(target);
21 yield testHighlighting((yield once(front, "program-linked")));
22 ok(true, "Canvas was correctly instrumented on the third navigation.");
23
24 yield removeTab(target.tab);
25 finish();
26
27 function testHighlighting(programActor) {
28 return Task.spawn(function() {
29 yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
30 yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
31 ok(true, "The corner pixel colors are correct before highlighting.");
32
33 yield programActor.highlight([0, 1, 0, 1]);
34 yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
35 yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
36 ok(true, "The corner pixel colors are correct after highlighting.");
37
38 yield programActor.unhighlight();
39 yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
40 yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
41 ok(true, "The corner pixel colors are correct after unhighlighting.");
42 });
43 }
44 }

mercurial