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
|
||||
|
||||
_BROWSER_TEST_FILES = \
|
||||
head.js \
|
||||
browser_pdfjs_main.js \
|
||||
file_pdfjs_test.pdf \
|
||||
$(NULL)
|
||||
|
@ -21,12 +21,14 @@ function test() {
|
||||
var document = newTabBrowser.contentDocument,
|
||||
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);
|
||||
});
|
||||
}, 0);
|
||||
}, true);
|
||||
}
|
||||
|
||||
|
||||
function runTests(document, window) {
|
||||
//
|
||||
// Overall sanity tests
|
||||
@ -43,48 +45,27 @@ function runTests(document, window) {
|
||||
sidebar.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();
|
||||
//
|
||||
// Sidebar: close
|
||||
//
|
||||
sidebar.click();
|
||||
ok(!outerContainer.classList.contains('sidebarOpen'), 'sidebar closes on click');
|
||||
|
||||
//
|
||||
// Page change from thumbnail click
|
||||
//
|
||||
var pageNumber = document.querySelector('input#pageNumber');
|
||||
is(parseInt(pageNumber.value), 1, 'initial page is 1');
|
||||
//
|
||||
// Page change from prev/next buttons
|
||||
//
|
||||
var prevPage = document.querySelector('button#previous'),
|
||||
nextPage = document.querySelector('button#next');
|
||||
|
||||
ok(thumbnail, 'thumbnail2 is available');
|
||||
if (thumbnail) {
|
||||
thumbnail.click();
|
||||
is(parseInt(pageNumber.value), 2, 'clicking on thumbnail changes page');
|
||||
}
|
||||
var pageNumber = document.querySelector('input#pageNumber');
|
||||
is(parseInt(pageNumber.value), 1, 'initial page is 1');
|
||||
|
||||
//
|
||||
// Sidebar: close
|
||||
//
|
||||
sidebar.click();
|
||||
ok(!outerContainer.classList.contains('sidebarOpen'), 'sidebar closes on click');
|
||||
//
|
||||
// Bookmark button
|
||||
//
|
||||
var viewBookmark = document.querySelector('a#viewBookmark');
|
||||
viewBookmark.click();
|
||||
ok(viewBookmark.href.length > 0, 'viewBookmark button has href');
|
||||
|
||||
//
|
||||
// Page change from prev/next buttons
|
||||
//
|
||||
var prevPage = document.querySelector('button#previous'),
|
||||
nextPage = document.querySelector('button#next');
|
||||
|
||||
nextPage.click();
|
||||
is(parseInt(pageNumber.value), 2, 'page increases after clicking on next');
|
||||
|
||||
prevPage.click();
|
||||
is(parseInt(pageNumber.value), 1, 'page decreases after clicking on previous');
|
||||
|
||||
//
|
||||
// Bookmark button
|
||||
//
|
||||
var viewBookmark = document.querySelector('a#viewBookmark');
|
||||
viewBookmark.click();
|
||||
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