michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests if the shader editor works with bfcache. michael@0: */ michael@0: michael@0: function ifWebGLSupported() { michael@0: let [target, debuggee, panel] = yield initShaderEditor(SIMPLE_CANVAS_URL); michael@0: let { gFront, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; michael@0: michael@0: let reloaded = reload(target); michael@0: let firstProgram = yield once(gFront, "program-linked"); michael@0: yield reloaded; michael@0: michael@0: let navigated = navigate(target, MULTIPLE_CONTEXTS_URL); michael@0: let [secondProgram, thirdProgram] = yield getPrograms(gFront, 2); michael@0: yield navigated; michael@0: michael@0: let vsEditor = yield ShadersEditorsView._getEditor("vs"); michael@0: let fsEditor = yield ShadersEditorsView._getEditor("fs"); michael@0: michael@0: yield navigateInHistory(target, "back", "will-navigate"); michael@0: yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED); michael@0: yield once(panel.panelWin, EVENTS.SOURCES_SHOWN); michael@0: michael@0: is($("#content").hidden, false, michael@0: "The tool's content should not be hidden."); michael@0: is(ShadersListView.itemCount, 1, michael@0: "The shaders list contains one entry after navigating back."); michael@0: is(ShadersListView.selectedIndex, 0, michael@0: "The shaders list has a correct selection after navigating back."); michael@0: michael@0: is(vsEditor.getText().indexOf("gl_Position"), 170, michael@0: "The vertex shader editor contains the correct text."); michael@0: is(fsEditor.getText().indexOf("gl_FragColor"), 97, michael@0: "The fragment shader editor contains the correct text."); michael@0: michael@0: yield navigateInHistory(target, "forward", "will-navigate"); michael@0: yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED); michael@0: yield once(panel.panelWin, EVENTS.SOURCES_SHOWN); michael@0: michael@0: is($("#content").hidden, false, michael@0: "The tool's content should not be hidden."); michael@0: is(ShadersListView.itemCount, 2, michael@0: "The shaders list contains two entries after navigating forward."); michael@0: is(ShadersListView.selectedIndex, 0, michael@0: "The shaders list has a correct selection after navigating forward."); michael@0: michael@0: is(vsEditor.getText().indexOf("gl_Position"), 100, michael@0: "The vertex shader editor contains the correct text."); michael@0: is(fsEditor.getText().indexOf("gl_FragColor"), 89, michael@0: "The fragment shader editor contains the correct text."); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }