| // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| [ |
| { |
| "namespace": "test", |
| "description": "none", |
| "functions": [ |
| { |
| "name": "getConfig", |
| "type": "function", |
| "description": "Gives configuration options set by the test.", |
| "parameters": [ |
| { |
| "type": "function", "name": "callback", "parameters": [ |
| { |
| "type": "object", |
| "name": "testConfig", |
| "properties": { |
| "customArg": { |
| "type": "string", |
| "optional": true, |
| "description": "Additional string argument to pass to test." |
| }, |
| "testServer": { |
| "type": "object", |
| "optional": true, |
| "description": "Details on the test server used to mock network responses. Will be set only if test calls ExtensionApiTest::StartTestServer().", |
| "properties": { |
| "port": { |
| "type": "integer", |
| "description": "The port on which the test server is listening.", |
| "minimum": 1024, |
| "maximum": 65535 |
| } |
| } |
| }, |
| "spawnedTestServer": { |
| "type": "object", |
| "optional": true, |
| "description": "Details on the spawned test server used to mock network responses. Will be set only if test calls ExtensionApiTest::StartSpawnedTestServer().", |
| "properties": { |
| "port": { |
| "type": "integer", |
| "description": "The port on which the test server is listening.", |
| "minimum": 1024, |
| "maximum": 65535 |
| } |
| } |
| }, |
| "testDataDirectory": { |
| "type": "string", |
| "description": "file:/// URL for the API test data directory." |
| }, |
| "testWebSocketPort": { |
| "type": "integer", |
| "description": "The port on which the test WebSocket server is listening.", |
| "minimum": 0, |
| "maximum": 65535 |
| } |
| } |
| } |
| ] |
| } |
| ] |
| }, |
| { |
| "name": "notifyFail", |
| "type": "function", |
| "description": "Notifies the browser process that test code running in the extension failed. This is only used for internal unit testing.", |
| "parameters": [ |
| {"type": "string", "name": "message"} |
| ] |
| }, |
| { |
| "name": "notifyPass", |
| "type": "function", |
| "description": "Notifies the browser process that test code running in the extension passed. This is only used for internal unit testing.", |
| "parameters": [ |
| {"type": "string", "name": "message", "optional": true} |
| ] |
| }, |
| { |
| "name": "resetQuota", |
| "type": "function", |
| "description": "Resets all accumulated quota state for all extensions. This is only used for internal unit testing.", |
| "parameters": [] |
| }, |
| { |
| "name": "log", |
| "type": "function", |
| "description": "Logs a message during internal unit testing.", |
| "parameters": [ |
| {"type": "string", "name": "message"} |
| ] |
| }, |
| { |
| "name": "createIncognitoTab", |
| "type": "function", |
| "description": "Creates an incognito tab during internal testing. Succeeds even if the extension is not enabled in incognito mode.", |
| "parameters": [ |
| {"type": "string", "name": "url"} |
| ] |
| }, |
| { |
| "name": "sendMessage", |
| "type": "function", |
| "description": "Sends a string message to the browser process, generating a Notification that C++ test code can wait for.", |
| "parameters": [ |
| {"type": "string", "name": "message"}, |
| { |
| "type": "function", |
| "name": "callback", |
| "optional": true, |
| "parameters": [ |
| {"type": "string", "name": "response"} |
| ] |
| } |
| ] |
| }, |
| { |
| "name": "callbackAdded", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [] |
| }, |
| { |
| "name": "runNextTest", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [] |
| }, |
| { |
| "name": "fail", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| {"type": "any", "name": "message", "optional": true} |
| ] |
| }, |
| { |
| "name": "succeed", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| {"type": "any", "name": "message", "optional": true} |
| ] |
| }, |
| { |
| "name": "assertTrue", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| { |
| "name": "test", |
| "choices": [ |
| {"type": "string"}, |
| {"type": "boolean"} |
| ] |
| }, |
| {"type": "string", "name": "message", "optional": true} |
| ] |
| }, |
| { |
| "name": "assertFalse", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| { |
| "name": "test", |
| "choices": [ |
| {"type": "string"}, |
| {"type": "boolean"} |
| ] |
| }, |
| {"type": "string", "name": "message", "optional": true} |
| ] |
| }, |
| { |
| "name": "assertBool", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| { |
| "name": "test", |
| "choices": [ |
| {"type": "string"}, |
| {"type": "boolean"} |
| ] |
| }, |
| {"type": "boolean", "name": "expected"}, |
| {"type": "string", "name": "message", "optional": true} |
| ] |
| }, |
| { |
| "name": "checkDeepEq", |
| "type": "function", |
| "nocompile": true, |
| "allowAmbiguousOptionalArguments": true, |
| "parameters": [ |
| // These need to be optional because they can be null. |
| {"type": "any", "name": "expected", "optional": true}, |
| {"type": "any", "name": "actual", "optional": true} |
| ] |
| }, |
| { |
| "name": "assertEq", |
| "type": "function", |
| "nocompile": true, |
| "allowAmbiguousOptionalArguments": true, |
| "parameters": [ |
| // These need to be optional because they can be null. |
| {"type": "any", "name": "expected", "optional": true}, |
| {"type": "any", "name": "actual", "optional": true}, |
| {"type": "string", "name": "message", "optional": true} |
| ] |
| }, |
| { |
| "name": "assertNoLastError", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [] |
| }, |
| { |
| "name": "assertLastError", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| {"type": "string", "name": "expectedError"} |
| ] |
| }, |
| { |
| "name": "assertThrows", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| {"type": "function", "name": "fn"}, |
| { |
| "type": "object", |
| "name": "self", |
| "additionalProperties": {"type": "any"}, |
| "optional": true |
| }, |
| {"type": "array", "items": {"type": "any"}, "name": "args"}, |
| {"choices": [ {"type": "string"}, {"type": "object", "isInstanceOf": "RegExp"} ], "name": "message", "optional": true} |
| ] |
| }, |
| { |
| "name": "callback", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| {"type": "function", "name": "func", "optional": true}, |
| {"type": "string", "name": "expectedError", "optional": true} |
| ] |
| }, |
| { |
| "name": "listenOnce", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| // TODO(cduvall): Make this a $ref to events.Event. |
| {"type": "any", "name": "event"}, |
| {"type": "function", "name": "func"} |
| ] |
| }, |
| { |
| "name": "listenForever", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| // TODO(cduvall): Make this a $ref to events.Event. |
| {"type": "any", "name": "event"}, |
| {"type": "function", "name": "func"} |
| ] |
| }, |
| { |
| "name": "callbackPass", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| {"type": "function", "name": "func", "optional": true} |
| ] |
| }, |
| { |
| "name": "callbackFail", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| {"type": "string", "name": "expectedError"}, |
| {"type": "function", "name": "func", "optional": true} |
| ] |
| }, |
| { |
| "name": "runTests", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| { |
| "type": "array", |
| "name": "tests", |
| "items": {"type": "function"} |
| } |
| ] |
| }, |
| { |
| "name": "getApiFeatures", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [] |
| }, |
| { |
| "name": "getApiDefinitions", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| { |
| "type": "array", |
| "name": "apiNames", |
| "optional": true, |
| "items": {"type": "string"} |
| } |
| ] |
| }, |
| { |
| "name": "isProcessingUserGesture", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [] |
| }, |
| { |
| "name": "runWithUserGesture", |
| "type": "function", |
| "description": "Runs the callback in the context of a user gesture.", |
| "nocompile": true, |
| "parameters": [ |
| { |
| "type": "function", |
| "name": "callback", |
| "parameters": [] |
| } |
| ] |
| }, |
| { |
| "name": "runWithoutUserGesture", |
| "type": "function", |
| "nocompile": true, |
| "parameters": [ |
| { |
| "type": "function", |
| "name": "callback", |
| "parameters": [] |
| } |
| ] |
| } |
| ], |
| "events": [ |
| { |
| "name": "onMessage", |
| "type": "function", |
| "description": "Used to test sending messages to extensions.", |
| "parameters": [ |
| { |
| "type": "object", |
| "name": "info", |
| "properties": { |
| "data": { "type": "string", "description": "Additional information." }, |
| "lastMessage": { "type": "boolean", "description": "True if this was the last message for this test" } |
| } |
| } |
| ] |
| } |
| ] |
| } |
| ] |