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.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Tests if the shader editor works with bfcache.
6 */
8 function ifWebGLSupported() {
9 let [target, debuggee, panel] = yield initShaderEditor(SIMPLE_CANVAS_URL);
10 let { gFront, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
12 let reloaded = reload(target);
13 let firstProgram = yield once(gFront, "program-linked");
14 yield reloaded;
16 let navigated = navigate(target, MULTIPLE_CONTEXTS_URL);
17 let [secondProgram, thirdProgram] = yield getPrograms(gFront, 2);
18 yield navigated;
20 let vsEditor = yield ShadersEditorsView._getEditor("vs");
21 let fsEditor = yield ShadersEditorsView._getEditor("fs");
23 yield navigateInHistory(target, "back", "will-navigate");
24 yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED);
25 yield once(panel.panelWin, EVENTS.SOURCES_SHOWN);
27 is($("#content").hidden, false,
28 "The tool's content should not be hidden.");
29 is(ShadersListView.itemCount, 1,
30 "The shaders list contains one entry after navigating back.");
31 is(ShadersListView.selectedIndex, 0,
32 "The shaders list has a correct selection after navigating back.");
34 is(vsEditor.getText().indexOf("gl_Position"), 170,
35 "The vertex shader editor contains the correct text.");
36 is(fsEditor.getText().indexOf("gl_FragColor"), 97,
37 "The fragment shader editor contains the correct text.");
39 yield navigateInHistory(target, "forward", "will-navigate");
40 yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED);
41 yield once(panel.panelWin, EVENTS.SOURCES_SHOWN);
43 is($("#content").hidden, false,
44 "The tool's content should not be hidden.");
45 is(ShadersListView.itemCount, 2,
46 "The shaders list contains two entries after navigating forward.");
47 is(ShadersListView.selectedIndex, 0,
48 "The shaders list has a correct selection after navigating forward.");
50 is(vsEditor.getText().indexOf("gl_Position"), 100,
51 "The vertex shader editor contains the correct text.");
52 is(fsEditor.getText().indexOf("gl_FragColor"), 89,
53 "The fragment shader editor contains the correct text.");
55 yield teardown(panel);
56 finish();
57 }