|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 // Tests that the pref commands work |
|
5 |
|
6 let prefBranch = Cc["@mozilla.org/preferences-service;1"] |
|
7 .getService(Ci.nsIPrefService).getBranch(null) |
|
8 .QueryInterface(Ci.nsIPrefBranch2); |
|
9 |
|
10 let settings = require("gcli/settings"); |
|
11 |
|
12 const TEST_URI = "data:text/html;charset=utf-8,gcli-pref2"; |
|
13 |
|
14 function test() { |
|
15 return Task.spawn(spawnTest).then(finish, helpers.handleError); |
|
16 } |
|
17 |
|
18 function spawnTest() { |
|
19 let options = yield helpers.openTab(TEST_URI); |
|
20 yield helpers.openToolbar(options); |
|
21 |
|
22 let tabSizeOrig = prefBranch.getIntPref("devtools.editor.tabsize"); |
|
23 info("originally: devtools.editor.tabsize = " + tabSizeOrig); |
|
24 |
|
25 yield helpers.audit(options, [ |
|
26 { |
|
27 setup: 'pref show devtools.editor.tabsize', |
|
28 check: { |
|
29 args: { |
|
30 setting: { value: settings.getSetting("devtools.editor.tabsize") } |
|
31 }, |
|
32 }, |
|
33 exec: { |
|
34 output: "devtools.editor.tabsize: " + tabSizeOrig, |
|
35 }, |
|
36 }, |
|
37 { |
|
38 setup: 'pref set devtools.editor.tabsize 20', |
|
39 check: { |
|
40 args: { |
|
41 setting: { value: settings.getSetting("devtools.editor.tabsize") }, |
|
42 value: { value: 20 } |
|
43 }, |
|
44 }, |
|
45 exec: { |
|
46 output: '', |
|
47 }, |
|
48 post: function() { |
|
49 is(prefBranch.getIntPref("devtools.editor.tabsize"), 20, |
|
50 "devtools.editor.tabsize is 20"); |
|
51 } |
|
52 }, |
|
53 { |
|
54 setup: 'pref show devtools.editor.tabsize', |
|
55 check: { |
|
56 args: { |
|
57 setting: { value: settings.getSetting("devtools.editor.tabsize") } |
|
58 }, |
|
59 }, |
|
60 exec: { |
|
61 output: "devtools.editor.tabsize: 20", |
|
62 } |
|
63 }, |
|
64 { |
|
65 setup: 'pref set devtools.editor.tabsize 1', |
|
66 check: { |
|
67 args: { |
|
68 setting: { value: settings.getSetting("devtools.editor.tabsize") }, |
|
69 value: { value: 1 } |
|
70 }, |
|
71 }, |
|
72 exec: { |
|
73 output: '', |
|
74 }, |
|
75 }, |
|
76 { |
|
77 setup: 'pref show devtools.editor.tabsize', |
|
78 check: { |
|
79 args: { |
|
80 setting: { value: settings.getSetting("devtools.editor.tabsize") } |
|
81 }, |
|
82 }, |
|
83 exec: { |
|
84 output: "devtools.editor.tabsize: 1", |
|
85 }, |
|
86 post: function() { |
|
87 is(prefBranch.getIntPref("devtools.editor.tabsize"), 1, |
|
88 "devtools.editor.tabsize is 1"); |
|
89 } |
|
90 }, |
|
91 ]); |
|
92 |
|
93 prefBranch.setIntPref("devtools.editor.tabsize", tabSizeOrig); |
|
94 |
|
95 yield helpers.closeToolbar(options); |
|
96 yield helpers.closeTab(options); |
|
97 } |