mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-08 12:19:05 +02:00
MozReview-Commit-ID: 2rMDwrZTTpG --HG-- rename : toolkit/components/social/SocialService.jsm => browser/modules/SocialService.jsm rename : toolkit/components/social/test/xpcshell/test_SocialService.js => browser/modules/test/unit/social/test_SocialService.js rename : toolkit/components/social/test/xpcshell/test_SocialServiceMigration21.js => browser/modules/test/unit/social/test_SocialServiceMigration21.js rename : toolkit/components/social/test/xpcshell/test_SocialServiceMigration22.js => browser/modules/test/unit/social/test_SocialServiceMigration22.js rename : toolkit/components/social/test/xpcshell/test_SocialServiceMigration29.js => browser/modules/test/unit/social/test_SocialServiceMigration29.js
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
function run_test() {
|
|
// we are testing worker startup specifically
|
|
do_test_pending();
|
|
add_test(testStartupEnabled);
|
|
add_test(testDisableAfterStartup);
|
|
do_initialize_social(true, run_next_test);
|
|
}
|
|
|
|
function testStartupEnabled() {
|
|
// wait on startup before continuing
|
|
do_check_eq(Social.providers.length, 2, "two social providers enabled");
|
|
do_check_true(Social.providers[0].enabled, "provider 0 is enabled");
|
|
do_check_true(Social.providers[1].enabled, "provider 1 is enabled");
|
|
run_next_test();
|
|
}
|
|
|
|
function testDisableAfterStartup() {
|
|
let SocialService = Cu.import("resource:///modules/SocialService.jsm", {}).SocialService;
|
|
SocialService.disableProvider(Social.providers[0].origin, function() {
|
|
do_wait_observer("social:providers-changed", function() {
|
|
do_check_eq(Social.enabled, false, "Social is disabled");
|
|
do_check_eq(Social.providers.length, 0, "no social providers available");
|
|
do_test_finished();
|
|
run_next_test();
|
|
});
|
|
SocialService.disableProvider(Social.providers[0].origin)
|
|
});
|
|
}
|