Bug 1036198 - rejection not defined in _handleGetAssertionError. r=spenrose

This commit is contained in:
Jed Parsons 2014-07-08 18:00:25 -07:00
parent 86c8e0e5cf
commit 013dc80b0b
2 changed files with 22 additions and 3 deletions

View File

@ -11,8 +11,11 @@ Cu.import("resource://services-common/utils.js");
Cu.import("resource://testing-common/httpd.js");
XPCOMUtils.defineLazyModuleGetter(this, "FxAccountsMgmtService",
"resource://gre/modules/FxAccountsMgmtService.jsm",
"FxAccountsMgmtService");
"resource://gre/modules/FxAccountsMgmtService.jsm",
"FxAccountsMgmtService");
XPCOMUtils.defineLazyModuleGetter(this, "FxAccountsManager",
"resource://gre/modules/FxAccountsManager.jsm");
// At end of test, restore original state
const ORIGINAL_AUTH_URI = Services.prefs.getCharPref("identity.fxaccounts.auth.uri");
@ -158,6 +161,22 @@ add_test(function test_invalidEmailCase_signIn() {
});
});
add_test(function testHandleGetAssertionError_defaultCase() {
do_test_pending();
FxAccountsManager.getAssertion(null).then(
success => {
// getAssertion should throw with invalid audience
ok(false);
},
reason => {
equal("INVALID_AUDIENCE", reason.error);
do_test_finished();
run_next_test();
}
)
});
// End of tests
// Utility functions follow

View File

@ -204,7 +204,7 @@ this.FxAccountsManager = {
}
);
}
return rejection;
return Promise.reject(reason);
},
_getAssertion: function(aAudience) {