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

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

Issue 23477006: Unit tests for utility.js (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing unit test + more arv@ comments Created 7 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 | « no previous file | chrome/browser/resources/google_now/background_unittest.gtestjs » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d50207b1c42a7e8cbcb2ef51cbc07d31c3be111e..3bbf5a4270dcb9eb584a046dd02a73d81984b903 100644
--- a/chrome/browser/resources/google_now/background_test_util.js
+++ b/chrome/browser/resources/google_now/background_test_util.js
@@ -4,8 +4,6 @@
// Mocks for globals needed for loading background.js.
-function emptyMock() {}
-
var wrapper = {instrumentChromeApiFunction: emptyMock};
function buildTaskManager() {
@@ -21,21 +19,14 @@ function buildAuthenticationManager() {
var instrumentApiFunction = emptyMock;
var buildAttemptManager = emptyMock;
var buildCardSet = emptyMock;
-var emptyListener = {addListener: emptyMock};
+
var instrumented = {};
-instrumented['location'] = {onLocationUpdate: emptyListener};
-instrumented['notifications'] = {
- onButtonClicked: emptyListener,
- onClicked: emptyListener,
- onClosed: emptyListener
-};
-instrumented['omnibox'] = {onInputEntered: emptyListener};
-instrumented['preferencesPrivate'] = {
- googleGeolocationAccessEnabled: {
- onChange: emptyListener
- }
-};
-instrumented['runtime'] = {
- onInstalled: emptyListener,
- onStartup: emptyListener
-};
+mockChromeEvent(instrumented, 'location.onLocationUpdate');
+mockChromeEvent(instrumented, 'notifications.onButtonClicked');
+mockChromeEvent(instrumented, 'notifications.onClicked');
+mockChromeEvent(instrumented, 'notifications.onClosed');
+mockChromeEvent(instrumented, 'omnibox.onInputEntered');
+mockChromeEvent(
+ instrumented, 'preferencesPrivate.googleGeolocationAccessEnabled.onChange');
+mockChromeEvent(instrumented, 'runtime.onInstalled');
+mockChromeEvent(instrumented, 'runtime.onStartup');
« no previous file with comments | « no previous file | chrome/browser/resources/google_now/background_unittest.gtestjs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698