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

Unified Diff: chrome/test/data/webui/mock_controller.js

Issue 621693002: Revert of Unit test for sync online wallpaper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « chrome/test/data/chromeos/wallpaper_manager/unit_tests/event_page_unittest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/mock_controller.js
diff --git a/chrome/test/data/webui/mock_controller.js b/chrome/test/data/webui/mock_controller.js
index 62587184f3eb488e94952e9917d8c2b6188c321a..378fdc353967085027d07a0cb999b4ff059158af 100644
--- a/chrome/test/data/webui/mock_controller.js
+++ b/chrome/test/data/webui/mock_controller.js
@@ -10,20 +10,8 @@
function MockMethod() {
var fn = function() {
var args = Array.prototype.slice.call(arguments);
- var callbacks =
- args.filter(function(arg) { return (typeof arg == 'function'); });
-
- if (callbacks.length > 1) {
- console.error('Only support mocking function with at most one callback.');
- return;
- }
-
fn.recordCall(args);
- if (callbacks.length == 1) {
- callbacks[0].apply(undefined, fn.callbackData);
- return;
- }
- return fn.returnValue;
+ return this.returnValue;
};
/**
@@ -46,12 +34,6 @@
*/
fn.returnValue = undefined;
- /**
- * List of arguments for callback function.
- * @type {!Array.<!Array>}
- */
- fn.callbackData = [];
-
fn.__proto__ = MockMethod.prototype;
return fn;
}
@@ -63,7 +45,7 @@
*/
addExpectation: function() {
var args = Array.prototype.slice.call(arguments);
- this.expectations_.push(args.filter(this.notFunction_));
+ this.expectations_.push(args);
},
/**
@@ -71,7 +53,7 @@
* @param {!Array} args.
*/
recordCall: function(args) {
- this.calls_.push(args.filter(this.notFunction_));
+ this.calls_.push(args);
},
/**
@@ -102,15 +84,6 @@
validateCall: function(index, expected, observed) {
assertDeepEquals(expected, observed);
},
-
- /**
- * Test if arg is a function.
- * @param {*} arg The argument to test.
- * @return True if arg is not function type.
- */
- notFunction_: function(arg) {
- return typeof arg != 'function';
- }
};
/**
« no previous file with comments | « chrome/test/data/chromeos/wallpaper_manager/unit_tests/event_page_unittest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698