|
1 // -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*- |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 "use strict"; |
|
7 |
|
8 /*============================================================================= |
|
9 Test cases |
|
10 =============================================================================*/ |
|
11 |
|
12 function test() { |
|
13 runTests(); |
|
14 } |
|
15 |
|
16 function setUp() { |
|
17 yield addTab("about:blank"); |
|
18 } |
|
19 |
|
20 function testState(aState) { |
|
21 let bcastValue = document.getElementById("bcast_preciseInput").getAttribute("input"); |
|
22 is(bcastValue, aState, "bcast attribute is " + aState); |
|
23 |
|
24 if (aState == "precise") { |
|
25 ok(InputSourceHelper.isPrecise, "InputSourceHelper"); |
|
26 let uri = Util.makeURI("chrome://browser/content/cursor.css"); |
|
27 ok(!StyleSheetSvc.sheetRegistered(uri, Ci.nsIStyleSheetService.AGENT_SHEET), "cursor stylesheet registered"); |
|
28 } else { |
|
29 ok(!InputSourceHelper.isPrecise, "InputSourceHelper"); |
|
30 let uri = Util.makeURI("chrome://browser/content/cursor.css"); |
|
31 ok(StyleSheetSvc.sheetRegistered(uri, Ci.nsIStyleSheetService.AGENT_SHEET), "cursor stylesheet registered"); |
|
32 } |
|
33 } |
|
34 |
|
35 |
|
36 gTests.push({ |
|
37 desc: "precise/imprecise input switcher", |
|
38 setUp: setUp, |
|
39 run: function () { |
|
40 notifyPrecise(); |
|
41 testState("precise"); |
|
42 notifyImprecise(); |
|
43 testState("imprecise"); |
|
44 notifyPrecise(); |
|
45 testState("precise"); |
|
46 notifyImprecise(); |
|
47 testState("imprecise"); |
|
48 } |
|
49 }); |
|
50 |