• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4
5[
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                }
76              }
77            ]
78          }
79        ]
80      },
81      {
82        "name": "notifyFail",
83        "type": "function",
84        "description": "Notifies the browser process that test code running in the extension failed.  This is only used for internal unit testing.",
85        "parameters": [
86          {"type": "string", "name": "message"}
87        ]
88      },
89      {
90        "name": "notifyPass",
91        "type": "function",
92        "description": "Notifies the browser process that test code running in the extension passed.  This is only used for internal unit testing.",
93        "parameters": [
94          {"type": "string", "name": "message", "optional": true}
95        ]
96      },
97      {
98        "name": "resetQuota",
99        "type": "function",
100        "description": "Resets all accumulated quota state for all extensions.  This is only used for internal unit testing.",
101        "parameters": []
102      },
103      {
104        "name": "log",
105        "type": "function",
106        "description": "Logs a message during internal unit testing.",
107        "parameters": [
108          {"type": "string", "name": "message"}
109        ]
110      },
111      {
112        "name": "sendMessage",
113        "type": "function",
114        "description": "Sends a string message to the browser process, generating a Notification that C++ test code can wait for.",
115        "parameters": [
116          {"type": "string", "name": "message"},
117          {
118            "type": "function",
119            "name": "callback",
120            "optional": true,
121            "parameters": [
122              {"type": "string", "name": "response"}
123            ]
124          }
125        ]
126      },
127      {
128        "name": "callbackAdded",
129        "type": "function",
130        "nocompile": true,
131        "parameters": []
132      },
133      {
134        "name": "runNextTest",
135        "type": "function",
136        "nocompile": true,
137        "parameters": []
138      },
139      {
140        "name": "fail",
141        "type": "function",
142        "nocompile": true,
143        "parameters": [
144          {"type": "any", "name": "message", "optional": true}
145        ]
146      },
147      {
148        "name": "succeed",
149        "type": "function",
150        "nocompile": true,
151        "parameters": [
152          {"type": "any", "name": "message", "optional": true}
153        ]
154      },
155      {
156        "name": "assertTrue",
157        "type": "function",
158        "nocompile": true,
159        "parameters": [
160          {
161            "name": "test",
162            "choices": [
163              {"type": "string"},
164              {"type": "boolean"}
165            ]
166          },
167          {"type": "string", "name": "message", "optional": true}
168        ]
169      },
170      {
171        "name": "assertFalse",
172        "type": "function",
173        "nocompile": true,
174        "parameters": [
175          {
176            "name": "test",
177            "choices": [
178              {"type": "string"},
179              {"type": "boolean"}
180            ]
181          },
182          {"type": "string", "name": "message", "optional": true}
183        ]
184      },
185      {
186        "name": "assertBool",
187        "type": "function",
188        "nocompile": true,
189        "parameters": [
190          {
191            "name": "test",
192            "choices": [
193              {"type": "string"},
194              {"type": "boolean"}
195            ]
196          },
197          {"type": "boolean", "name": "expected"},
198          {"type": "string", "name": "message", "optional": true}
199        ]
200      },
201      {
202        "name": "checkDeepEq",
203        "type": "function",
204        "nocompile": true,
205        "allowAmbiguousOptionalArguments": true,
206        "parameters": [
207          // These need to be optional because they can be null.
208          {"type": "any", "name": "expected", "optional": true},
209          {"type": "any", "name": "actual", "optional": true}
210        ]
211      },
212      {
213        "name": "assertEq",
214        "type": "function",
215        "nocompile": true,
216        "allowAmbiguousOptionalArguments": true,
217        "parameters": [
218          // These need to be optional because they can be null.
219          {"type": "any", "name": "expected", "optional": true},
220          {"type": "any", "name": "actual", "optional": true},
221          {"type": "string", "name": "message", "optional": true}
222        ]
223      },
224      {
225        "name": "assertNoLastError",
226        "type": "function",
227        "nocompile": true,
228        "parameters": []
229      },
230      {
231        "name": "assertLastError",
232        "type": "function",
233        "nocompile": true,
234        "parameters": [
235          {"type": "string", "name": "expectedError"}
236        ]
237      },
238      {
239        "name": "assertThrows",
240        "type": "function",
241        "nocompile": true,
242        "parameters": [
243          {"type": "function", "name": "fn"},
244          {
245            "type": "object",
246            "name": "self",
247            "additionalProperties": {"type": "any"},
248            "optional": true
249          },
250          {"type": "array", "items": {"type": "any"}, "name": "args"},
251          {"choices": [ {"type": "string"}, {"type": "object", "isInstanceOf": "RegExp"} ], "name": "message", "optional": true}
252        ]
253      },
254      {
255        "name": "callback",
256        "type": "function",
257        "nocompile": true,
258        "parameters": [
259          {"type": "function", "name": "func", "optional": true},
260          {"type": "string", "name": "expectedError", "optional": true}
261        ]
262      },
263      {
264        "name": "listenOnce",
265        "type": "function",
266        "nocompile": true,
267        "parameters": [
268          // TODO(cduvall): Make this a $ref to events.Event.
269          {"type": "any", "name": "event"},
270          {"type": "function", "name": "func"}
271        ]
272      },
273      {
274        "name": "listenForever",
275        "type": "function",
276        "nocompile": true,
277        "parameters": [
278          // TODO(cduvall): Make this a $ref to events.Event.
279          {"type": "any", "name": "event"},
280          {"type": "function", "name": "func"}
281        ]
282      },
283      {
284        "name": "callbackPass",
285        "type": "function",
286        "nocompile": true,
287        "parameters": [
288          {"type": "function", "name": "func", "optional": true}
289        ]
290      },
291      {
292        "name": "callbackFail",
293        "type": "function",
294        "nocompile": true,
295        "parameters": [
296          {"type": "string", "name": "expectedError"},
297          {"type": "function", "name": "func", "optional": true}
298        ]
299      },
300      {
301        "name": "runTests",
302        "type": "function",
303        "nocompile": true,
304        "parameters": [
305          {
306            "type": "array",
307            "name": "tests",
308            "items": {"type": "function"}
309          }
310        ]
311      },
312      {
313        "name": "getApiFeatures",
314        "type": "function",
315        "nocompile": true,
316        "parameters": []
317      },
318      {
319        "name": "getApiDefinitions",
320        "type": "function",
321        "nocompile": true,
322        "parameters": [
323          {
324            "type": "array",
325            "name": "apiNames",
326            "optional": true,
327            "items": {"type": "string"}
328          }
329        ]
330      },
331      {
332        "name": "isProcessingUserGesture",
333        "type": "function",
334        "nocompile": true,
335        "parameters": []
336      },
337      {
338        "name": "runWithUserGesture",
339        "type": "function",
340        "description": "Runs the callback in the context of a user gesture.",
341        "nocompile": true,
342        "parameters": [
343          {
344            "type": "function",
345            "name": "callback",
346            "parameters": []
347          }
348        ]
349      },
350      {
351        "name": "runWithoutUserGesture",
352        "type": "function",
353        "nocompile": true,
354        "parameters": [
355          {
356            "type": "function",
357            "name": "callback",
358            "parameters": []
359          }
360        ]
361      },
362      {
363        "name": "waitForRoundTrip",
364        "type": "function",
365        "description": "Sends a string message one round trip from the renderer to the browser process and back.",
366        "parameters": [
367          {"type": "string", "name": "message"},
368          {
369            "type": "function",
370            "name": "callback",
371            "parameters": [
372              {"type": "string", "name": "message"}
373            ]
374          }
375        ]
376      },
377      {
378        "name": "setExceptionHandler",
379        "type": "function",
380        "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.",
381        "nocompile": true,
382        "parameters": [
383          {
384            "type": "function",
385            "name": "callback",
386            "parameters": [
387              {"type": "string", "name": "message"},
388              {"type": "any", "name": "exception"}
389            ]
390          }
391        ]
392      }
393    ],
394    "events": [
395      {
396        "name": "onMessage",
397        "type": "function",
398        "description": "Used to test sending messages to extensions.",
399        "parameters": [
400          {
401            "type": "object",
402            "name": "info",
403            "properties": {
404              "data": { "type": "string", "description": "Additional information." },
405              "lastMessage": { "type": "boolean", "description": "True if this was the last message for this test" }
406            }
407          }
408        ]
409      }
410    ]
411  }
412]
413