зеркало из https://github.com/mozilla/pjs.git
Bug 443367: Remove timeout and network access from unit test. r=robstrong
This commit is contained in:
Родитель
0a196c3dd2
Коммит
bdbf9ccc7c
|
@ -36,6 +36,9 @@
|
|||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
// Use the internal webserver for regular update pings
|
||||
gPrefs.setCharPref("extensions.update.url", "http://localhost:4444/");
|
||||
|
||||
const checkListener = {
|
||||
_onUpdateStartedCalled: false,
|
||||
_onUpdateEndedCalled: false,
|
||||
|
@ -50,6 +53,7 @@ const checkListener = {
|
|||
// nsIAddonUpdateCheckListener
|
||||
onUpdateEnded: function onUpdateEnded() {
|
||||
this._onUpdateEndedCalled = true;
|
||||
run_test_pt2();
|
||||
},
|
||||
|
||||
// nsIAddonUpdateCheckListener
|
||||
|
@ -63,16 +67,23 @@ const checkListener = {
|
|||
}
|
||||
}
|
||||
|
||||
// Get the HTTP server.
|
||||
do_import_script("netwerk/test/httpserver/httpd.js");
|
||||
var testserver;
|
||||
|
||||
/**
|
||||
* Run the test.
|
||||
*/
|
||||
function run_test() {
|
||||
// Start the http server. Will return empty update info but that's ok
|
||||
testserver = new nsHttpServer();
|
||||
testserver.start(4444);
|
||||
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "5", "1.9");
|
||||
startupEM();
|
||||
const Ci = Components.interfaces;
|
||||
gEM.update([], 0, Ci.nsIExtensionManager.UPDATE_SYNC_COMPATIBILITY, checkListener);
|
||||
do_test_pending();
|
||||
do_timeout(5000, "run_test_pt2()");
|
||||
}
|
||||
|
||||
function run_test_pt2() {
|
||||
|
@ -81,5 +92,6 @@ function run_test_pt2() {
|
|||
dump("Checking onUpdateEnded\n");
|
||||
do_check_true(checkListener._onUpdateEndedCalled);
|
||||
do_check_eq(checkListener._onAddonUpdateStartedCount, checkListener._onAddonUpdateEndedCount);
|
||||
testserver.stop();
|
||||
do_test_finished();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче