| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file contains various hacks needed to inform JSCompiler of various | 5 // This file contains various hacks needed to inform JSCompiler of various |
| 6 // QUnit-specific properties and methods. It is used only with JSCompiler to | 6 // QUnit-specific properties and methods. It is used only with JSCompiler to |
| 7 // verify the type-correctness of our code. | 7 // verify the type-correctness of our code. |
| 8 | 8 |
| 9 | 9 |
| 10 /** @type {Object} */ | 10 /** @type {Object} */ |
| 11 var QUnit = QUnit || {}; | 11 var QUnit = QUnit || {}; |
| 12 | 12 |
| 13 /** @constructor */ | 13 /** @constructor */ |
| 14 QUnit.Test = function() {}; | 14 QUnit.Test = function() {}; |
| 15 | 15 |
| 16 /** @type {QUnit.Clock} */ | 16 /** @type {QUnit.Clock} */ |
| 17 QUnit.Test.prototype.clock = new QUnit.Clock(); | 17 QUnit.Test.prototype.clock = new QUnit.Clock(); |
| 18 | 18 |
| 19 /** @constructor */ | 19 /** @constructor */ |
| 20 QUnit.Clock = function() {}; | 20 QUnit.Clock = function() {}; |
| 21 | 21 |
| 22 /** @param {number} ticks */ | 22 /** @param {number} ticks */ |
| 23 QUnit.Clock.prototype.tick = function(ticks) {}; | 23 QUnit.Clock.prototype.tick = function(ticks) {}; |
| 24 | 24 |
| 25 | |
| 26 /** | |
| 27 * @param {string} desc | |
| 28 * @param {Function} f | |
| 29 */ | |
| 30 QUnit.asyncTest = function(desc, f) {}; | |
| 31 | |
| 32 /** | |
| 33 * @param {*} a | |
| 34 * @param {*} b | |
| 35 * @param {string=} opt_message | |
| 36 */ | |
| 37 QUnit.deepEqual = function(a, b, opt_message) {}; | |
| 38 | |
| 39 /** | |
| 40 * @param {*} a | |
| 41 * @param {*} b | |
| 42 * @param {string=} opt_message | |
| 43 */ | |
| 44 QUnit.equal = function(a, b, opt_message) {}; | |
| 45 | |
| 46 /** | |
| 47 * @param {*} a | |
| 48 */ | |
| 49 QUnit.expect = function(a) {}; | |
| 50 | |
| 51 /** | |
| 52 * @param {string} desc | |
| 53 * @param {Object=} dict | |
| 54 */ | |
| 55 QUnit.module = function(desc, dict) {}; | |
| 56 | |
| 57 /** | |
| 58 * @param {*} a | |
| 59 * @param {*} b | |
| 60 * @param {string=} opt_desc | |
| 61 */ | |
| 62 QUnit.notEqual = function(a, b, opt_desc) {}; | |
| 63 | |
| 64 /** | |
| 65 * @param {boolean} cond | |
| 66 * @param {string=} desc | |
| 67 * @return {boolean} | |
| 68 */ | |
| 69 QUnit.ok = function(cond, desc) {}; | |
| 70 | |
| 71 QUnit.start = function() {}; | |
| 72 | |
| 73 /** | |
| 74 * @param {string} desc | |
| 75 * @param {Function} f | |
| 76 */ | |
| 77 QUnit.test = function(desc, f) {}; | |
| 78 | |
| 79 /** @param {Function} f */ | 25 /** @param {Function} f */ |
| 80 QUnit.testStart = function(f) {}; | 26 QUnit.testStart = function(f) {}; |
| 81 | 27 |
| 82 /** | 28 /** |
| 83 * @interface | 29 * @interface |
| 84 */ | 30 */ |
| 85 QUnit.Assert = function() {}; | 31 QUnit.Assert = function() {}; |
| 86 | 32 |
| 87 /** | 33 /** |
| 88 * @return {function():void} | 34 * @return {function():void} |
| 89 */ | 35 */ |
| 90 QUnit.Assert.prototype.async = function() {}; | 36 QUnit.Assert.prototype.async = function() {}; |
| 91 | 37 |
| 92 var deepEqual = QUnit.deepEqual; | 38 /** |
| 93 var equal = QUnit.equal; | 39 * @param {*} a |
| 94 var expect = QUnit.expect; | 40 * @param {*} b |
| 95 var module = QUnit.module; | 41 * @param {string=} opt_desc |
| 96 var notEqual = QUnit.notEqual; | 42 */ |
| 97 var ok = QUnit.ok; | 43 QUnit.Assert.prototype.notEqual = function(a, b, opt_desc) {}; |
| 98 var test = QUnit.test; | 44 |
| 45 /** |
| 46 * @param {boolean} cond |
| 47 * @param {string=} desc |
| 48 * @return {boolean} |
| 49 */ |
| 50 QUnit.Assert.prototype.ok = function(cond, desc) {}; |
| 51 |
| 52 /** |
| 53 * @param {*} a |
| 54 * @param {*} b |
| 55 * @param {string=} opt_message |
| 56 */ |
| 57 QUnit.Assert.prototype.deepEqual = function(a, b, opt_message) {}; |
| 58 |
| 59 /** |
| 60 * @param {*} a |
| 61 * @param {*} b |
| 62 * @param {string=} opt_message |
| 63 */ |
| 64 QUnit.Assert.prototype.equal = function(a, b, opt_message) {}; |
| 65 |
| 66 /** |
| 67 * @param {number} assertionCount |
| 68 */ |
| 69 QUnit.Assert.prototype.expect = function(assertionCount) {}; |
| 70 |
| 71 /** |
| 72 * @typedef {{ |
| 73 * beforeEach: (function(QUnit.Assert=) | undefined), |
| 74 * afterEach: (function(QUnit.Assert=) | undefined) |
| 75 * }} |
| 76 */ |
| 77 QUnit.ModuleArgs; |
| 78 |
| 79 /** |
| 80 * @param {string} desc |
| 81 * @param {QUnit.ModuleArgs=} opt_args= |
| 82 */ |
| 83 QUnit.module = function(desc, opt_args) {}; |
| 84 |
| 85 /** |
| 86 * @param {string} desc |
| 87 * @param {function(QUnit.Assert)} f |
| 88 */ |
| 89 QUnit.test = function(desc, f) {}; |
| OLD | NEW |