michael@0: // -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*- 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: michael@0: "use strict"; michael@0: michael@0: /*============================================================================= michael@0: Test cases michael@0: =============================================================================*/ michael@0: michael@0: function test() { michael@0: runTests(); michael@0: } michael@0: michael@0: function setUp() { michael@0: yield addTab("about:blank"); michael@0: } michael@0: michael@0: function testState(aState) { michael@0: let bcastValue = document.getElementById("bcast_preciseInput").getAttribute("input"); michael@0: is(bcastValue, aState, "bcast attribute is " + aState); michael@0: michael@0: if (aState == "precise") { michael@0: ok(InputSourceHelper.isPrecise, "InputSourceHelper"); michael@0: let uri = Util.makeURI("chrome://browser/content/cursor.css"); michael@0: ok(!StyleSheetSvc.sheetRegistered(uri, Ci.nsIStyleSheetService.AGENT_SHEET), "cursor stylesheet registered"); michael@0: } else { michael@0: ok(!InputSourceHelper.isPrecise, "InputSourceHelper"); michael@0: let uri = Util.makeURI("chrome://browser/content/cursor.css"); michael@0: ok(StyleSheetSvc.sheetRegistered(uri, Ci.nsIStyleSheetService.AGENT_SHEET), "cursor stylesheet registered"); michael@0: } michael@0: } michael@0: michael@0: michael@0: gTests.push({ michael@0: desc: "precise/imprecise input switcher", michael@0: setUp: setUp, michael@0: run: function () { michael@0: notifyPrecise(); michael@0: testState("precise"); michael@0: notifyImprecise(); michael@0: testState("imprecise"); michael@0: notifyPrecise(); michael@0: testState("precise"); michael@0: notifyImprecise(); michael@0: testState("imprecise"); michael@0: } michael@0: }); michael@0: