summaryrefslogtreecommitdiffstats
path: root/toolkit/identity/tests/unit/test_minimalidentity.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-25 15:07:00 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:55:19 +0200
commiteb70e6e3d0bff11c25f14b1196025791bf2308fb (patch)
tree5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/identity/tests/unit/test_minimalidentity.js
parent32ead795290b3399d56b4708fc75b77d296f6a1a (diff)
downloadUXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/identity/tests/unit/test_minimalidentity.js')
-rw-r--r--toolkit/identity/tests/unit/test_minimalidentity.js223
1 files changed, 0 insertions, 223 deletions
diff --git a/toolkit/identity/tests/unit/test_minimalidentity.js b/toolkit/identity/tests/unit/test_minimalidentity.js
deleted file mode 100644
index 77c30c84f..000000000
--- a/toolkit/identity/tests/unit/test_minimalidentity.js
+++ /dev/null
@@ -1,223 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-XPCOMUtils.defineLazyModuleGetter(this, "MinimalIDService",
- "resource://gre/modules/identity/MinimalIdentity.jsm",
- "IdentityService");
-
-Cu.import("resource://gre/modules/identity/LogUtils.jsm");
-Cu.import("resource://gre/modules/DOMIdentity.jsm");
-
-function log(...aMessageArgs) {
- Logger.log.apply(Logger, ["test_minimalidentity"].concat(aMessageArgs));
-}
-
-function test_overall() {
- do_check_neq(MinimalIDService, null);
- run_next_test();
-}
-
-function test_mock_doc() {
- do_test_pending();
- let mockedDoc = mock_doc(null, TEST_URL, function(action, params) {
- do_check_eq(action, 'coffee');
- do_test_finished();
- run_next_test();
- });
-
- mockedDoc.doCoffee();
-}
-
-/*
- * Test that the "identity-controller-watch" signal is emitted correctly
- */
-function test_watch() {
- do_test_pending();
-
- let mockedDoc = mock_doc(null, TEST_URL);
- makeObserver("identity-controller-watch", function (aSubject, aTopic, aData) {
- do_check_eq(aSubject.wrappedJSObject.id, mockedDoc.id);
- do_check_eq(aSubject.wrappedJSObject.origin, TEST_URL);
- do_test_finished();
- run_next_test();
- });
-
- MinimalIDService.RP.watch(mockedDoc);
-}
-
-/*
- * Test that the "identity-controller-request" signal is emitted correctly
- */
-function test_request() {
- 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_test_finished();
- run_next_test();
- });
-
- MinimalIDService.RP.watch(mockedDoc);
- 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 issuer can be forced
- */
-function test_request_forceIssuer() {
- 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.issuer, "https://jed.gov");
- do_test_finished();
- run_next_test();
- });
-
- MinimalIDService.RP.watch(mockedDoc);
- MinimalIDService.RP.request(mockedDoc.id, {issuer: "https://jed.gov"});
-}
-
-/*
- * Test that the "identity-controller-logout" signal is emitted correctly
- */
-function test_logout() {
- do_test_pending();
-
- let mockedDoc = mock_doc(null, TEST_URL);
- makeObserver("identity-controller-logout", function (aSubject, aTopic, aData) {
- do_check_eq(aSubject.wrappedJSObject.id, mockedDoc.id);
- do_test_finished();
- run_next_test();
- });
-
- MinimalIDService.RP.watch(mockedDoc);
- MinimalIDService.RP.logout(mockedDoc.id, {});
-}
-
-/*
- * Test that logout() before watch() fails gently
- */
-
-function test_logoutBeforeWatch() {
- do_test_pending();
-
- let mockedDoc = mock_doc(null, TEST_URL);
- makeObserver("identity-controller-logout", function() {
- do_throw("How can we logout when watch was not called?");
- });
-
- MinimalIDService.RP.logout(mockedDoc.id, {});
- do_test_finished();
- run_next_test();
-}
-
-/*
- * Test that request() before watch() fails gently
- */
-
-function test_requestBeforeWatch() {
- do_test_pending();
-
- let mockedDoc = mock_doc(null, TEST_URL);
- makeObserver("identity-controller-request", function() {
- do_throw("How can we request when watch was not called?");
- });
-
- MinimalIDService.RP.request(mockedDoc.id, {});
- do_test_finished();
- run_next_test();
-}
-
-/*
- * Test that internal unwatch() before watch() fails gently
- */
-
-function test_unwatchBeforeWatch() {
- do_test_pending();
-
- let mockedDoc = mock_doc(null, TEST_URL);
-
- MinimalIDService.RP.unwatch(mockedDoc.id, {});
- do_test_finished();
- run_next_test();
-}
-
-/*
- * Test that the RP flow is cleaned up on child process shutdown
- */
-
-function test_childProcessShutdown() {
- do_test_pending();
- let UNIQUE_MESSAGE_MANAGER = "i am a beautiful snowflake";
- let initialRPCount = Object.keys(MinimalIDService.RP._rpFlows).length;
-
- let mockedDoc = mock_doc(null, TEST_URL, (action, params) => {
- if (action == "child-process-shutdown") {
- // since there's no actual dom window connection, we have to
- // do this bit manually here.
- MinimalIDService.RP.childProcessShutdown(UNIQUE_MESSAGE_MANAGER);
- }
- });
- mockedDoc._mm = UNIQUE_MESSAGE_MANAGER;
-
- makeObserver("identity-controller-watch", function (aSubject, aTopic, aData) {
- DOMIdentity._childProcessShutdown(UNIQUE_MESSAGE_MANAGER);
- });
-
- makeObserver("identity-child-process-shutdown", (aTopic, aSubject, aData) => {
- do_check_eq(Object.keys(MinimalIDService.RP._rpFlows).length, initialRPCount);
- do_test_finished();
- run_next_test();
- });
-
- // fake a dom window context
- DOMIdentity.newContext(mockedDoc, UNIQUE_MESSAGE_MANAGER);
-
- MinimalIDService.RP.watch(mockedDoc);
-}
-
-var TESTS = [
- test_overall,
- test_mock_doc,
- test_watch,
- test_request,
- test_request_forceAuthentication,
- test_request_forceIssuer,
- test_logout,
- test_logoutBeforeWatch,
- test_requestBeforeWatch,
- test_unwatchBeforeWatch,
- test_childProcessShutdown,
-];
-
-TESTS.forEach(add_test);
-
-function run_test() {
- run_next_test();
-}