diff --git a/test/pdfs/intelisa.pdf.link b/test/pdfs/intelisa.pdf.link new file mode 100644 index 000000000..371cdf947 --- /dev/null +++ b/test/pdfs/intelisa.pdf.link @@ -0,0 +1 @@ +http://www.intel.com/Assets/PDF/manual/253665.pdf \ No newline at end of file diff --git a/test/resources/favicon.ico b/test/resources/favicon.ico new file mode 100644 index 000000000..d44438903 Binary files /dev/null and b/test/resources/favicon.ico differ diff --git a/test/resources/firefox/user.js b/test/resources/firefox/user.js index 7ca293923..b01e2eb76 100644 --- a/test/resources/firefox/user.js +++ b/test/resources/firefox/user.js @@ -33,3 +33,4 @@ user_pref("browser.panorama.experienced_first_run", true); // Assume experienced user_pref("dom.w3c_touch_events.enabled", true); user_pref("extensions.checkCompatibility", false); user_pref("extensions.installDistroAddons", false); // prevent testpilot etc +user_pref("browser.safebrowsing.enable", false); // prevent traffic to google servers diff --git a/test/test.py b/test/test.py index a89aa0a7b..5aece2c24 100644 --- a/test/test.py +++ b/test/test.py @@ -51,6 +51,7 @@ MIMEs = { '.json': 'application/json', '.pdf': 'application/pdf', '.xhtml': 'application/xhtml+xml', + '.ico': 'image/x-icon' } class State: @@ -84,6 +85,14 @@ class PDFTestHandler(BaseHTTPRequestHandler): if VERBOSE: BaseHTTPRequestHandler.log_request(code, size) + def sendFile(self, path, ext): + self.send_response(200) + self.send_header("Content-Type", MIMEs[ext]) + self.send_header("Content-Length", os.path.getsize(path)) + self.end_headers() + with open(path) as f: + self.wfile.write(f.read()) + def do_GET(self): url = urlparse(self.path) # Ignore query string @@ -92,9 +101,14 @@ class PDFTestHandler(BaseHTTPRequestHandler): prefix = os.path.commonprefix(( path, DOC_ROOT )) _, ext = os.path.splitext(path) + if url.path == "/favicon.ico": + self.sendFile(os.path.join(DOC_ROOT, "test", "resources", "favicon.ico"), ext) + return + if not (prefix == DOC_ROOT and os.path.isfile(path) and ext in MIMEs): + print path self.send_error(404) return @@ -103,14 +117,8 @@ class PDFTestHandler(BaseHTTPRequestHandler): self.send_error(501) return - self.send_response(200) - self.send_header("Content-Type", MIMEs[ext]) - self.end_headers() - - # Sigh, os.sendfile() plz - f = open(path) - self.wfile.write(f.read()) - f.close() + self.sendFile(path, ext) + def do_POST(self): diff --git a/test/test_manifest.json b/test/test_manifest.json index e4a7ada81..9b9d5e333 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -14,6 +14,12 @@ "rounds": 1, "type": "load" }, + { "id": "intelisa-load", + "file": "pdfs/intelisa.pdf", + "link": true, + "rounds": 1, + "type": "load" + }, { "id": "pdfspec-load", "file": "pdfs/pdf.pdf", "link": true, diff --git a/test/test_slave.html b/test/test_slave.html index 08a3804f3..d685eeaf2 100644 --- a/test/test_slave.html +++ b/test/test_slave.html @@ -63,7 +63,14 @@ function nextTask() { if (r.readyState == 4) { var data = r.mozResponseArrayBuffer || r.mozResponse || r.responseArrayBuffer || r.response; - pdfDoc = new PDFDoc(new Stream(data)); + + try { + pdfDoc = new PDFDoc(new Stream(data)); + } catch(e) { + pdfDoc.numPages = 1; + failure = 'load PDF doc: '+ e.toString(); + } + currentTask.pageNum = 1, nextPage(); } };