Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / extensions / common / api / test.json
blob594709c61955d424018240fd0440adcb5ee8b448
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6   {
7     "namespace": "test",
8     "description": "none",
9     "functions": [
10       {
11         "name": "getConfig",
12         "type": "function",
13         "description": "Gives configuration options set by the test.",
14         "parameters": [
15           {
16             "type": "function", "name": "callback", "parameters": [
17               {
18                 "type": "object",
19                 "name": "testConfig",
20                 "properties": {
21                   "customArg": {
22                     "type": "string",
23                     "optional": true,
24                     "description": "Additional string argument to pass to test."
25                   },
26                   "ftpServer": {
27                     "type": "object",
28                     "optional": true,
29                     "description": "Details on the FTP server used to mock network responses.  Will be set only if test calls ExtensionApiTest::StartFTPServer().",
30                     "properties": {
31                       "port": {
32                         "type": "integer",
33                         "description": "The port on which the FTP server is listening.",
34                         "minimum": 1024,
35                         "maximum": 65535
36                       }
37                     }
38                   },
39                   "testServer": {
40                     "type": "object",
41                     "optional": true,
42                     "description": "Details on the test server used to mock network responses.  Will be set only if test calls ExtensionApiTest::StartTestServer().",
43                     "properties": {
44                       "port": {
45                         "type": "integer",
46                         "description": "The port on which the test server is listening.",
47                         "minimum": 1024,
48                         "maximum": 65535
49                       }
50                     }
51                   },
52                   "spawnedTestServer": {
53                     "type": "object",
54                     "optional": true,
55                     "description": "Details on the spawned test server used to mock network responses.  Will be set only if test calls ExtensionApiTest::StartSpawnedTestServer().",
56                     "properties": {
57                       "port": {
58                         "type": "integer",
59                         "description": "The port on which the test server is listening.",
60                         "minimum": 1024,
61                         "maximum": 65535
62                       }
63                     }
64                   },
65                   "testDataDirectory": {
66                     "type": "string",
67                     "description": "file:/// URL for the API test data directory."
68                   },
69                   "testWebSocketPort": {
70                     "type": "integer",
71                     "description": "The port on which the test WebSocket server is listening.",
72                     "minimum": 0,
73                     "maximum": 65535
74                   },
75                   "sitePerProcess": {
76                     "type": "boolean",
77                     "description": "Whether or not the site-per-process flag is enabled."
78                   }
79                 }
80               }
81             ]
82           }
83         ]
84       },
85       {
86         "name": "notifyFail",
87         "type": "function",
88         "description": "Notifies the browser process that test code running in the extension failed.  This is only used for internal unit testing.",
89         "parameters": [
90           {"type": "string", "name": "message"}
91         ]
92       },
93       {
94         "name": "notifyPass",
95         "type": "function",
96         "description": "Notifies the browser process that test code running in the extension passed.  This is only used for internal unit testing.",
97         "parameters": [
98           {"type": "string", "name": "message", "optional": true}
99         ]
100       },
101       {
102         "name": "log",
103         "type": "function",
104         "description": "Logs a message during internal unit testing.",
105         "parameters": [
106           {"type": "string", "name": "message"}
107         ]
108       },
109       {
110         "name": "sendMessage",
111         "type": "function",
112         "description": "Sends a string message to the browser process, generating a Notification that C++ test code can wait for.",
113         "parameters": [
114           {"type": "string", "name": "message"},
115           {
116             "type": "function",
117             "name": "callback",
118             "optional": true,
119             "parameters": [
120               {"type": "string", "name": "response"}
121             ]
122           }
123         ]
124       },
125       {
126         "name": "callbackAdded",
127         "type": "function",
128         "nocompile": true,
129         "parameters": []
130       },
131       {
132         "name": "runNextTest",
133         "type": "function",
134         "nocompile": true,
135         "parameters": []
136       },
137       {
138         "name": "fail",
139         "type": "function",
140         "nocompile": true,
141         "parameters": [
142           {"type": "any", "name": "message", "optional": true}
143         ]
144       },
145       {
146         "name": "succeed",
147         "type": "function",
148         "nocompile": true,
149         "parameters": [
150           {"type": "any", "name": "message", "optional": true}
151         ]
152       },
153       {
154         "name": "runWithNativesEnabled",
155         "type": "function",
156         "nocompile": true,
157         "description": "Runs the given function with access to native methods enabled.",
158         "parameters": [
159           {
160             "type": "function",
161             "name": "callback"
162           }
163         ]
164       },
165       {
166         "name": "getModuleSystem",
167         "type": "function",
168         "nocompile": true,
169         "description": "Returns an instance of the module system for the given context.",
170         "parameters": [
171           {
172             "type": "any",
173             "name": "context"
174           }
175         ],
176         "returns": {
177           "type": "any",
178           "description": "The module system",
179           "optional": true
180         }
181       },
182       {
183         "name": "assertTrue",
184         "type": "function",
185         "nocompile": true,
186         "parameters": [
187           {
188             "name": "test",
189             "choices": [
190               {"type": "string"},
191               {"type": "boolean"}
192             ]
193           },
194           {"type": "string", "name": "message", "optional": true}
195         ]
196       },
197       {
198         "name": "assertFalse",
199         "type": "function",
200         "nocompile": true,
201         "parameters": [
202           {
203             "name": "test",
204             "choices": [
205               {"type": "string"},
206               {"type": "boolean"}
207             ]
208           },
209           {"type": "string", "name": "message", "optional": true}
210         ]
211       },
212       {
213         "name": "assertBool",
214         "type": "function",
215         "nocompile": true,
216         "parameters": [
217           {
218             "name": "test",
219             "choices": [
220               {"type": "string"},
221               {"type": "boolean"}
222             ]
223           },
224           {"type": "boolean", "name": "expected"},
225           {"type": "string", "name": "message", "optional": true}
226         ]
227       },
228       {
229         "name": "checkDeepEq",
230         "type": "function",
231         "nocompile": true,
232         "allowAmbiguousOptionalArguments": true,
233         "parameters": [
234           // These need to be optional because they can be null.
235           {"type": "any", "name": "expected", "optional": true},
236           {"type": "any", "name": "actual", "optional": true}
237         ]
238       },
239       {
240         "name": "assertEq",
241         "type": "function",
242         "nocompile": true,
243         "allowAmbiguousOptionalArguments": true,
244         "parameters": [
245           // These need to be optional because they can be null.
246           {"type": "any", "name": "expected", "optional": true},
247           {"type": "any", "name": "actual", "optional": true},
248           {"type": "string", "name": "message", "optional": true}
249         ]
250       },
251       {
252         "name": "assertNoLastError",
253         "type": "function",
254         "nocompile": true,
255         "parameters": []
256       },
257       {
258         "name": "assertLastError",
259         "type": "function",
260         "nocompile": true,
261         "parameters": [
262           {"type": "string", "name": "expectedError"}
263         ]
264       },
265       {
266         "name": "assertThrows",
267         "type": "function",
268         "nocompile": true,
269         "parameters": [
270           {"type": "function", "name": "fn"},
271           {
272             "type": "object",
273             "name": "self",
274             "additionalProperties": {"type": "any"},
275             "optional": true
276           },
277           {"type": "array", "items": {"type": "any"}, "name": "args"},
278           {"choices": [ {"type": "string"}, {"type": "object", "isInstanceOf": "RegExp"} ], "name": "message", "optional": true}
279         ]
280       },
281       {
282         "name": "callback",
283         "type": "function",
284         "nocompile": true,
285         "parameters": [
286           {"type": "function", "name": "func", "optional": true},
287           {"type": "string", "name": "expectedError", "optional": true}
288         ]
289       },
290       {
291         "name": "listenOnce",
292         "type": "function",
293         "nocompile": true,
294         "parameters": [
295           // TODO(cduvall): Make this a $ref to events.Event.
296           {"type": "any", "name": "event"},
297           {"type": "function", "name": "func"}
298         ]
299       },
300       {
301         "name": "listenForever",
302         "type": "function",
303         "nocompile": true,
304         "parameters": [
305           // TODO(cduvall): Make this a $ref to events.Event.
306           {"type": "any", "name": "event"},
307           {"type": "function", "name": "func"}
308         ]
309       },
310       {
311         "name": "callbackPass",
312         "type": "function",
313         "nocompile": true,
314         "parameters": [
315           {"type": "function", "name": "func", "optional": true}
316         ]
317       },
318       {
319         "name": "callbackFail",
320         "type": "function",
321         "nocompile": true,
322         "parameters": [
323           {"type": "string", "name": "expectedError"},
324           {"type": "function", "name": "func", "optional": true}
325         ]
326       },
327       {
328         "name": "runTests",
329         "type": "function",
330         "nocompile": true,
331         "parameters": [
332           {
333             "type": "array",
334             "name": "tests",
335             "items": {"type": "function"}
336           }
337         ]
338       },
339       {
340         "name": "getApiFeatures",
341         "type": "function",
342         "nocompile": true,
343         "parameters": []
344       },
345       {
346         "name": "getApiDefinitions",
347         "type": "function",
348         "nocompile": true,
349         "parameters": [
350           {
351             "type": "array",
352             "name": "apiNames",
353             "optional": true,
354             "items": {"type": "string"}
355           }
356         ]
357       },
358       {
359         "name": "isProcessingUserGesture",
360         "type": "function",
361         "nocompile": true,
362         "parameters": []
363       },
364       {
365         "name": "runWithUserGesture",
366         "type": "function",
367         "description": "Runs the callback in the context of a user gesture.",
368         "nocompile": true,
369         "parameters": [
370           {
371             "type": "function",
372             "name": "callback",
373             "parameters": []
374           }
375         ]
376       },
377       {
378         "name": "runWithoutUserGesture",
379         "type": "function",
380         "nocompile": true,
381         "parameters": [
382           {
383             "type": "function",
384             "name": "callback",
385             "parameters": []
386           }
387         ]
388       },
389       {
390         "name": "waitForRoundTrip",
391         "type": "function",
392         "description": "Sends a string message one round trip from the renderer to the browser process and back.",
393         "parameters": [
394           {"type": "string", "name": "message"},
395           {
396             "type": "function",
397             "name": "callback",
398             "parameters": [
399               {"type": "string", "name": "message"}
400             ]
401           }
402         ]
403       },
404       {
405         "name": "setExceptionHandler",
406         "type": "function",
407         "description": "Sets the function to be called when an exception occurs. By default this is a function which fails the test. This is reset for every test run through $ref:test.runTests.",
408         "nocompile": true,
409         "parameters": [
410           {
411             "type": "function",
412             "name": "callback",
413             "parameters": [
414               {"type": "string", "name": "message"},
415               {"type": "any", "name": "exception"}
416             ]
417           }
418         ]
419       }
420     ],
421     "events": [
422       {
423         "name": "onMessage",
424         "type": "function",
425         "description": "Used to test sending messages to extensions.",
426         "parameters": [
427           {
428             "type": "object",
429             "name": "info",
430             "properties": {
431               "data": { "type": "string", "description": "Additional information." },
432               "lastMessage": { "type": "boolean", "description": "True if this was the last message for this test" }
433             }
434           }
435         ]
436       }
437     ]
438   }