Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: chrome/test/data/extensions/api_test/settings/test.html

Issue 7189029: Implement an initial extension settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: dgrogan comments #2, mihai comments #1 Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <script>
2 chrome.test.runTests([
3 function getWhenEmpty() {
4 function stage3(settings) {
5 chrome.test.assertEq({}, settings);
6 chrome.test.succeed();
7 }
8 function stage2(settings) {
9 chrome.test.assertEq({}, settings);
10 chrome.experimental.settings.get(undefined, stage3);
11 }
12 function stage1(settings) {
13 chrome.test.assertEq({}, settings);
14 chrome.experimental.settings.get(['foo', 'bar'], stage2);
15 }
16 chrome.experimental.settings.get('foo', stage1);
17 },
18
19 function getWhenNonempty() {
20 function stage4(settings) {
21 chrome.test.assertEq({
22 'foo' : 'bar',
23 'baz' : 'qux',
24 'hello': 'world'
25 }, settings);
26 chrome.test.succeed();
27 }
28 function stage3(settings) {
29 chrome.test.assertEq({
30 'baz' : 'qux',
31 'hello': 'world'
32 }, settings);
33 chrome.experimental.settings.get(null, stage4);
34 }
35 function stage2(settings) {
36 chrome.test.assertEq({
37 'foo': 'bar',
38 'baz': 'qux'
39 }, settings);
40 chrome.experimental.settings.get(['nothing', 'baz', 'hello', 'ignore'], st age3);
Matt Perry 2011/06/23 18:11:45 line length
not at google - send to devlin 2011/06/27 08:51:02 Done.
41 }
42 function stage1(settings) {
Matt Perry 2011/06/23 18:11:45 I think you can declare these functions in order.
not at google - send to devlin 2011/06/27 08:51:02 Done.
43 chrome.test.assertEq({
44 'foo' : 'bar',
45 'baz' : 'qux',
46 'hello': 'world'
47 }, settings);
48 chrome.experimental.settings.get(['foo', 'baz'], stage2);
49 }
50 chrome.experimental.settings.set({
51 'foo' : 'bar',
52 'baz' : 'qux',
53 'hello': 'world'
54 }, stage1);
55 },
56
57 function removeWhenEmpty() {
58 function stage2(settings) {
59 chrome.test.assertEq({}, settings);
60 chrome.test.succeed();
61 }
62 function stage1(settings) {
63 chrome.test.assertEq({}, settings);
64 chrome.experimental.settings.remove(['foo', 'bar'], stage2);
65 }
66 chrome.experimental.settings.remove('foo', stage1);
67 },
68
69 function removeWhenNonempty() {
70 function stage7(settings) {
71 chrome.test.assertEq({}, settings);
72 chrome.test.succeed();
73 }
74 function stage6(settings) {
75 chrome.test.assertEq({}, settings);
76 chrome.experimental.settings.get(null, stage7);
77 }
78 function stage5(settings) {
79 chrome.test.assertEq({
80 'hello': 'world'
81 }, settings);
82 chrome.experimental.settings.remove('hello', stage6);
83 }
84 function stage4(settings) {
85 chrome.test.assertEq({}, settings);
86 chrome.experimental.settings.get(null, stage5);
87 }
88 function stage3(settings) {
89 chrome.test.assertEq({
90 'baz' : 'qux',
91 'hello': 'world'
92 }, settings);
93 chrome.experimental.settings.remove(['baz', 'nothing'], stage4);
94 }
95 function stage2(settings) {
96 chrome.test.assertEq({}, settings);
97 chrome.experimental.settings.get(null, stage3);
98 }
99 function stage1(settings) {
100 chrome.test.assertEq({
101 'foo' : 'bar',
102 'baz' : 'qux',
103 'hello': 'world'
104 }, settings);
105 chrome.experimental.settings.remove('foo', stage2);
106 }
107 chrome.experimental.settings.set({
108 'foo' : 'bar',
109 'baz' : 'qux',
110 'hello': 'world'
111 }, stage1);
112 },
113
114 function setWhenOverwriting() {
115 function stage5(settings) {
116 chrome.test.assertEq({
117 'foo' : 'otherBar',
118 'baz' : 'anotherQux',
119 'hello': 'otherWorld',
120 'some' : 'value'
121 }, settings);
122 chrome.test.succeed();
123 }
124 function stage4(settings) {
125 chrome.test.assertEq({
126 'baz' : 'anotherQux',
127 'hello': 'otherWorld',
128 'some' : 'value'
129 }, settings);
130 chrome.experimental.settings.get(null, stage5);
131 }
132 function stage3(settings) {
133 chrome.test.assertEq({
134 'foo' : 'otherBar',
135 'baz' : 'otherQux',
136 'hello': 'world'
137 }, settings);
138 chrome.experimental.settings.set({
139 'baz' : 'anotherQux',
140 'hello': 'otherWorld',
141 'some' : 'value'
142 }, stage4);
143 }
144 function stage2(settings) {
145 chrome.test.assertEq({
146 'foo' : 'otherBar',
147 'baz' : 'otherQux',
148 }, settings);
149 chrome.experimental.settings.get(null, stage3);
150 }
151 function stage1(settings) {
152 chrome.test.assertEq({
153 'foo' : 'bar',
154 'baz' : 'qux',
155 'hello': 'world'
156 }, settings);
157 chrome.experimental.settings.set({
158 'foo' : 'otherBar',
159 'baz' : 'otherQux'
160 }, stage2);
161 }
162 chrome.experimental.settings.set({
163 'foo' : 'bar',
164 'baz' : 'qux',
165 'hello': 'world'
166 }, stage1);
167 },
168
169 function clearWhenEmpty() {
170 function stage2(settings) {
171 chrome.test.assertEq({}, settings);
172 chrome.test.succeed();
173 }
174 function stage1(settings) {
175 chrome.test.assertEq({}, settings);
176 chrome.experimental.settings.get(null, stage2);
177 }
178 chrome.experimental.settings.clear(stage1);
179 },
180
181 function clearWhenNonempty() {
182 function stage3(settings) {
183 chrome.test.assertEq({}, settings);
184 chrome.test.succeed();
185 }
186 function stage2(settings) {
187 chrome.test.assertEq({}, settings);
188 chrome.experimental.settings.get(null, stage3);
189 }
190 function stage1(settings) {
191 chrome.test.assertEq({
192 'foo' : 'bar',
193 'baz' : 'qux',
194 'hello': 'world'
195 }, settings);
196 chrome.experimental.settings.clear(stage2);
197 }
198 chrome.experimental.settings.set({
199 'foo' : 'bar',
200 'baz' : 'qux',
201 'hello': 'world'
202 }, stage1);
203 }
204 ]);
205 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698