From 81fbf53a81f5063002ba165f445fac6ec019a05d Mon Sep 17 00:00:00 2001 From: Jed Parsons Date: Sat, 17 Nov 2012 08:19:38 -0500 Subject: [PATCH] Bug 811012 - Allow forceAuthentication parameter to request for whitelisted Marketplace. r=benadida --- .../test/unit/test_signintowebsite.js | 2 +- .../tests/unit/test_minimalidentity.js | 20 +++++++++++++++++ .../identity/tests/unit/test_relying_party.js | 22 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/b2g/components/test/unit/test_signintowebsite.js b/b2g/components/test/unit/test_signintowebsite.js index ca87a72dcd7..530b5e26e85 100644 --- a/b2g/components/test/unit/test_signintowebsite.js +++ b/b2g/components/test/unit/test_signintowebsite.js @@ -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, diff --git a/toolkit/identity/tests/unit/test_minimalidentity.js b/toolkit/identity/tests/unit/test_minimalidentity.js index 353e3bc5f88..5454e3a8ab1 100644 --- a/toolkit/identity/tests/unit/test_minimalidentity.js +++ b/toolkit/identity/tests/unit/test_minimalidentity.js @@ -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 ]; diff --git a/toolkit/identity/tests/unit/test_relying_party.js b/toolkit/identity/tests/unit/test_relying_party.js index f93ac3c4f73..37c261da6cc 100644 --- a/toolkit/identity/tests/unit/test_relying_party.js +++ b/toolkit/identity/tests/unit/test_relying_party.js @@ -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 ];