test_prefs_defaults_and_file.js (1142B)
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 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 function run_test() { 6 /* import-globals-from prefs_test_common.js */ 7 load("prefs_test_common.js"); 8 9 check_common_xpcshell_with_prefs(); 10 11 Assert.ok( 12 has_pref_from_manifest_file_section(), 13 "Should have pref set for file in xpcshell-with-prefs.toml" 14 ); 15 16 Assert.equal( 17 Services.prefs.getIntPref("dummy.pref.from.test.file"), 18 2, 19 "Value of pref that was set once at the file in xpcshell-with-prefs.toml" 20 ); 21 22 Assert.equal( 23 Services.prefs.getStringPref("dummy.pref.from.test.duplicate"), 24 "final", 25 "The last pref takes precedence when duplicated" 26 ); 27 28 Assert.equal( 29 Services.prefs.getIntPref("dummy.pref.from.test.manifest"), 30 1337, 31 "File-specific pref takes precedence over manifest defaults" 32 ); 33 34 Assert.equal( 35 Services.prefs.getStringPref("dummy.pref.from.test.ancestor"), 36 "Ancestor", 37 "Pref in manifest defaults without file-specific override should be set" 38 ); 39 }