test.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. // Copyright 2020 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. // This file was generated by:
  5. // tools/json_schema_compiler/compiler.py.
  6. // NOTE: The format of types has changed. 'FooType' is now
  7. // 'chrome.test.FooType'.
  8. // Please run the closure compiler before committing changes.
  9. // See https://chromium.googlesource.com/chromium/src/+/master/docs/closure_compilation.md
  10. /** @fileoverview Externs generated from namespace: test */
  11. /** @const */
  12. chrome.test = {};
  13. /**
  14. * Gives configuration options set by the test.
  15. * @param {function({
  16. * customArg: (string|undefined),
  17. * ftpServer: ({
  18. * port: number
  19. * }|undefined),
  20. * testServer: ({
  21. * port: number
  22. * }|undefined),
  23. * testDataDirectory: (string|undefined),
  24. * testWebSocketPort: (number|undefined),
  25. * loginStatus: ({
  26. * isLoggedIn: (boolean|undefined),
  27. * isScreenLocked: (boolean|undefined)
  28. * }|undefined)
  29. * }): void} callback
  30. * @see https://developer.chrome.com/extensions/test#method-getConfig
  31. */
  32. chrome.test.getConfig = function(callback) {};
  33. /**
  34. * Notifies the browser process that test code running in the extension failed.
  35. * This is only used for internal unit testing.
  36. * @param {string} message
  37. * @see https://developer.chrome.com/extensions/test#method-notifyFail
  38. */
  39. chrome.test.notifyFail = function(message) {};
  40. /**
  41. * Notifies the browser process that test code running in the extension passed.
  42. * This is only used for internal unit testing.
  43. * @param {string=} message
  44. * @see https://developer.chrome.com/extensions/test#method-notifyPass
  45. */
  46. chrome.test.notifyPass = function(message) {};
  47. /**
  48. * Logs a message during internal unit testing.
  49. * @param {string} message
  50. * @see https://developer.chrome.com/extensions/test#method-log
  51. */
  52. chrome.test.log = function(message) {};
  53. /**
  54. * Sends a string message to the browser process, generating a Notification that
  55. * C++ test code can wait for.
  56. * @param {string} message
  57. * @param {function(string): void=} callback
  58. * @see https://developer.chrome.com/extensions/test#method-sendMessage
  59. */
  60. chrome.test.sendMessage = function(message, callback) {};
  61. /**
  62. * @see https://developer.chrome.com/extensions/test#method-callbackAdded
  63. */
  64. chrome.test.callbackAdded = function() {};
  65. /**
  66. * @see https://developer.chrome.com/extensions/test#method-runNextTest
  67. */
  68. chrome.test.runNextTest = function() {};
  69. /**
  70. * @param {*=} message
  71. * @see https://developer.chrome.com/extensions/test#method-fail
  72. */
  73. chrome.test.fail = function(message) {};
  74. /**
  75. * @param {*=} message
  76. * @see https://developer.chrome.com/extensions/test#method-succeed
  77. */
  78. chrome.test.succeed = function(message) {};
  79. /**
  80. * Returns an instance of the module system for the given context.
  81. * @param {*} context
  82. * @return {*} The module system
  83. * @see https://developer.chrome.com/extensions/test#method-getModuleSystem
  84. */
  85. chrome.test.getModuleSystem = function(context) {};
  86. /**
  87. * @param {(string|boolean)} test
  88. * @param {string=} message
  89. * @see https://developer.chrome.com/extensions/test#method-assertTrue
  90. */
  91. chrome.test.assertTrue = function(test, message) {};
  92. /**
  93. * @param {(string|boolean)} test
  94. * @param {string=} message
  95. * @see https://developer.chrome.com/extensions/test#method-assertFalse
  96. */
  97. chrome.test.assertFalse = function(test, message) {};
  98. /**
  99. * @param {(string|boolean)} test
  100. * @param {boolean} expected
  101. * @param {string=} message
  102. * @see https://developer.chrome.com/extensions/test#method-assertBool
  103. */
  104. chrome.test.assertBool = function(test, expected, message) {};
  105. /**
  106. * @param {*=} expected
  107. * @param {*=} actual
  108. * @see https://developer.chrome.com/extensions/test#method-checkDeepEq
  109. */
  110. chrome.test.checkDeepEq = function(expected, actual) {};
  111. /**
  112. * @param {*=} expected
  113. * @param {*=} actual
  114. * @param {string=} message
  115. * @see https://developer.chrome.com/extensions/test#method-assertEq
  116. */
  117. chrome.test.assertEq = function(expected, actual, message) {};
  118. /**
  119. * @see https://developer.chrome.com/extensions/test#method-assertNoLastError
  120. */
  121. chrome.test.assertNoLastError = function() {};
  122. /**
  123. * @param {string} expectedError
  124. * @see https://developer.chrome.com/extensions/test#method-assertLastError
  125. */
  126. chrome.test.assertLastError = function(expectedError) {};
  127. /**
  128. * @param {function(): void} fn
  129. * @param {?Object|undefined} self
  130. * @param {!Array<*>} args
  131. * @param {(string|RegExp)=} message
  132. * @see https://developer.chrome.com/extensions/test#method-assertThrows
  133. */
  134. chrome.test.assertThrows = function(fn, self, args, message) {};
  135. /**
  136. * @param {function(): void=} func
  137. * @param {string=} expectedError
  138. * @see https://developer.chrome.com/extensions/test#method-callback
  139. */
  140. chrome.test.callback = function(func, expectedError) {};
  141. /**
  142. * @param {*} event
  143. * @param {function(): void} func
  144. * @see https://developer.chrome.com/extensions/test#method-listenOnce
  145. */
  146. chrome.test.listenOnce = function(event, func) {};
  147. /**
  148. * @param {*} event
  149. * @param {function(): void} func
  150. * @see https://developer.chrome.com/extensions/test#method-listenForever
  151. */
  152. chrome.test.listenForever = function(event, func) {};
  153. /**
  154. * @param {function(): void=} func
  155. * @see https://developer.chrome.com/extensions/test#method-callbackPass
  156. */
  157. chrome.test.callbackPass = function(func) {};
  158. /**
  159. * @param {string} expectedError
  160. * @param {function(): void=} func
  161. * @see https://developer.chrome.com/extensions/test#method-callbackFail
  162. */
  163. chrome.test.callbackFail = function(expectedError, func) {};
  164. /**
  165. * @param {!Array<function(): void>} tests
  166. * @see https://developer.chrome.com/extensions/test#method-runTests
  167. */
  168. chrome.test.runTests = function(tests) {};
  169. /**
  170. * @see https://developer.chrome.com/extensions/test#method-getApiFeatures
  171. */
  172. chrome.test.getApiFeatures = function() {};
  173. /**
  174. * @param {!Array<string>=} apiNames
  175. * @see https://developer.chrome.com/extensions/test#method-getApiDefinitions
  176. */
  177. chrome.test.getApiDefinitions = function(apiNames) {};
  178. /**
  179. * @see https://developer.chrome.com/extensions/test#method-isProcessingUserGesture
  180. */
  181. chrome.test.isProcessingUserGesture = function() {};
  182. /**
  183. * Runs the callback in the context of a user gesture.
  184. * @param {function(): void} callback
  185. * @see https://developer.chrome.com/extensions/test#method-runWithUserGesture
  186. */
  187. chrome.test.runWithUserGesture = function(callback) {};
  188. /**
  189. * Sends a string message one round trip from the renderer to the browser
  190. * process and back.
  191. * @param {string} message
  192. * @param {function(string): void} callback
  193. * @see https://developer.chrome.com/extensions/test#method-waitForRoundTrip
  194. */
  195. chrome.test.waitForRoundTrip = function(message, callback) {};
  196. /**
  197. * Sets the function to be called when an exception occurs. By default this is a
  198. * function which fails the test. This is reset for every test run through
  199. * $ref:test.runTests.
  200. * @param {function(string, *): void} callback
  201. * @see https://developer.chrome.com/extensions/test#method-setExceptionHandler
  202. */
  203. chrome.test.setExceptionHandler = function(callback) {};
  204. /**
  205. * Returns the wake-event-page API function, which can be called to wake up the
  206. * extension's event page.
  207. * @return {function(): void} The API function which wakes the extension's event
  208. * page
  209. * @see https://developer.chrome.com/extensions/test#method-getWakeEventPage
  210. */
  211. chrome.test.getWakeEventPage = function() {};
  212. /**
  213. * Used to test sending messages to extensions.
  214. * @type {!ChromeEvent}
  215. * @see https://developer.chrome.com/extensions/test#event-onMessage
  216. */
  217. chrome.test.onMessage;