mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 608820 - Part 2: Add more logging and convert test to Task. r=Mossop
This commit is contained in:
parent
75dc9bb097
commit
9fee8b4233
@ -98,27 +98,9 @@ function test_confirmation(aWindow, aExpectedURLs) {
|
||||
aWindow.document.documentElement.cancelDialog();
|
||||
}
|
||||
|
||||
add_task(function* test_install_from_file() {
|
||||
gManagerWindow = yield open_manager("addons://list/extension");
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
});
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
is(gSawInstallNotification, true, "Should have seen addon-install-started notification.");
|
||||
|
||||
MockFilePicker.cleanup();
|
||||
close_manager(gManagerWindow, function() {
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
add_test(function() {
|
||||
var filePaths = [
|
||||
get_addon_file_url("browser_bug567127_1.xpi"),
|
||||
get_addon_file_url("browser_bug567127_2.xpi")
|
||||
@ -128,9 +110,24 @@ add_test(function() {
|
||||
Services.obs.addObserver(gInstallNotificationObserver,
|
||||
"addon-install-started", false);
|
||||
|
||||
new WindowOpenListener(INSTALL_URI, function(aWindow) {
|
||||
test_confirmation(aWindow, filePaths.map(function(aPath) aPath.spec));
|
||||
}, run_next_test);
|
||||
// Set handler that executes the core test after the window opens,
|
||||
// and resolves the promise when the window closes
|
||||
let pInstallURIClosed = new Promise((resolve, reject) => {
|
||||
new WindowOpenListener(INSTALL_URI, function(aWindow) {
|
||||
try {
|
||||
test_confirmation(aWindow, filePaths.map(function(aPath) aPath.spec));
|
||||
} catch(e) {
|
||||
reject(e);
|
||||
}
|
||||
}, resolve);
|
||||
});
|
||||
|
||||
gManagerWindow.gViewController.doCommand("cmd_installFromFile");
|
||||
|
||||
yield pInstallURIClosed;
|
||||
|
||||
is(gSawInstallNotification, true, "Should have seen addon-install-started notification.");
|
||||
|
||||
MockFilePicker.cleanup();
|
||||
yield close_manager(gManagerWindow);
|
||||
});
|
||||
|
@ -336,6 +336,7 @@ function open_manager(aView, aCallback, aLoadCallback, aLongerTimeout) {
|
||||
}
|
||||
});
|
||||
|
||||
// The promise resolves with the manager window, so it is passed to the callback
|
||||
return log_callback(p, aCallback);
|
||||
}
|
||||
|
||||
@ -347,13 +348,19 @@ function close_manager(aManagerWindow, aCallback, aLongerTimeout) {
|
||||
is(aManagerWindow.location, MANAGER_URI, "Should be closing window with correct URI");
|
||||
|
||||
aManagerWindow.addEventListener("unload", function() {
|
||||
info("Manager window unloaded");
|
||||
this.removeEventListener("unload", arguments.callee, false);
|
||||
resolve();
|
||||
try {
|
||||
dump("Manager window unload handler");
|
||||
this.removeEventListener("unload", arguments.callee, false);
|
||||
resolve();
|
||||
} catch(e) {
|
||||
reject(e);
|
||||
}
|
||||
}, false);
|
||||
});
|
||||
|
||||
info("Telling manager window to close");
|
||||
aManagerWindow.close();
|
||||
info("Manager window close() call returned");
|
||||
|
||||
return log_callback(p, aCallback);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user