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..35d5b207b31f925eb0de84a68f1a0f7d668a3199 100644 |
--- a/chrome/browser/resources/google_now/background_test_util.js |
+++ b/chrome/browser/resources/google_now/background_test_util.js |
@@ -6,18 +6,28 @@ |
function emptyMock() {} |
function buildTaskManager() { |
- return {instrumentApiFunction: emptyMock}; |
+ return { |
+ debugSetStepName: emptyMock, |
+ instrumentApiFunction: emptyMock, |
+ }; |
} |
var instrumentApiFunction = emptyMock; |
var buildAttemptManager = emptyMock; |
var emptyListener = {addListener: emptyMock}; |
-chrome['location'] = {onLocationUpdate: emptyListener}; |
+chrome['location'] = { |
+ onLocationUpdate: emptyListener, |
+}; |
chrome['notifications'] = { |
onButtonClicked: emptyListener, |
onClicked: emptyListener, |
onClosed: emptyListener |
}; |
chrome['omnibox'] = {onInputEntered: emptyListener}; |
+chrome['preferencesPrivate'] = { |
+ googleGeolocationAccessEnabled: { |
+ onChange: emptyListener |
+ } |
+}; |
chrome['runtime'] = { |
onInstalled: emptyListener, |
onStartup: emptyListener |
@@ -40,6 +50,11 @@ function invokeCallback(savedArgs, callbackParameter, var_args) { |
var callbackArguments = Array.prototype.slice.call(arguments, 2); |
return callFunction(function() { |
savedArgs.arguments[callbackParameter].apply(null, callbackArguments); |
+ |
+ // Mock4JS does not clear the saved args after invocation. |
+ // To allow reuse of the same SaveMockArguments for multiple |
+ // invocations with similar arguments, clear them here. |
+ savedArgs.arguments.splice(0, savedArgs.arguments.length); |
vadimt
2013/07/26 01:54:01
Why not savedArgs.arguments = []?
robliao
2013/07/26 08:11:23
It is tempting to do that, but savedArgs.arguments
|
}); |
} |