Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: remoting/webapp/unittests/sinon_helpers.js

Issue 1002553002: Refactor sinon helper to make it easier to use. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/webapp/unittests/l10n_unittest.js ('k') | remoting/webapp/unittests/test_start.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var sinonHelpers = {};
6
7 sinonHelpers.reset = function() {
8
9 /** 5 /**
10 * @param {Object} obj 6 * Casts an |object| to sinon.TestStub verifying that it's really a stub.
11 * @param {string} method
12 * @param {Function=} opt_stubFunction
13 * @return {sinon.TestStub} 7 * @return {sinon.TestStub}
14 * @suppress {reportUnknownTypes}
15 */ 8 */
16 sinon.$setupStub = function(obj, method, opt_stubFunction) { 9 function $testStub(/** Object */ object) {
17 sinon.stub(obj, method, opt_stubFunction); 10 base.debug.assert(object.hasOwnProperty("getCall"));
18 obj[method].$testStub = /** @type {sinon.TestStub} */ (obj[method]); 11 return /** @type {sinon.TestStub} */ (object);
19 return obj[method].$testStub;
20 }; 12 };
21
22 };
OLDNEW
« no previous file with comments | « remoting/webapp/unittests/l10n_unittest.js ('k') | remoting/webapp/unittests/test_start.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698