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) {};
64 /** @type {function(...):Function} */
65 sinon.spy = function() {};
68 * This is a jscompile type that can be OR'ed with the actual type to make
69 * jscompile aware of the sinon.spy functions that are added to the base
71 * Example: Instead of specifying a type of
73 * the following can be used to add the sinon.spy functions:
74 * {(sinon.Spy|function():void)}
78 sinon.Spy = function() {};
81 sinon.Spy.prototype.callCount;
83 /** @type {boolean} */
84 sinon.Spy.prototype.called;
86 /** @type {boolean} */
87 sinon.Spy.prototype.calledOnce;
89 /** @type {boolean} */
90 sinon.Spy.prototype.calledTwice;
92 /** @type {function(...):boolean} */
93 sinon.Spy.prototype.calledWith = function() {};
95 /** @type {function(number):{args:Array}} */
96 sinon.Spy.prototype.getCall = function(index) {};
98 sinon.Spy.prototype.reset = function() {};
100 sinon.Spy.prototype.restore = function() {};
102 /** @type {Array<Array<*>>} */
103 sinon.Spy.prototype.args;
106 * @param {Object} obj
107 * @param {string} method
108 * @param {Function=} opt_stubFunction
109 * @return {sinon.TestStub}
111 sinon.stub = function(obj, method, opt_stubFunction) {};
114 * TODO(jrw): rename to |sinon.Stub| for consistency
116 * @extends {sinon.Spy}
118 sinon.TestStub = function() {};
120 /** @type {function(number):{args:Array}} */
121 sinon.TestStub.prototype.getCall = function(index) {};
123 sinon.TestStub.prototype.restore = function() {};
126 sinon.TestStub.prototype.returns = function(a) {};
128 /** @type {function(...):sinon.Expectation} */
129 sinon.TestStub.prototype.withArgs = function() {};
131 /** @type {function(...):sinon.Expectation} */
132 sinon.TestStub.prototype.onFirstCall = function() {};
134 /** @returns {Object} */
135 sinon.createStubInstance = function (/** * */ constructor) {};
138 sinon.FakeXhrCtrl = function() {};
141 * @type {?function(!sinon.FakeXhr)}
143 sinon.FakeXhrCtrl.prototype.onCreate;
145 /** @return {sinon.FakeXhrCtrl} */
146 sinon.useFakeXMLHttpRequest = function() {};
149 sinon.FakeXhr = function() {};
151 /** @type {number} */
152 sinon.FakeXhr.prototype.readyState;
154 /** @type {string} */
155 sinon.FakeXhr.prototype.method;
157 /** @type {string} */
158 sinon.FakeXhr.prototype.url;
160 /** @type {boolean} */
161 sinon.FakeXhr.prototype.withCredentials;
163 /** @type {?string} */
164 sinon.FakeXhr.prototype.requestBody;
166 /** @type {!Object<string,string>} */
167 sinon.FakeXhr.prototype.requestHeaders;
170 * @param {number} status
171 * @param {!Object<string,string>} headers
172 * @param {?string} content
174 sinon.FakeXhr.prototype.respond;
177 * @param {string} event
178 * @param {Function} handler
180 sinon.FakeXhr.prototype.addEventListener;