toolkit/content/tests/unit/test_updateChannelModule.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 Components.utils.import("resource://gre/modules/Preferences.jsm");
     7 Components.utils.import("resource://gre/modules/UpdateChannel.jsm");
     9 const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
    10 const TEST_CHANNEL            = "TestChannel";
    11 const PREF_PARTNER_A          = "app.partner.test_partner_a";
    12 const TEST_PARTNER_A          = "TestPartnerA";
    13 const PREF_PARTNER_B          = "app.partner.test_partner_b";
    14 const TEST_PARTNER_B          = "TestPartnerB";
    16 function test_get() {
    17   let defaultPrefs = new Preferences({ defaultBranch: true });
    18   let currentChannel = defaultPrefs.get(PREF_APP_UPDATE_CHANNEL);
    20   do_check_eq(UpdateChannel.get(), currentChannel);
    21   do_check_eq(UpdateChannel.get(false), currentChannel);
    23   defaultPrefs.set(PREF_APP_UPDATE_CHANNEL, TEST_CHANNEL);
    24   do_check_eq(UpdateChannel.get(), TEST_CHANNEL);
    25   do_check_eq(UpdateChannel.get(false), TEST_CHANNEL);
    27   defaultPrefs.set(PREF_PARTNER_A, TEST_PARTNER_A);
    28   defaultPrefs.set(PREF_PARTNER_B, TEST_PARTNER_B);
    29   do_check_eq(UpdateChannel.get(),
    30               TEST_CHANNEL + "-cck-" + TEST_PARTNER_A + "-" + TEST_PARTNER_B);
    31   do_check_eq(UpdateChannel.get(false), TEST_CHANNEL);
    32 }
    34 function run_test() {
    35   test_get();
    36 }

mercurial