Home | History | Annotate | Download | only in api
      1 // Copyright (c) 2012 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                   "testServer": {
     27                     "type": "object",
     28                     "optional": true,
     29                     "description": "Details on the test server used to mock network responses.  Will be set only if test calls ExtensionApiTest::StartTestServer().",
     30                     "properties": {
     31                       "port": {
     32                         "type": "integer",
     33                         "description": "The port on which the test server is listening.",
     34                         "minimum": 1024,
     35                         "maximum": 65535
     36                       }
     37                     }
     38                   },
     39                   "spawnedTestServer": {
     40                     "type": "object",
     41                     "optional": true,
     42                     "description": "Details on the spawned test server used to mock network responses.  Will be set only if test calls ExtensionApiTest::StartSpawnedTestServer().",
     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                   "testDataDirectory": {
     53                     "type": "string",
     54                     "description": "file:/// URL for the API test data directory."
     55                   },
     56                   "testWebSocketPort": {
     57                     "type": "integer",
     58                     "description": "The port on which the test WebSocket server is listening.",
     59                     "minimum": 0,
     60                     "maximum": 65535
     61                   }
     62                 }
     63               }
     64             ]
     65           }
     66         ]
     67       },
     68       {
     69         "name": "notifyFail",
     70         "type": "function",
     71         "description": "Notifies the browser process that test code running in the extension failed.  This is only used for internal unit testing.",
     72         "parameters": [
     73           {"type": "string", "name": "message"}
     74         ]
     75       },
     76       {
     77         "name": "notifyPass",
     78         "type": "function",
     79         "description": "Notifies the browser process that test code running in the extension passed.  This is only used for internal unit testing.",
     80         "parameters": [
     81           {"type": "string", "name": "message", "optional": true}
     82         ]
     83       },
     84       {
     85         "name": "resetQuota",
     86         "type": "function",
     87         "description": "Resets all accumulated quota state for all extensions.  This is only used for internal unit testing.",
     88         "parameters": []
     89       },
     90       {
     91         "name": "log",
     92         "type": "function",
     93         "description": "Logs a message during internal unit testing.",
     94         "parameters": [
     95           {"type": "string", "name": "message"}
     96         ]
     97       },
     98       {
     99         "name": "createIncognitoTab",
    100         "type": "function",
    101         "description": "Creates an incognito tab during internal testing. Succeeds even if the extension is not enabled in incognito mode.",
    102         "parameters": [
    103           {"type": "string", "name": "url"}
    104         ]
    105       },
    106       {
    107         "name": "sendMessage",
    108         "type": "function",
    109         "description": "Sends a string message to the browser process, generating a Notification that C++ test code can wait for.",
    110         "parameters": [
    111           {"type": "string", "name": "message"},
    112           {
    113             "type": "function",
    114             "name": "callback",
    115             "optional": true,
    116             "parameters": [
    117               {"type": "string", "name": "response"}
    118             ]
    119           }
    120         ]
    121       },
    122       {
    123         "name": "callbackAdded",
    124         "type": "function",
    125         "nocompile": true,
    126         "parameters": []
    127       },
    128       {
    129         "name": "runNextTest",
    130         "type": "function",
    131         "nocompile": true,
    132         "parameters": []
    133       },
    134       {
    135         "name": "fail",
    136         "type": "function",
    137         "nocompile": true,
    138         "parameters": [
    139           {"type": "any", "name": "message", "optional": true}
    140         ]
    141       },
    142       {
    143         "name": "succeed",
    144         "type": "function",
    145         "nocompile": true,
    146         "parameters": [
    147           {"type": "any", "name": "message", "optional": true}
    148         ]
    149       },
    150       {
    151         "name": "assertTrue",
    152         "type": "function",
    153         "nocompile": true,
    154         "parameters": [
    155           {
    156             "name": "test",
    157             "choices": [
    158               {"type": "string"},
    159               {"type": "boolean"}
    160             ]
    161           },
    162           {"type": "string", "name": "message", "optional": true}
    163         ]
    164       },
    165       {
    166         "name": "assertFalse",
    167         "type": "function",
    168         "nocompile": true,
    169         "parameters": [
    170           {
    171             "name": "test",
    172             "choices": [
    173               {"type": "string"},
    174               {"type": "boolean"}
    175             ]
    176           },
    177           {"type": "string", "name": "message", "optional": true}
    178         ]
    179       },
    180       {
    181         "name": "assertBool",
    182         "type": "function",
    183         "nocompile": true,
    184         "parameters": [
    185           {
    186             "name": "test",
    187             "choices": [
    188               {"type": "string"},
    189               {"type": "boolean"}
    190             ]
    191           },
    192           {"type": "boolean", "name": "expected"},
    193           {"type": "string", "name": "message", "optional": true}
    194         ]
    195       },
    196       {
    197         "name": "checkDeepEq",
    198         "type": "function",
    199         "nocompile": true,
    200         "allowAmbiguousOptionalArguments": true,
    201         "parameters": [
    202           // These need to be optional because they can be null.
    203           {"type": "any", "name": "expected", "optional": true},
    204           {"type": "any", "name": "actual", "optional": true}
    205         ]
    206       },
    207       {
    208         "name": "assertEq",
    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           {"type": "string", "name": "message", "optional": true}
    217         ]
    218       },
    219       {
    220         "name": "assertNoLastError",
    221         "type": "function",
    222         "nocompile": true,
    223         "parameters": []
    224       },
    225       {
    226         "name": "assertLastError",
    227         "type": "function",
    228         "nocompile": true,
    229         "parameters": [
    230           {"type": "string", "name": "expectedError"}
    231         ]
    232       },
    233       {
    234         "name": "assertThrows",
    235         "type": "function",
    236         "nocompile": true,
    237         "parameters": [
    238           {"type": "function", "name": "fn"},
    239           {
    240             "type": "object",
    241             "name": "self",
    242             "additionalProperties": {"type": "any"},
    243             "optional": true
    244           },
    245           {"type": "array", "items": {"type": "any"}, "name": "args"},
    246           {"choices": [ {"type": "string"}, {"type": "object", "isInstanceOf": "RegExp"} ], "name": "message", "optional": true}
    247         ]
    248       },
    249       {
    250         "name": "callback",
    251         "type": "function",
    252         "nocompile": true,
    253         "parameters": [
    254           {"type": "function", "name": "func", "optional": true},
    255           {"type": "string", "name": "expectedError", "optional": true}
    256         ]
    257       },
    258       {
    259         "name": "listenOnce",
    260         "type": "function",
    261         "nocompile": true,
    262         "parameters": [
    263           // TODO(cduvall): Make this a $ref to events.Event.
    264           {"type": "any", "name": "event"},
    265           {"type": "function", "name": "func"}
    266         ]
    267       },
    268       {
    269         "name": "listenForever",
    270         "type": "function",
    271         "nocompile": true,
    272         "parameters": [
    273           // TODO(cduvall): Make this a $ref to events.Event.
    274           {"type": "any", "name": "event"},
    275           {"type": "function", "name": "func"}
    276         ]
    277       },
    278       {
    279         "name": "callbackPass",
    280         "type": "function",
    281         "nocompile": true,
    282         "parameters": [
    283           {"type": "function", "name": "func", "optional": true}
    284         ]
    285       },
    286       {
    287         "name": "callbackFail",
    288         "type": "function",
    289         "nocompile": true,
    290         "parameters": [
    291           {"type": "string", "name": "expectedError"},
    292           {"type": "function", "name": "func", "optional": true}
    293         ]
    294       },
    295       {
    296         "name": "runTests",
    297         "type": "function",
    298         "nocompile": true,
    299         "parameters": [
    300           {
    301             "type": "array",
    302             "name": "tests",
    303             "items": {"type": "function"}
    304           }
    305         ]
    306       },
    307       {
    308         "name": "getApiFeatures",
    309         "type": "function",
    310         "nocompile": true,
    311         "parameters": []
    312       },
    313       {
    314         "name": "getApiDefinitions",
    315         "type": "function",
    316         "nocompile": true,
    317         "parameters": [
    318           {
    319             "type": "array",
    320             "name": "apiNames",
    321             "optional": true,
    322             "items": {"type": "string"}
    323           }
    324         ]
    325       },
    326       {
    327         "name": "isProcessingUserGesture",
    328         "type": "function",
    329         "nocompile": true,
    330         "parameters": []
    331       },
    332       {
    333         "name": "runWithUserGesture",
    334         "type": "function",
    335         "description": "Runs the callback in the context of a user gesture.",
    336         "nocompile": true,
    337         "parameters": [
    338           {
    339             "type": "function",
    340             "name": "callback",
    341             "parameters": []
    342           }
    343         ]
    344       },
    345       {
    346         "name": "runWithoutUserGesture",
    347         "type": "function",
    348         "nocompile": true,
    349         "parameters": [
    350           {
    351             "type": "function",
    352             "name": "callback",
    353             "parameters": []
    354           }
    355         ]
    356       }
    357     ],
    358     "events": [
    359       {
    360         "name": "onMessage",
    361         "type": "function",
    362         "description": "Used to test sending messages to extensions.",
    363         "parameters": [
    364           {
    365             "type": "object",
    366             "name": "info",
    367             "properties": {
    368               "data": { "type": "string", "description": "Additional information." },
    369               "lastMessage": { "type": "boolean", "description": "True if this was the last message for this test" }
    370             }
    371           }
    372         ]
    373       }
    374     ]
    375   }
    376 ]
    377