michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: var cps = new ContentPrefInstance(null); michael@0: var uri = ContentPrefTest.getURI("http://www.example.com/"); michael@0: michael@0: function run_test() { michael@0: do_test_pending(); michael@0: michael@0: cps.setPref(uri, "asynctest", "pie"); michael@0: do_check_eq(cps.getPref(uri, "asynctest"), "pie"); michael@0: michael@0: cps.getPref(uri, "asynctest", function(aValue) { michael@0: do_check_eq(aValue, "pie"); michael@0: testCallbackObj(); michael@0: }); michael@0: } michael@0: michael@0: function testCallbackObj() { michael@0: cps.getPref(uri, "asynctest", { michael@0: onResult: function(aValue) { michael@0: do_check_eq(aValue, "pie"); michael@0: cps.removePref(uri, "asynctest"); michael@0: testNoResult(); michael@0: } michael@0: }); michael@0: } michael@0: michael@0: function testNoResult() { michael@0: cps.getPref(uri, "asynctest", function(aValue) { michael@0: do_check_eq(aValue, undefined); michael@0: do_test_finished(); michael@0: }); michael@0: }