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

Unified Diff: chrome/browser/resources/google_now/background_test_util.js

Issue 19749007: Processing timefences from the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: arv@ notes Created 7 years, 5 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
Index: chrome/browser/resources/google_now/background_test_util.js
diff --git a/chrome/browser/resources/google_now/background_test_util.js b/chrome/browser/resources/google_now/background_test_util.js
index b4d2bccb9b0268e2cfa24261dfd71cf900340a0a..a2309c1369db30bd30875107e5fec8321d2d4d27 100644
--- a/chrome/browser/resources/google_now/background_test_util.js
+++ b/chrome/browser/resources/google_now/background_test_util.js
@@ -10,6 +10,7 @@ function buildTaskManager() {
}
var instrumentApiFunction = emptyMock;
var buildAttemptManager = emptyMock;
+var buildCardSet = emptyMock;
var emptyListener = {addListener: emptyMock};
chrome['location'] = {onLocationUpdate: emptyListener};
chrome['notifications'] = {
@@ -24,61 +25,3 @@ chrome['runtime'] = {
};
var storage = {};
-
-/**
- * Syntactic sugar for use with will() on a Mock4JS.Mock.
- * Creates an action for will() that invokes a callback that the tested code
- * passes to a mocked function.
- * @param {SaveMockArguments} savedArgs Arguments that will contain the
- * callback once the mocked function is called.
- * @param {number} callbackParameter Index of the callback parameter in
- * |savedArgs|.
- * @param {...Object} var_args Arguments to pass to the callback.
- * @return {CallFunctionAction} Action for use in will().
- */
-function invokeCallback(savedArgs, callbackParameter, var_args) {
- var callbackArguments = Array.prototype.slice.call(arguments, 2);
- return callFunction(function() {
- savedArgs.arguments[callbackParameter].apply(null, callbackArguments);
- });
-}
-
-/**
- * Mock4JS matcher object that matches the actual agrument and the expected
- * value iff their JSON represenations are same.
- * @param {Object} expectedValue Expected value.
- * @constructor
- */
-function MatchJSON(expectedValue) {
- this.expectedValue_ = expectedValue;
-}
-
-MatchJSON.prototype = {
- /**
- * Checks that JSON represenation of the actual and expected arguments are
- * same.
- * @param {Object} actualArgument The argument to match.
- * @return {boolean} Result of the comparison.
- */
- argumentMatches: function(actualArgument) {
- return JSON.stringify(this.expectedValue_) ===
- JSON.stringify(actualArgument);
- },
-
- /**
- * Describes the matcher.
- * @return {string} Description of this Mock4JS matcher.
- */
- describe: function() {
- return 'eqJSON(' + JSON.stringify(this.expectedValue_) + ')';
- }
-};
-
-/**
- * Builds a MatchJSON agrument matcher for a given expected value.
- * @param {Object} expectedValue Expected value.
- * @return {MatchJSON} Resulting Mock4JS matcher.
- */
-function eqJSON(expectedValue) {
- return new MatchJSON(expectedValue);
-}
« no previous file with comments | « chrome/browser/resources/google_now/background.js ('k') | chrome/browser/resources/google_now/background_unittest.gtestjs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698