Bug 1016737 - Wait for PDF Viewer to release resources during testing. r=bdahl

This commit is contained in:
Yury Delendik 2015-10-29 16:05:58 -05:00
Родитель 5f6c33e48f
Коммит 82e1790b97
3 изменённых файлов: 36 добавлений и 4 удалений

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

@ -32,7 +32,9 @@ function test() {
// Runs tests after all 'load' event handlers have fired off
window.addEventListener("documentload", function() {
runTests(document, window, tab, finish);
runTests(document, window, tab, function () {
closePDFViewer(window, finish);
});
}, false, true);
}, true);
}
@ -45,6 +47,8 @@ function runTests(document, window, tab, callback) {
//
ok(document.querySelector('div#viewer'), "document content has viewer UI");
ok('PDFJS' in window.wrappedJSObject, "window content has PDFJS object");
ok('PDFViewerApplication' in window.wrappedJSObject,
"window content has viewer object");
//
// Browser Find
@ -84,3 +88,11 @@ function runTests(document, window, tab, callback) {
callback();
}
/**
* Destroys PDF.js viewer opened document.
*/
function closePDFViewer(window, callback) {
var viewer = window.wrappedJSObject.PDFViewerApplication;
viewer.close().then(callback);
}

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

@ -32,7 +32,9 @@ function test() {
// Runs tests after all 'load' event handlers have fired off
window.addEventListener("documentload", function() {
runTests(document, window, finish);
runTests(document, window, function () {
closePDFViewer(window, finish);
});
}, false, true);
}, true);
}
@ -74,3 +76,11 @@ function runTests(document, window, callback) {
callback();
}
/**
* Destroys PDF.js viewer opened document.
*/
function closePDFViewer(window, callback) {
var viewer = window.wrappedJSObject.PDFViewerApplication;
viewer.close().then(callback);
}

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

@ -90,7 +90,9 @@ function test() {
window.addEventListener("documentload", function() {
initialWidth = parseInt(document.querySelector("div#pageContainer1").style.width);
previousWidth = initialWidth;
runTests(document, window, finish);
runTests(document, window, function () {
closePDFViewer(window, finish);
});
}, false, true);
}, true);
}
@ -102,7 +104,7 @@ function runTests(document, window, callback) {
// Start the zooming tests after the document is loaded
waitForDocumentLoad(document).then(function () {
zoomPDF(document, window, TESTS.shift(), finish);
zoomPDF(document, window, TESTS.shift(), callback);
});
}
@ -173,3 +175,11 @@ function zoomPDF(document, window, test, endCallback) {
EventUtils.synthesizeKey(test.action.event, { ctrlKey: true });
}
}
/**
* Destroys PDF.js viewer opened document.
*/
function closePDFViewer(window, callback) {
var viewer = window.wrappedJSObject.PDFViewerApplication;
viewer.close().then(callback);
}