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;
154 * @type {function():void}
156 sinon.FakeXhrCtrl.prototype.restore;
158 /** @return {sinon.FakeXhrCtrl} */
159 sinon.useFakeXMLHttpRequest = function() {};
162 sinon.FakeXhr = function() {};
164 /** @type {number} */
165 sinon.FakeXhr.prototype.readyState;
167 /** @type {string} */
168 sinon.FakeXhr.prototype.method;
170 /** @type {string} */
171 sinon.FakeXhr.prototype.url;
173 /** @type {boolean} */
174 sinon.FakeXhr.prototype.withCredentials;
176 /** @type {?string} */
177 sinon.FakeXhr.prototype.requestBody;
179 /** @type {!Object<string>} */
180 sinon.FakeXhr.prototype.requestHeaders;
183 * @param {number} status
184 * @param {!Object<string>} headers
185 * @param {?string} content
187 sinon.FakeXhr.prototype.respond;
190 * @param {string} event
191 * @param {Function} handler
193 sinon.FakeXhr.prototype.addEventListener;