mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 714712 - Part 2: pdf.js test. r=gavin
This commit is contained in:
parent
5ae9937cb7
commit
58935f6689
@ -0,0 +1,20 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DEPTH = ../../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = browser/app/profile/extensions/uriloader@pdf.js/test
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_BROWSER_TEST_FILES = \
|
||||
browser_pdfjs_main.js \
|
||||
file_pdfjs_test.pdf \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_BROWSER_TEST_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
|
@ -0,0 +1,37 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
const RELATIVE_DIR = "browser/app/profile/extensions/uriloader@pdf.js/test/";
|
||||
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
AddonManager.getAddonByID("uriloader@pdf.js", function(aAddon) {
|
||||
is(aAddon.userDisabled, true, 'Pdf.js addon must be disabled by default');
|
||||
aAddon.userDisabled = false;
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
aAddon.userDisabled = true;
|
||||
});
|
||||
});
|
||||
|
||||
var tab = gBrowser.addTab(TESTROOT + "file_pdfjs_test.pdf");
|
||||
var newTabBrowser = gBrowser.getBrowserForTab(tab);
|
||||
newTabBrowser.addEventListener("load", function () {
|
||||
newTabBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
var hasViewer = newTabBrowser.contentDocument.querySelector('div#viewer');
|
||||
var hasPDFJS = 'PDFJS' in newTabBrowser.contentWindow.wrappedJSObject;
|
||||
|
||||
ok(hasViewer, "document content has viewer UI");
|
||||
ok(hasPDFJS, "window content has PDFJS object");
|
||||
|
||||
finish();
|
||||
}, true, true);
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
}
|
Binary file not shown.
@ -237,6 +237,7 @@ function createMochitestServer(serverBasePath)
|
||||
server.registerContentType("sjs", "sjs"); // .sjs == CGI-like functionality
|
||||
server.registerContentType("jar", "application/x-jar");
|
||||
server.registerContentType("ogg", "application/ogg");
|
||||
server.registerContentType("pdf", "application/pdf");
|
||||
server.registerContentType("ogv", "video/ogg");
|
||||
server.registerContentType("oga", "audio/ogg");
|
||||
server.registerContentType("dat", "text/plain; charset=utf-8");
|
||||
|
Loading…
Reference in New Issue
Block a user