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