browser/devtools/shadereditor/test/browser_se_bfcache.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/shadereditor/test/browser_se_bfcache.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     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 shader editor works with bfcache.
     1.9 + */
    1.10 +
    1.11 +function ifWebGLSupported() {
    1.12 +  let [target, debuggee, panel] = yield initShaderEditor(SIMPLE_CANVAS_URL);
    1.13 +  let { gFront, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
    1.14 +
    1.15 +  let reloaded = reload(target);
    1.16 +  let firstProgram = yield once(gFront, "program-linked");
    1.17 +  yield reloaded;
    1.18 +
    1.19 +  let navigated = navigate(target, MULTIPLE_CONTEXTS_URL);
    1.20 +  let [secondProgram, thirdProgram] = yield getPrograms(gFront, 2);
    1.21 +  yield navigated;
    1.22 +
    1.23 +  let vsEditor = yield ShadersEditorsView._getEditor("vs");
    1.24 +  let fsEditor = yield ShadersEditorsView._getEditor("fs");
    1.25 +
    1.26 +  yield navigateInHistory(target, "back", "will-navigate");
    1.27 +  yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED);
    1.28 +  yield once(panel.panelWin, EVENTS.SOURCES_SHOWN);
    1.29 +
    1.30 +  is($("#content").hidden, false,
    1.31 +    "The tool's content should not be hidden.");
    1.32 +  is(ShadersListView.itemCount, 1,
    1.33 +    "The shaders list contains one entry after navigating back.");
    1.34 +  is(ShadersListView.selectedIndex, 0,
    1.35 +    "The shaders list has a correct selection after navigating back.");
    1.36 +
    1.37 +  is(vsEditor.getText().indexOf("gl_Position"), 170,
    1.38 +    "The vertex shader editor contains the correct text.");
    1.39 +  is(fsEditor.getText().indexOf("gl_FragColor"), 97,
    1.40 +    "The fragment shader editor contains the correct text.");
    1.41 +
    1.42 +  yield navigateInHistory(target, "forward", "will-navigate");
    1.43 +  yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED);
    1.44 +  yield once(panel.panelWin, EVENTS.SOURCES_SHOWN);
    1.45 +
    1.46 +  is($("#content").hidden, false,
    1.47 +    "The tool's content should not be hidden.");
    1.48 +  is(ShadersListView.itemCount, 2,
    1.49 +    "The shaders list contains two entries after navigating forward.");
    1.50 +  is(ShadersListView.selectedIndex, 0,
    1.51 +    "The shaders list has a correct selection after navigating forward.");
    1.52 +
    1.53 +  is(vsEditor.getText().indexOf("gl_Position"), 100,
    1.54 +    "The vertex shader editor contains the correct text.");
    1.55 +  is(fsEditor.getText().indexOf("gl_FragColor"), 89,
    1.56 +    "The fragment shader editor contains the correct text.");
    1.57 +
    1.58 +  yield teardown(panel);
    1.59 +  finish();
    1.60 +}

mercurial