removing all async tests
This commit is contained in:
parent
9201c7caa7
commit
417eeb640d
@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk
|
|||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
|
||||||
_BROWSER_TEST_FILES = \
|
_BROWSER_TEST_FILES = \
|
||||||
head.js \
|
|
||||||
browser_pdfjs_main.js \
|
browser_pdfjs_main.js \
|
||||||
file_pdfjs_test.pdf \
|
file_pdfjs_test.pdf \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
@ -21,12 +21,14 @@ function test() {
|
|||||||
var document = newTabBrowser.contentDocument,
|
var document = newTabBrowser.contentDocument,
|
||||||
window = newTabBrowser.contentWindow;
|
window = newTabBrowser.contentWindow;
|
||||||
|
|
||||||
waitForElement(document, 'canvas#page1', function(err, page1) {
|
// Runs tests after all 'load' event handlers have fired off
|
||||||
|
setTimeout(function() {
|
||||||
runTests(document, window);
|
runTests(document, window);
|
||||||
});
|
}, 0);
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function runTests(document, window) {
|
function runTests(document, window) {
|
||||||
//
|
//
|
||||||
// Overall sanity tests
|
// Overall sanity tests
|
||||||
@ -43,23 +45,6 @@ function runTests(document, window) {
|
|||||||
sidebar.click();
|
sidebar.click();
|
||||||
ok(outerContainer.classList.contains('sidebarOpen'), 'sidebar opens on click');
|
ok(outerContainer.classList.contains('sidebarOpen'), 'sidebar opens on click');
|
||||||
|
|
||||||
// Thumbnails are created asynchronously - wait for them
|
|
||||||
waitForElement(document, 'canvas#thumbnail2', function(error, thumbnail) {
|
|
||||||
if (error)
|
|
||||||
finish();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Page change from thumbnail click
|
|
||||||
//
|
|
||||||
var pageNumber = document.querySelector('input#pageNumber');
|
|
||||||
is(parseInt(pageNumber.value), 1, 'initial page is 1');
|
|
||||||
|
|
||||||
ok(thumbnail, 'thumbnail2 is available');
|
|
||||||
if (thumbnail) {
|
|
||||||
thumbnail.click();
|
|
||||||
is(parseInt(pageNumber.value), 2, 'clicking on thumbnail changes page');
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sidebar: close
|
// Sidebar: close
|
||||||
//
|
//
|
||||||
@ -72,11 +57,8 @@ function runTests(document, window) {
|
|||||||
var prevPage = document.querySelector('button#previous'),
|
var prevPage = document.querySelector('button#previous'),
|
||||||
nextPage = document.querySelector('button#next');
|
nextPage = document.querySelector('button#next');
|
||||||
|
|
||||||
nextPage.click();
|
var pageNumber = document.querySelector('input#pageNumber');
|
||||||
is(parseInt(pageNumber.value), 2, 'page increases after clicking on next');
|
is(parseInt(pageNumber.value), 1, 'initial page is 1');
|
||||||
|
|
||||||
prevPage.click();
|
|
||||||
is(parseInt(pageNumber.value), 1, 'page decreases after clicking on previous');
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Bookmark button
|
// Bookmark button
|
||||||
@ -86,5 +68,4 @@ function runTests(document, window) {
|
|||||||
ok(viewBookmark.href.length > 0, 'viewBookmark button has href');
|
ok(viewBookmark.href.length > 0, 'viewBookmark button has href');
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// Waits for element 'sel' to exist in the DOM of 'doc' before executing 'callback'
|
|
||||||
// Useful when elements are created asynchronously, e.g. after a Web Worker task
|
|
||||||
function waitForElement(doc, sel, callback) {
|
|
||||||
var time = 0,
|
|
||||||
interval = 10,
|
|
||||||
timeout = 5000;
|
|
||||||
|
|
||||||
var checkEl = setInterval(function() {
|
|
||||||
var el = doc.querySelector(sel);
|
|
||||||
if (el) {
|
|
||||||
clearInterval(checkEl);
|
|
||||||
if (callback) callback(null, el);
|
|
||||||
}
|
|
||||||
|
|
||||||
time += interval;
|
|
||||||
if (time > timeout) {
|
|
||||||
ok(false, 'waitForElement timed out on element: '+sel);
|
|
||||||
clearInterval(checkEl);
|
|
||||||
if (callback) callback(true);
|
|
||||||
}
|
|
||||||
}, interval);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user