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
3 // found in the LICENSE file.
5 var sinon
= sinon
|| {};
11 * @param {(sinon.Spy|Function)} f
13 sinon
.assert
.called = function(f
) {};
16 * @param {(sinon.Spy|Function)} f
18 sinon
.assert
.calledOnce = function(f
) {};
21 * @param {(sinon.Spy|Function)} f
24 sinon
.assert
.calledWith = function(f
, data
) {};
30 sinon
.match = function(value
) {};
32 * @param {(sinon.Spy|Function)} f
34 sinon
.assert
.notCalled = function(f
) {};
37 sinon
.Clock = function() {};
39 /** @param {number} ms */
40 sinon
.Clock
.prototype.tick = function(ms
) {};
43 sinon
.Clock
.prototype.restore = function() {};
46 * @param {number=} opt_now
47 * @return {sinon.Clock}
49 sinon
.useFakeTimers = function(opt_now
) {};
52 sinon
.Expectation = function() {};
54 /** @return {sinon.Expectation} */
55 sinon
.Expectation
.prototype.once = function() {};
57 /** @return {sinon.Expectation} */
58 sinon
.Expectation
.prototype.never = function() {};
61 * @param {number} times
62 * @return {sinon.Expectation}
64 sinon
.Expectation
.prototype.exactly = function(times
) {};
68 * @return {sinon.Expectation}
70 sinon
.Expectation
.prototype.withArgs = function(data
) {};
72 /** @return {boolean} */
73 sinon
.Expectation
.prototype.verify = function() {};
75 /** @param {...} data */
76 sinon
.Expectation
.prototype.returns = function(data
) {};
80 * @return {sinon.Mock}
82 sinon
.mock = function(obj
) {};
85 sinon
.Mock = function() {};
88 * @param {string} method
89 * @return {sinon.Expectation}
91 sinon
.Mock
.prototype.expects = function(method
) {};
96 sinon
.Mock
.prototype.restore = function() {};
101 sinon
.Mock
.prototype.verify = function() {};
103 /** @type {function(...):Function} */
104 sinon
.spy = function() {};
107 * This is a jscompile type that can be OR'ed with the actual type to make
108 * jscompile aware of the sinon.spy functions that are added to the base
110 * Example: Instead of specifying a type of
112 * the following can be used to add the sinon.spy functions:
113 * {(sinon.Spy|function():void)}
117 sinon
.Spy = function() {};
119 /** @type {number} */
120 sinon
.Spy
.prototype.callCount
;
122 /** @type {boolean} */
123 sinon
.Spy
.prototype.called
;
125 /** @type {boolean} */
126 sinon
.Spy
.prototype.calledOnce
;
128 /** @type {boolean} */
129 sinon
.Spy
.prototype.calledTwice
;
131 /** @type {function(...):boolean} */
132 sinon
.Spy
.prototype.calledWith = function() {};
134 /** @type {function(number):{args:Array}} */
135 sinon
.Spy
.prototype.getCall = function(index
) {};
137 sinon
.Spy
.prototype.reset = function() {};
139 sinon
.Spy
.prototype.restore = function() {};
141 /** @type {Array<Array<*>>} */
142 sinon
.Spy
.prototype.args
;
145 * @param {Object=} opt_obj
146 * @param {string=} opt_method
147 * @param {Function=} opt_stubFunction
148 * @return {sinon.TestStub}
150 sinon
.stub = function(opt_obj
, opt_method
, opt_stubFunction
) {};
153 * TODO(jrw): rename to |sinon.Stub| for consistency
155 * @extends {sinon.Spy}
157 sinon
.TestStub = function() {};
159 /** @type {function(number):{args:Array}} */
160 sinon
.TestStub
.prototype.getCall = function(index
) {};
162 sinon
.TestStub
.prototype.restore = function() {};
165 sinon
.TestStub
.prototype.returns = function(a
) {};
167 /** @type {function(...):sinon.Expectation} */
168 sinon
.TestStub
.prototype.withArgs = function() {};
170 /** @type {function(...):sinon.Expectation} */
171 sinon
.TestStub
.prototype.onFirstCall = function() {};
173 /** @type {function(...):sinon.Expectation} */
174 sinon
.TestStub
.prototype.callsArgWith = function() {};
176 /** @returns {Object} */
177 sinon
.createStubInstance = function (/** * */ constructor) {};
180 sinon
.FakeXhrCtrl = function() {};
183 * @type {?function(!sinon.FakeXhr)}
185 sinon
.FakeXhrCtrl
.prototype.onCreate
;
188 * @type {function():void}
190 sinon
.FakeXhrCtrl
.prototype.restore
;
192 /** @return {sinon.FakeXhrCtrl} */
193 sinon
.useFakeXMLHttpRequest = function() {};
196 sinon
.FakeXhr = function() {};
198 /** @type {number} */
199 sinon
.FakeXhr
.prototype.readyState
;
201 /** @type {string} */
202 sinon
.FakeXhr
.prototype.method
;
204 /** @type {string} */
205 sinon
.FakeXhr
.prototype.url
;
207 /** @type {boolean} */
208 sinon
.FakeXhr
.prototype.withCredentials
;
210 /** @type {?string} */
211 sinon
.FakeXhr
.prototype.requestBody
;
213 /** @type {!Object<string>} */
214 sinon
.FakeXhr
.prototype.requestHeaders
;
217 * @param {number} status
218 * @param {!Object<string>} headers
219 * @param {?string} content
221 sinon
.FakeXhr
.prototype.respond
;
224 * @param {string} event
225 * @param {Function} handler
227 sinon
.FakeXhr
.prototype.addEventListener
;