Bug 945323 - Add mochitest to ensure that download attribute on anchor ('a') tag is respected by the DOM Downloads API. r=qdot

This commit is contained in:
Ghislain 'Aus' Lacroix 2014-01-15 15:01:06 -08:00
parent cffb74e865
commit 8da5d4aecc

View File

@ -26,7 +26,6 @@ SimpleTest.waitForExplicitFinish();
var index = -1;
var todayDate = new Date();
var baseServeURL = "http://mochi.test:8888/tests/dom/downloads/tests/";
var baseDownloadPath = "/mnt/sdcard/downloads/";
var lastKnownCurrentBytes = 0;
function next() {
@ -45,11 +44,12 @@ function next() {
function checkConsistentDownloadAttributes(download) {
var href = document.getElementById("download1").getAttribute("href");
var expectedServeURL = baseServeURL + href;
var expectedDownloadPath = baseDownloadPath + "test.bin";
var destinationRegEx = /test\(?[0-9]*\)?\.bin$/;
// bug 945323: Download path isn't honoring download attribute
todo(download.path === expectedDownloadPath,
"Download path = " + expectedDownloadPath);
ok(destinationRegEx.test(download.path),
"Download path '" + download.path +
"' should match '" + destinationRegEx + "' regexp.");
ok(download.startTime >= todayDate,
"Download start time should be greater than or equal to today");