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
.Expectation = function() {};
34 /** @return {sinon.Expectation} */
35 sinon
.Expectation
.prototype.once = function() {};
39 * @return {sinon.Expectation}
41 sinon
.Expectation
.prototype.withArgs = function(data
) {};
43 /** @return {boolean} */
44 sinon
.Expectation
.prototype.verify = function() {};
46 /** @param {...} data */
47 sinon
.Expectation
.prototype.returns = function(data
) {};
51 * @return {sinon.Mock}
53 sinon
.mock = function(obj
) {};
56 sinon
.Mock = function() {};
59 * @param {string} method
60 * @return {sinon.Expectation}
62 sinon
.Mock
.prototype.expects = function(method
) {};
67 sinon
.Mock
.prototype.restore = function() {};
69 /** @type {function(...):Function} */
70 sinon
.spy = function() {};
73 * This is a jscompile type that can be OR'ed with the actual type to make
74 * jscompile aware of the sinon.spy functions that are added to the base
76 * Example: Instead of specifying a type of
78 * the following can be used to add the sinon.spy functions:
79 * {(sinon.Spy|function():void)}
83 sinon
.Spy = function() {};
86 sinon
.Spy
.prototype.callCount
;
88 /** @type {boolean} */
89 sinon
.Spy
.prototype.called
;
91 /** @type {boolean} */
92 sinon
.Spy
.prototype.calledOnce
;
94 /** @type {boolean} */
95 sinon
.Spy
.prototype.calledTwice
;
97 /** @type {function(...):boolean} */
98 sinon
.Spy
.prototype.calledWith = function() {};
100 /** @type {function(number):{args:Array}} */
101 sinon
.Spy
.prototype.getCall = function(index
) {};
103 sinon
.Spy
.prototype.reset = function() {};
105 sinon
.Spy
.prototype.restore = function() {};
107 /** @type {Array<Array<*>>} */
108 sinon
.Spy
.prototype.args
;
111 * @param {Object=} opt_obj
112 * @param {string=} opt_method
113 * @param {Function=} opt_stubFunction
114 * @return {sinon.TestStub}
116 sinon
.stub = function(opt_obj
, opt_method
, opt_stubFunction
) {};
119 * TODO(jrw): rename to |sinon.Stub| for consistency
121 * @extends {sinon.Spy}
123 sinon
.TestStub = function() {};
125 /** @type {function(number):{args:Array}} */
126 sinon
.TestStub
.prototype.getCall = function(index
) {};
128 sinon
.TestStub
.prototype.restore = function() {};
131 sinon
.TestStub
.prototype.returns = function(a
) {};
133 /** @type {function(...):sinon.Expectation} */
134 sinon
.TestStub
.prototype.withArgs = function() {};
136 /** @type {function(...):sinon.Expectation} */
137 sinon
.TestStub
.prototype.onFirstCall = function() {};
139 /** @type {function(...):sinon.Expectation} */
140 sinon
.TestStub
.prototype.callsArgWith = function() {};
142 /** @returns {Object} */
143 sinon
.createStubInstance = function (/** * */ constructor) {};
146 sinon
.FakeXhrCtrl = function() {};
149 * @type {?function(!sinon.FakeXhr)}
151 sinon
.FakeXhrCtrl
.prototype.onCreate
;
153 /** @return {sinon.FakeXhrCtrl} */
154 sinon
.useFakeXMLHttpRequest = function() {};
157 sinon
.FakeXhr = function() {};
159 /** @type {number} */
160 sinon
.FakeXhr
.prototype.readyState
;
162 /** @type {string} */
163 sinon
.FakeXhr
.prototype.method
;
165 /** @type {string} */
166 sinon
.FakeXhr
.prototype.url
;
168 /** @type {boolean} */
169 sinon
.FakeXhr
.prototype.withCredentials
;
171 /** @type {?string} */
172 sinon
.FakeXhr
.prototype.requestBody
;
174 /** @type {!Object<string,string>} */
175 sinon
.FakeXhr
.prototype.requestHeaders
;
178 * @param {number} status
179 * @param {!Object<string,string>} headers
180 * @param {?string} content
182 sinon
.FakeXhr
.prototype.respond
;
185 * @param {string} event
186 * @param {Function} handler
188 sinon
.FakeXhr
.prototype.addEventListener
;