browser/devtools/shadereditor/test/browser_se_navigation.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.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Tests target navigations are handled correctly in the UI.
     6  */
     8 function ifWebGLSupported() {
     9   let [target, debuggee, panel] = yield initShaderEditor(SIMPLE_CANVAS_URL);
    10   let { gFront, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
    12   reload(target);
    13   yield promise.all([
    14     once(gFront, "program-linked"),
    15     once(panel.panelWin, EVENTS.SOURCES_SHOWN)
    16   ]);
    18   is($("#reload-notice").hidden, true,
    19     "The 'reload this page' notice should be hidden after linking.");
    20   is($("#waiting-notice").hidden, true,
    21     "The 'waiting for a WebGL context' notice should be visible after linking.");
    22   is($("#content").hidden, false,
    23     "The tool's content should not be hidden anymore.");
    25   is(ShadersListView.itemCount, 1,
    26     "The shaders list contains one entry.");
    27   is(ShadersListView.selectedItem, ShadersListView.items[0],
    28     "The shaders list has a correct item selected.");
    29   is(ShadersListView.selectedIndex, 0,
    30     "The shaders list has a correct index selected.");
    32   let vsEditor = yield ShadersEditorsView._getEditor("vs");
    33   let fsEditor = yield ShadersEditorsView._getEditor("fs");
    35   is(vsEditor.getText().indexOf("gl_Position"), 170,
    36     "The vertex shader editor contains the correct text.");
    37   is(fsEditor.getText().indexOf("gl_FragColor"), 97,
    38     "The fragment shader editor contains the correct text.");
    40   let navigating = once(target, "will-navigate");
    41   let navigated = once(target, "will-navigate");
    42   navigate(target, "about:blank");
    44   yield navigating;
    45   yield once(panel.panelWin, EVENTS.UI_RESET);
    47   is($("#reload-notice").hidden, true,
    48     "The 'reload this page' notice should be hidden while navigating.");
    49   is($("#waiting-notice").hidden, false,
    50     "The 'waiting for a WebGL context' notice should be visible while navigating.");
    51   is($("#content").hidden, true,
    52     "The tool's content should be hidden now that there's no WebGL content.");
    54   is(ShadersListView.itemCount, 0,
    55     "The shaders list should be empty.");
    56   is(ShadersListView.selectedItem, null,
    57     "The shaders list has no correct item.");
    58   is(ShadersListView.selectedIndex, -1,
    59     "The shaders list has a negative index.");
    61   yield ShadersEditorsView._getEditor("vs").then(() => {
    62     ok(false, "The promise for a vertex shader editor should be rejected.");
    63   }, () => {
    64     ok(true, "The vertex shader editors wasn't initialized.");
    65   });
    67   yield ShadersEditorsView._getEditor("fs").then(() => {
    68     ok(false, "The promise for a fragment shader editor should be rejected.");
    69   }, () => {
    70     ok(true, "The fragment shader editors wasn't initialized.");
    71   });
    73   yield navigated;
    75   is($("#reload-notice").hidden, true,
    76     "The 'reload this page' notice should still be hidden after navigating.");
    77   is($("#waiting-notice").hidden, false,
    78     "The 'waiting for a WebGL context' notice should still be visible after navigating.");
    79   is($("#content").hidden, true,
    80     "The tool's content should be still hidden since there's no WebGL content.");
    82   yield teardown(panel);
    83   finish();
    84 }

mercurial