This commit is contained in:
Wes Kocher 2014-01-08 17:14:18 -08:00
Родитель d5f9cb06c2 67903d3205
Коммит 2d5f068bba
1 изменённых файлов: 18 добавлений и 6 удалений

Просмотреть файл

@ -10,19 +10,18 @@ function ifWebGLSupported() {
let { gFront, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
let reloaded = reload(target);
let firstProgram = yield once(gFront, "program-linked");
yield once(gFront, "program-linked");
yield reloaded;
let navigated = navigate(target, MULTIPLE_CONTEXTS_URL);
let [secondProgram, thirdProgram] = yield getPrograms(gFront, 2);
yield getPrograms(gFront, 2);
yield navigated;
let vsEditor = yield ShadersEditorsView._getEditor("vs");
let fsEditor = yield ShadersEditorsView._getEditor("fs");
yield navigateInHistory(target, "back", "will-navigate");
yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED);
yield once(panel.panelWin, EVENTS.SOURCES_SHOWN);
yield waitForSources();
is($("#content").hidden, false,
"The tool's content should not be hidden.");
@ -37,8 +36,7 @@ function ifWebGLSupported() {
"The fragment shader editor contains the correct text.");
yield navigateInHistory(target, "forward", "will-navigate");
yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED);
yield once(panel.panelWin, EVENTS.SOURCES_SHOWN);
yield waitForSources();
is($("#content").hidden, false,
"The tool's content should not be hidden.");
@ -54,4 +52,18 @@ function ifWebGLSupported() {
yield teardown(panel);
finish();
function waitForSources() {
let deferred = promise.defer();
let win = panel.panelWin;
// These events must fire in this in order and the second event fires
// synchronously after the first event, so we can't use Promise.all and the
// `once` helper.
win.once(win.EVENTS.PROGRAMS_ADDED, () => {
win.once(win.EVENTS.SOURCES_SHOWN, () => {
deferred.resolve();
});
});
return deferred.promise;
}
}