| // Copyright 2014 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." |
| }, |
| "ftpServer": { |
| "type": "object", |
| "optional": true, |
| "description": "Details on the FTP server used to mock network responses. Will be set only if test calls ExtensionApiTest::StartFTPServer().", |
| "properties": { |
| "port": { |
| "type": "integer", |
| "description": "The port on which the FTP server is listening.", |
| "minimum": 1024, |
| "maximum": 65535 |
| } |
| } |
| }, |
| "testServer": { |
| "type": "object", |
| "optional": true, |
| "description": "Details on the test server used to mock network responses. Will be set only if test calls ExtensionApiTest::StartEmbeddedTestServer().", |
| "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 |
| }, |
| "isolateExtensions": { |
| "type": "boolean", |
| "description": "Whether or not extensions are running in site isolation mode." |
| } |
| } |
| } |
| ] |
| } |
| ] |
| }, |
| { |
| "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": "log", |
| "type": "function", |
| "description": "Logs a message during internal unit testing.", |
| "parameters": [ |
| {"type": "string", "name": "message"} |
| ] |
| }, |
| { |
| "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": "runWithNativesEnabled", |
| "type": "function", |
| "nocompile": true, |
| "description": "Runs the given function with access to native methods enabled.", |
| "parameters": [ |
| { |
| "type": "function", |
| "name": "callback" |
| } |
| ] |
| }, |
| { |
| "name": "getModuleSystem", |
| "type": "function", |
| "nocompile": true, |
| "description": "Returns an instance of the module system for the given context.", |
| "parameters": [ |
| { |
| "type": "any", |
| "name": "context" |
| } |
| ], |
| "returns": { |
| "type": "any", |
| "description": "The module system", |
| "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": [] |
| } |
| ] |
| }, |
| { |
| "name": "waitForRoundTrip", |
| "type": "function", |
| "description": "Sends a string message one round trip from the renderer to the browser process and back.", |
| "parameters": [ |
| {"type": "string", "name": "message"}, |
| { |
| "type": "function", |
| "name": "callback", |
| "parameters": [ |
| {"type": "string", "name": "message"} |
| ] |
| } |
| ] |
| }, |
| { |
| "name": "setExceptionHandler", |
| "type": "function", |
| "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.", |
| "nocompile": true, |
| "parameters": [ |
| { |
| "type": "function", |
| "name": "callback", |
| "parameters": [ |
| {"type": "string", "name": "message"}, |
| {"type": "any", "name": "exception"} |
| ] |
| } |
| ] |
| }, |
| { |
| "name": "getWakeEventPage", |
| "type": "function", |
| "description": "Returns the wake-event-page API function, which can be called to wake up the extension's event page.", |
| "nocompile": true, |
| "parameters": [], |
| "returns": { |
| "type": "function", |
| "description": "The API function which wakes the extension's event page" |
| } |
| } |
| ], |
| "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" } |
| } |
| } |
| ] |
| } |
| ] |
| } |
| ] |