toolkit/content/tests/unit/test_updateChannelModule.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial