Bug 811012 - Allow forceAuthentication parameter to request for whitelisted Marketplace. r=benadida

This commit is contained in:
Jed Parsons 2012-11-17 08:19:38 -05:00
parent 05b70aeba2
commit 81fbf53a81
3 changed files with 43 additions and 1 deletions

View File

@ -205,7 +205,7 @@ function test_options_pass_through() {
// objects and their parameters as they are passed back and forth.
let randomMixedParams = {
loggedInUser: "juanita@mozilla.com",
pie: 42,
forceAuthentication: true,
someThing: {
name: "Pertelote",
legs: 4,

View File

@ -61,6 +61,25 @@ function test_request() {
MinimalIDService.RP.request(mockedDoc.id, {});
}
/*
* Test that the forceAuthentication flag can be sent
*/
function test_request_forceAuthentication() {
do_test_pending();
let mockedDoc = mock_doc(null, TEST_URL);
makeObserver("identity-controller-request", function (aSubject, aTopic, aData) {
do_check_eq(aSubject.wrappedJSObject.id, mockedDoc.id);
do_check_eq(aSubject.wrappedJSObject.origin, TEST_URL);
do_check_eq(aSubject.wrappedJSObject.forceAuthentication, true);
do_test_finished();
run_next_test();
});
MinimalIDService.RP.watch(mockedDoc);
MinimalIDService.RP.request(mockedDoc.id, {forceAuthentication: true});
}
/*
* Test that the "identity-controller-logout" signal is emitted correctly
*/
@ -83,6 +102,7 @@ let TESTS = [
test_mock_doc,
test_watch,
test_request,
test_request_forceAuthentication,
test_logout
];

View File

@ -155,6 +155,27 @@ function test_request() {
RelyingParty.request(mockedDoc.id, {});
}
/*
* ensure the forceAuthentication param can be passed through
*/
function test_request_forceAuthentication() {
do_test_pending();
let mockedDoc = mock_doc(null, TEST_URL, function(action, params) {});
RelyingParty.watch(mockedDoc);
makeObserver("identity-request", function(aSubject, aTopic, aData) {
dump("teh obj is " + JSON.stringify(aSubject.wrappedJSObject) + "\n");
do_check_eq(aSubject.wrappedJSObject.rpId, mockedDoc.id);
do_check_eq(aSubject.wrappedJSObject.forceAuthentication, true);
do_test_finished();
run_next_test();
});
RelyingParty.request(mockedDoc.id, {forceAuthentication: true});
}
function test_logout() {
do_test_pending();
@ -204,6 +225,7 @@ let TESTS = [
test_watch_notloggedin_ready,
test_watch_notloggedin_logout,
test_request,
test_request_forceAuthentication,
test_logout
];