зеркало из https://github.com/mozilla/gecko-dev.git
Bug 773161 - Intermittent browser_gcli_addon.js | Test timed out. r=jwalker
This commit is contained in:
Родитель
1ced5033ce
Коммит
5a63936a11
|
@ -4,7 +4,7 @@
|
|||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
let EXPORTED_SYMBOLS = [ ];
|
||||
let EXPORTED_SYMBOLS = [ "Flags" ];
|
||||
|
||||
Cu.import("resource:///modules/devtools/gcli.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
@ -13,6 +13,12 @@ Cu.import("resource://gre/modules/Services.jsm");
|
|||
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
|
||||
"resource://gre/modules/AddonManager.jsm");
|
||||
|
||||
// We need to use an object in which to store any flags because a primitive
|
||||
// would remain undefined.
|
||||
let Flags = {
|
||||
addonsLoaded: false
|
||||
};
|
||||
|
||||
/**
|
||||
* 'addon' command.
|
||||
*/
|
||||
|
@ -286,5 +292,6 @@ AddonManager.getAllAddons(function addonAsync(aAddons) {
|
|||
return promise;
|
||||
}
|
||||
});
|
||||
Flags.addonsLoaded = true;
|
||||
Services.obs.notifyObservers(null, "gcli_addon_commands_ready", null);
|
||||
});
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
// Tests that the addon commands works as they should
|
||||
|
||||
let imported = {};
|
||||
Components.utils.import("resource:///modules/devtools/CmdAddon.jsm", imported);
|
||||
|
||||
function test() {
|
||||
DeveloperToolbarTest.test("about:blank", [ GAT_test ]);
|
||||
}
|
||||
|
@ -10,6 +13,7 @@ function test() {
|
|||
function GAT_test() {
|
||||
var GAT_ready = DeveloperToolbarTest.checkCalled(function() {
|
||||
Services.obs.removeObserver(GAT_ready, "gcli_addon_commands_ready", false);
|
||||
info("gcli_addon_commands_ready notification received, running tests");
|
||||
|
||||
helpers.setInput('addon list dictionary');
|
||||
helpers.check({
|
||||
|
@ -91,4 +95,14 @@ function GAT_test() {
|
|||
});
|
||||
|
||||
Services.obs.addObserver(GAT_ready, "gcli_addon_commands_ready", false);
|
||||
|
||||
if (imported.Flags.addonsLoaded) {
|
||||
info("The getAllAddons command has already completed and we have missed ");
|
||||
info("the notification. Let's send the gcli_addon_commands_ready ");
|
||||
info("notification ourselves.");
|
||||
|
||||
Services.obs.notifyObservers(null, "gcli_addon_commands_ready", null);
|
||||
} else {
|
||||
info("gcli_addon_commands_ready notification has not yet been received.");
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче