Bug 1113736 - Remove tail.js and add cleanup function call in head.js. r=paolo

This commit is contained in:
Mrinal Dhar 2015-12-28 15:05:13 +00:00
parent 838a07faca
commit c7feb8afeb
10 changed files with 8 additions and 70 deletions

View File

@ -683,6 +683,14 @@ add_task(function test_common_initialize()
gHttpServer = new HttpServer();
gHttpServer.registerDirectory("/", do_get_file("../data"));
gHttpServer.start(-1);
do_register_cleanup(() => {
return new Promise(resolve => {
// Ensure all the pending HTTP requests have a chance to finish.
continueResponses();
// Stop the HTTP server, calling resolve when it's done.
gHttpServer.stop(resolve);
});
});
// Cache locks might prevent concurrent requests to the same resource, and
// this may block tests that use the interruptible handlers.

View File

@ -1,25 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Provides infrastructure for automated download components tests.
*/
"use strict";
////////////////////////////////////////////////////////////////////////////////
//// Termination functions common to all tests
add_task(function* test_common_terminate()
{
// Ensure all the pending HTTP requests have a chance to finish.
continueResponses();
// Stop the HTTP server. We must do this inside a task in "tail.js" until the
// xpcshell testing framework supports asynchronous termination functions.
let deferred = Promise.defer();
gHttpServer.stop(deferred.resolve);
yield deferred.promise;
});

View File

@ -87,9 +87,3 @@ add_task(function test_DownloadError()
do_check_true(error.becauseBlocked);
do_check_true(error.becauseBlockedByParentalControls);
});
////////////////////////////////////////////////////////////////////////////////
//// Termination
var tailFile = do_get_file("tail.js");
Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec);

View File

@ -415,9 +415,3 @@ add_task(function* test_exit_private_browsing()
continueResponses();
});
////////////////////////////////////////////////////////////////////////////////
//// Termination
var tailFile = do_get_file("tail.js");
Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec);

View File

@ -16,9 +16,3 @@ var gUseLegacySaver = true;
var scriptFile = do_get_file("common_test_Download.js");
Services.scriptloader.loadSubScript(NetUtil.newURI(scriptFile).spec);
////////////////////////////////////////////////////////////////////////////////
//// Termination
var tailFile = do_get_file("tail.js");
Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec);

View File

@ -564,9 +564,3 @@ add_task(function* test_DownloadSummary_notifications()
yield download.start();
do_check_true(receivedOnSummaryChanged);
});
////////////////////////////////////////////////////////////////////////////////
//// Termination
var tailFile = do_get_file("tail.js");
Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec);

View File

@ -305,9 +305,3 @@ add_task(function* test_save_reload_unknownProperties()
do_check_eq(itemsForLoad[2].saver._unknownProperties.saver2,
"download3saver2");
});
////////////////////////////////////////////////////////////////////////////////
//// Termination
var tailFile = do_get_file("tail.js");
Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec);

View File

@ -193,9 +193,3 @@ add_task(function* test_getTemporaryDownloadsDirectory()
let downloadDir = yield Downloads.getTemporaryDownloadsDirectory();
do_check_neq(downloadDir, "");
});
////////////////////////////////////////////////////////////////////////////////
//// Termination
var tailFile = do_get_file("tail.js");
Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec);

View File

@ -22,11 +22,3 @@ add_task(function* test_private_temp() {
// 488 is the decimal value of 0700.
equal(targetFile.parent.permissions, 448);
});
////////////////////////////////////////////////////////////////////////////////
//// Termination
var tailFile = do_get_file("tail.js");
Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec);

View File

@ -7,7 +7,6 @@ skip-if = toolkit == 'android' || toolkit == 'gonk'
# the "add_test_task" function, that does not work properly in tail files.
support-files =
common_test_Download.js
tail.js
[test_DownloadCore.js]
[test_DownloadImport.js]