Im rather new to the Addon SDK and JS so please forgive me if i miss anything obvious.
Im trying to make a Unittest on a Observer, meaning i got an Observer listening for 'Page Load' like this: Listen for Page Load Mozilla SDK.
And the function() called when a page loads returnes 'true' when visiting a specific site, and 'false' if not.
Now im trying to impement a Unittest for this so that the test returnes success when the function() returnes 'true'. The problem is, i see no way to let the Unittest wait for the Observer to trigger.
I got this:
var main = require("../index.js");
exports["testing Page Load"] = function(assert){
assert.ok(main.function(), "success");
}
But this runs the function() directly and not when a page has loaded, but i cant pass the Observer to 'assert.ok()' or any other 'assert.function()'.
I tryed using additional external functions with some Timers and delays but this is all blocking code which just results in a unresponsive browser just doing nothing.
Is there any way to accomblish this? Have searched for a while but cant find anything on this topic.
Thanks!
Aucun commentaire:
Enregistrer un commentaire