browser/devtools/shadereditor/test/browser_se_editors-lazy-init.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Tests if source editors are lazily initialized.
michael@0 6 */
michael@0 7
michael@0 8 function ifWebGLSupported() {
michael@0 9 let [target, debuggee, panel] = yield initShaderEditor(SIMPLE_CANVAS_URL);
michael@0 10 let { gFront, ShadersEditorsView } = panel.panelWin;
michael@0 11
michael@0 12 try {
michael@0 13 yield ShadersEditorsView._getEditor("vs");
michael@0 14 ok(false, "The promise for a vertex shader editor should be rejected.");
michael@0 15 } catch (e) {
michael@0 16 ok(true, "The vertex shader editors wasn't initialized.");
michael@0 17 }
michael@0 18
michael@0 19 try {
michael@0 20 yield ShadersEditorsView._getEditor("fs");
michael@0 21 ok(false, "The promise for a fragment shader editor should be rejected.");
michael@0 22 } catch (e) {
michael@0 23 ok(true, "The fragment shader editors wasn't initialized.");
michael@0 24 }
michael@0 25
michael@0 26 reload(target);
michael@0 27 yield once(gFront, "program-linked");
michael@0 28
michael@0 29 let vsEditor = yield ShadersEditorsView._getEditor("vs");
michael@0 30 let fsEditor = yield ShadersEditorsView._getEditor("fs");
michael@0 31
michael@0 32 ok(vsEditor, "A vertex shader editor was initialized.");
michael@0 33 ok(fsEditor, "A fragment shader editor was initialized.");
michael@0 34
michael@0 35 isnot(vsEditor, fsEditor,
michael@0 36 "The vertex shader editor is distinct from the fragment shader editor.");
michael@0 37
michael@0 38 let vsEditor2 = yield ShadersEditorsView._getEditor("vs");
michael@0 39 let fsEditor2 = yield ShadersEditorsView._getEditor("fs");
michael@0 40
michael@0 41 is(vsEditor, vsEditor2,
michael@0 42 "The vertex shader editor instances are cached.");
michael@0 43 is(fsEditor, fsEditor2,
michael@0 44 "The fragment shader editor instances are cached.");
michael@0 45
michael@0 46 yield teardown(panel);
michael@0 47 finish();
michael@0 48 }

mercurial