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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/shadereditor/test/browser_webgl-actor-test-10.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/**
     1.8 + * Tests if the WebGL context is correctly instrumented every time the
     1.9 + * target navigates.
    1.10 + */
    1.11 +
    1.12 +function ifWebGLSupported() {
    1.13 +  let [target, debuggee, front] = yield initBackend(SIMPLE_CANVAS_URL);
    1.14 +
    1.15 +  front.setup({ reload: true });
    1.16 +  yield testHighlighting((yield once(front, "program-linked")));
    1.17 +  ok(true, "Canvas was correctly instrumented on the first navigation.");
    1.18 +
    1.19 +  reload(target);
    1.20 +  yield testHighlighting((yield once(front, "program-linked")));
    1.21 +  ok(true, "Canvas was correctly instrumented on the second navigation.");
    1.22 +
    1.23 +  reload(target);
    1.24 +  yield testHighlighting((yield once(front, "program-linked")));
    1.25 +  ok(true, "Canvas was correctly instrumented on the third navigation.");
    1.26 +
    1.27 +  yield removeTab(target.tab);
    1.28 +  finish();
    1.29 +
    1.30 +  function testHighlighting(programActor) {
    1.31 +    return Task.spawn(function() {
    1.32 +      yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
    1.33 +      yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
    1.34 +      ok(true, "The corner pixel colors are correct before highlighting.");
    1.35 +
    1.36 +      yield programActor.highlight([0, 1, 0, 1]);
    1.37 +      yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
    1.38 +      yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
    1.39 +      ok(true, "The corner pixel colors are correct after highlighting.");
    1.40 +
    1.41 +      yield programActor.unhighlight();
    1.42 +      yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
    1.43 +      yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
    1.44 +      ok(true, "The corner pixel colors are correct after unhighlighting.");
    1.45 +    });
    1.46 +  }
    1.47 +}

mercurial