browser/devtools/shadereditor/test/browser_se_programs-cache.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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 that program and shader actors are cached in the frontend.
michael@0 6 */
michael@0 7
michael@0 8 function ifWebGLSupported() {
michael@0 9 let [target, debuggee, panel] = yield initShaderEditor(MULTIPLE_CONTEXTS_URL);
michael@0 10 let { EVENTS, gFront, ShadersListView, ShadersEditorsView } = panel.panelWin;
michael@0 11
michael@0 12 reload(target);
michael@0 13 let [[programActor]] = yield promise.all([
michael@0 14 getPrograms(gFront, 1),
michael@0 15 once(panel.panelWin, EVENTS.SOURCES_SHOWN)
michael@0 16 ]);
michael@0 17
michael@0 18 let programItem = ShadersListView.selectedItem;
michael@0 19
michael@0 20 is(programItem.attachment.programActor, programActor,
michael@0 21 "The correct program actor is cached for the selected item.");
michael@0 22
michael@0 23 is((yield programActor.getVertexShader()),
michael@0 24 (yield programItem.attachment.vs),
michael@0 25 "The cached vertex shader promise returns the correct actor.");
michael@0 26
michael@0 27 is((yield programActor.getFragmentShader()),
michael@0 28 (yield programItem.attachment.fs),
michael@0 29 "The cached fragment shader promise returns the correct actor.");
michael@0 30
michael@0 31 is((yield (yield programActor.getVertexShader()).getText()),
michael@0 32 (yield (yield ShadersEditorsView._getEditor("vs")).getText()),
michael@0 33 "The cached vertex shader promise returns the correct text.");
michael@0 34
michael@0 35 is((yield (yield programActor.getFragmentShader()).getText()),
michael@0 36 (yield (yield ShadersEditorsView._getEditor("fs")).getText()),
michael@0 37 "The cached fragment shader promise returns the correct text.");
michael@0 38
michael@0 39 yield teardown(panel);
michael@0 40 finish();
michael@0 41 }

mercurial