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