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
) {};
27 * @param {(sinon.Spy|Function)} f
29 sinon
.assert
.notCalled = function(f
) {};
32 sinon
.Clock = function() {};
34 /** @param {number} ms */
35 sinon
.Clock
.prototype.tick = function(ms
) {};
38 sinon
.Clock
.prototype.restore = function() {};
41 * @param {number=} opt_now
42 * @return {sinon.Clock}
44 sinon
.useFakeTimers = function(opt_now
) {};
47 sinon
.Expectation = function() {};
49 /** @return {sinon.Expectation} */
50 sinon
.Expectation
.prototype.once = function() {};
52 /** @return {sinon.Expectation} */
53 sinon
.Expectation
.prototype.never = function() {};
56 * @param {number} times
57 * @return {sinon.Expectation}
59 sinon
.Expectation
.prototype.exactly = function(times
) {};
63 * @return {sinon.Expectation}
65 sinon
.Expectation
.prototype.withArgs = function(data
) {};
67 /** @return {boolean} */
68 sinon
.Expectation
.prototype.verify = function() {};
70 /** @param {...} data */
71 sinon
.Expectation
.prototype.returns = function(data
) {};
75 * @return {sinon.Mock}
77 sinon
.mock = function(obj
) {};
80 sinon
.Mock = function() {};
83 * @param {string} method
84 * @return {sinon.Expectation}
86 sinon
.Mock
.prototype.expects = function(method
) {};
91 sinon
.Mock
.prototype.restore = function() {};
96 sinon
.Mock
.prototype.verify = function() {};
98 /** @type {function(...):Function} */
99 sinon
.spy = function() {};
102 * This is a jscompile type that can be OR'ed with the actual type to make
103 * jscompile aware of the sinon.spy functions that are added to the base
105 * Example: Instead of specifying a type of
107 * the following can be used to add the sinon.spy functions:
108 * {(sinon.Spy|function():void)}
112 sinon
.Spy = function() {};
114 /** @type {number} */
115 sinon
.Spy
.prototype.callCount
;
117 /** @type {boolean} */
118 sinon
.Spy
.prototype.called
;
120 /** @type {boolean} */
121 sinon
.Spy
.prototype.calledOnce
;
123 /** @type {boolean} */
124 sinon
.Spy
.prototype.calledTwice
;
126 /** @type {function(...):boolean} */
127 sinon
.Spy
.prototype.calledWith = function() {};
129 /** @type {function(number):{args:Array}} */
130 sinon
.Spy
.prototype.getCall = function(index
) {};
132 sinon
.Spy
.prototype.reset = function() {};
134 sinon
.Spy
.prototype.restore = function() {};
136 /** @type {Array<Array<*>>} */
137 sinon
.Spy
.prototype.args
;
140 * @param {Object=} opt_obj
141 * @param {string=} opt_method
142 * @param {Function=} opt_stubFunction
143 * @return {sinon.TestStub}
145 sinon
.stub = function(opt_obj
, opt_method
, opt_stubFunction
) {};
148 * TODO(jrw): rename to |sinon.Stub| for consistency
150 * @extends {sinon.Spy}
152 sinon
.TestStub = function() {};
154 /** @type {function(number):{args:Array}} */
155 sinon
.TestStub
.prototype.getCall = function(index
) {};
157 sinon
.TestStub
.prototype.restore = function() {};
160 sinon
.TestStub
.prototype.returns = function(a
) {};
162 /** @type {function(...):sinon.Expectation} */
163 sinon
.TestStub
.prototype.withArgs = function() {};
165 /** @type {function(...):sinon.Expectation} */
166 sinon
.TestStub
.prototype.onFirstCall = function() {};
168 /** @type {function(...):sinon.Expectation} */
169 sinon
.TestStub
.prototype.callsArgWith = function() {};
171 /** @returns {Object} */
172 sinon
.createStubInstance = function (/** * */ constructor) {};
175 sinon
.FakeXhrCtrl = function() {};
178 * @type {?function(!sinon.FakeXhr)}
180 sinon
.FakeXhrCtrl
.prototype.onCreate
;
183 * @type {function():void}
185 sinon
.FakeXhrCtrl
.prototype.restore
;
187 /** @return {sinon.FakeXhrCtrl} */
188 sinon
.useFakeXMLHttpRequest = function() {};
191 sinon
.FakeXhr = function() {};
193 /** @type {number} */
194 sinon
.FakeXhr
.prototype.readyState
;
196 /** @type {string} */
197 sinon
.FakeXhr
.prototype.method
;
199 /** @type {string} */
200 sinon
.FakeXhr
.prototype.url
;
202 /** @type {boolean} */
203 sinon
.FakeXhr
.prototype.withCredentials
;
205 /** @type {?string} */
206 sinon
.FakeXhr
.prototype.requestBody
;
208 /** @type {!Object<string>} */
209 sinon
.FakeXhr
.prototype.requestHeaders
;
212 * @param {number} status
213 * @param {!Object<string>} headers
214 * @param {?string} content
216 sinon
.FakeXhr
.prototype.respond
;
219 * @param {string} event
220 * @param {Function} handler
222 sinon
.FakeXhr
.prototype.addEventListener
;