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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/unittests/sinon_helpers.js
diff --git a/remoting/webapp/unittests/sinon_helpers.js b/remoting/webapp/unittests/sinon_helpers.js
index 1524b4077ffa1eb18477ef58c6c3ba20507045ad..ff4c944b42390fa59f1aa7bd9be166bb921b2d19 100644
--- a/remoting/webapp/unittests/sinon_helpers.js
+++ b/remoting/webapp/unittests/sinon_helpers.js
@@ -2,21 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-var sinonHelpers = {};
-
-sinonHelpers.reset = function() {
-
/**
- * @param {Object} obj
- * @param {string} method
- * @param {Function=} opt_stubFunction
+ * Casts an |object| to sinon.TestStub verifying that it's really a stub.
* @return {sinon.TestStub}
- * @suppress {reportUnknownTypes}
*/
-sinon.$setupStub = function(obj, method, opt_stubFunction) {
- sinon.stub(obj, method, opt_stubFunction);
- obj[method].$testStub = /** @type {sinon.TestStub} */ (obj[method]);
- return obj[method].$testStub;
-};
-
+function $testStub(/** Object */ object) {
+ base.debug.assert(object.hasOwnProperty("getCall"));
+ return /** @type {sinon.TestStub} */ (object);
};
« 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