Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 function run_test() {
6 // we are testing worker startup specifically
7 do_test_pending();
8 add_test(testStartupEnabled);
9 add_test(testDisableAfterStartup);
10 do_initialize_social(true, run_next_test);
11 }
13 function testStartupEnabled() {
14 // wait on startup before continuing
15 do_check_eq(Social.providers.length, 2, "two social providers enabled");
16 do_check_true(Social.providers[0].enabled, "provider 0 is enabled");
17 do_check_true(Social.providers[1].enabled, "provider 1 is enabled");
18 run_next_test();
19 }
21 function testDisableAfterStartup() {
22 let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
23 SocialService.removeProvider(Social.providers[0].origin, function() {
24 do_wait_observer("social:providers-changed", function() {
25 do_check_eq(Social.enabled, false, "Social is disabled");
26 do_check_eq(Social.providers.length, 0, "no social providers available");
27 do_test_finished();
28 run_next_test();
29 });
30 SocialService.removeProvider(Social.providers[0].origin)
31 });
32 }