Wed, 31 Dec 2014 06:09:35 +0100
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 target navigations are handled correctly in the UI. |
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, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; |
michael@0 | 11 | |
michael@0 | 12 | reload(target); |
michael@0 | 13 | yield promise.all([ |
michael@0 | 14 | once(gFront, "program-linked"), |
michael@0 | 15 | once(panel.panelWin, EVENTS.SOURCES_SHOWN) |
michael@0 | 16 | ]); |
michael@0 | 17 | |
michael@0 | 18 | is($("#reload-notice").hidden, true, |
michael@0 | 19 | "The 'reload this page' notice should be hidden after linking."); |
michael@0 | 20 | is($("#waiting-notice").hidden, true, |
michael@0 | 21 | "The 'waiting for a WebGL context' notice should be visible after linking."); |
michael@0 | 22 | is($("#content").hidden, false, |
michael@0 | 23 | "The tool's content should not be hidden anymore."); |
michael@0 | 24 | |
michael@0 | 25 | is(ShadersListView.itemCount, 1, |
michael@0 | 26 | "The shaders list contains one entry."); |
michael@0 | 27 | is(ShadersListView.selectedItem, ShadersListView.items[0], |
michael@0 | 28 | "The shaders list has a correct item selected."); |
michael@0 | 29 | is(ShadersListView.selectedIndex, 0, |
michael@0 | 30 | "The shaders list has a correct index selected."); |
michael@0 | 31 | |
michael@0 | 32 | let vsEditor = yield ShadersEditorsView._getEditor("vs"); |
michael@0 | 33 | let fsEditor = yield ShadersEditorsView._getEditor("fs"); |
michael@0 | 34 | |
michael@0 | 35 | is(vsEditor.getText().indexOf("gl_Position"), 170, |
michael@0 | 36 | "The vertex shader editor contains the correct text."); |
michael@0 | 37 | is(fsEditor.getText().indexOf("gl_FragColor"), 97, |
michael@0 | 38 | "The fragment shader editor contains the correct text."); |
michael@0 | 39 | |
michael@0 | 40 | let navigating = once(target, "will-navigate"); |
michael@0 | 41 | let navigated = once(target, "will-navigate"); |
michael@0 | 42 | navigate(target, "about:blank"); |
michael@0 | 43 | |
michael@0 | 44 | yield navigating; |
michael@0 | 45 | yield once(panel.panelWin, EVENTS.UI_RESET); |
michael@0 | 46 | |
michael@0 | 47 | is($("#reload-notice").hidden, true, |
michael@0 | 48 | "The 'reload this page' notice should be hidden while navigating."); |
michael@0 | 49 | is($("#waiting-notice").hidden, false, |
michael@0 | 50 | "The 'waiting for a WebGL context' notice should be visible while navigating."); |
michael@0 | 51 | is($("#content").hidden, true, |
michael@0 | 52 | "The tool's content should be hidden now that there's no WebGL content."); |
michael@0 | 53 | |
michael@0 | 54 | is(ShadersListView.itemCount, 0, |
michael@0 | 55 | "The shaders list should be empty."); |
michael@0 | 56 | is(ShadersListView.selectedItem, null, |
michael@0 | 57 | "The shaders list has no correct item."); |
michael@0 | 58 | is(ShadersListView.selectedIndex, -1, |
michael@0 | 59 | "The shaders list has a negative index."); |
michael@0 | 60 | |
michael@0 | 61 | yield ShadersEditorsView._getEditor("vs").then(() => { |
michael@0 | 62 | ok(false, "The promise for a vertex shader editor should be rejected."); |
michael@0 | 63 | }, () => { |
michael@0 | 64 | ok(true, "The vertex shader editors wasn't initialized."); |
michael@0 | 65 | }); |
michael@0 | 66 | |
michael@0 | 67 | yield ShadersEditorsView._getEditor("fs").then(() => { |
michael@0 | 68 | ok(false, "The promise for a fragment shader editor should be rejected."); |
michael@0 | 69 | }, () => { |
michael@0 | 70 | ok(true, "The fragment shader editors wasn't initialized."); |
michael@0 | 71 | }); |
michael@0 | 72 | |
michael@0 | 73 | yield navigated; |
michael@0 | 74 | |
michael@0 | 75 | is($("#reload-notice").hidden, true, |
michael@0 | 76 | "The 'reload this page' notice should still be hidden after navigating."); |
michael@0 | 77 | is($("#waiting-notice").hidden, false, |
michael@0 | 78 | "The 'waiting for a WebGL context' notice should still be visible after navigating."); |
michael@0 | 79 | is($("#content").hidden, true, |
michael@0 | 80 | "The tool's content should be still hidden since there's no WebGL content."); |
michael@0 | 81 | |
michael@0 | 82 | yield teardown(panel); |
michael@0 | 83 | finish(); |
michael@0 | 84 | } |