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 = false;
86 /** @type {boolean} */
87 sinon.Spy.prototype.calledOnce = false;
89 /** @type {boolean} */
90 sinon.Spy.prototype.calledTwice = false;
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() {};
103 * @param {Object} obj
104 * @param {string} method
105 * @param {Function=} opt_stubFunction
106 * @return {sinon.TestStub}
108 sinon.stub = function(obj, method, opt_stubFunction) {};
111 sinon.TestStub = function() {};
113 /** @type {function(number):{args:Array}} */
114 sinon.TestStub.prototype.getCall = function(index) {};
116 sinon.TestStub.prototype.restore = function() {};
119 sinon.TestStub.prototype.returns = function(a) {};
121 /** @type {function(...):sinon.Expectation} */
122 sinon.TestStub.prototype.withArgs = function() {};
124 /** @type {function(...):sinon.Expectation} */
125 sinon.TestStub.prototype.onFirstCall = function() {};
127 /** @returns {Object} */
128 sinon.createStubInstance = function (/** * */ constructor) {};
131 sinon.FakeXhrCtrl = function() {};
134 * @type {?function(!sinon.FakeXhr)}
136 sinon.FakeXhrCtrl.prototype.onCreate;
138 /** @return {sinon.FakeXhrCtrl} */
139 sinon.useFakeXMLHttpRequest = function() {};
142 sinon.FakeXhr = function() {};
144 /** @type {number} */
145 sinon.FakeXhr.prototype.readyState;
147 /** @type {string} */
148 sinon.FakeXhr.prototype.method;
150 /** @type {string} */
151 sinon.FakeXhr.prototype.url;
153 /** @type {boolean} */
154 sinon.FakeXhr.prototype.withCredentials;
156 /** @type {?string} */
157 sinon.FakeXhr.prototype.requestBody;
159 /** @type {!Object<string,string>} */
160 sinon.FakeXhr.prototype.requestHeaders;
163 * @param {number} status
164 * @param {!Object<string,string>} headers
165 * @param {?string} content
167 sinon.FakeXhr.prototype.respond;
170 * @param {string} event
171 * @param {Function} handler
173 sinon.FakeXhr.prototype.addEventListener;