| Index: chrome/browser/resources/google_now/background_unittest.gtestjs
|
| diff --git a/chrome/browser/resources/google_now/background_unittest.gtestjs b/chrome/browser/resources/google_now/background_unittest.gtestjs
|
| index cc8e2da5f17e754700587b2aa4fbec7afcc80a2c..67e252f8e54002d8268efcf4b19c36b7e90124f4 100644
|
| --- a/chrome/browser/resources/google_now/background_unittest.gtestjs
|
| +++ b/chrome/browser/resources/google_now/background_unittest.gtestjs
|
| @@ -486,13 +486,16 @@ function mockInitializeDependencies(fixture) {
|
| * metricsPrivate.getVariationParams.
|
| * @param {string} testExperimentVariationParams Response of
|
| * notifications.getPermissionLevel.
|
| + * @param {boolean} testGoogleNowEnabled True if the user is opted in to Google
|
| + * Now.
|
| */
|
| function expectStateMachineCalls(
|
| fixture,
|
| testIdentityToken,
|
| testGeolocationPref,
|
| testExperimentVariationParams,
|
| - testNotificationPermissionLevel) {
|
| + testNotificationPermissionLevel,
|
| + testGoogleNowEnabled) {
|
| var authenticationManagerIsSignedInSavedArgs = new SaveMockArguments();
|
| fixture.mockApis.expects(once()).
|
| authenticationManager_isSignedIn(
|
| @@ -527,6 +530,14 @@ function expectStateMachineCalls(
|
| 0,
|
| testNotificationPermissionLevel))
|
|
|
| + var storageGetSavedArgs = new SaveMockArguments();
|
| + fixture.mockApis.expects(once()).
|
| + instrumented_storage_local_get(
|
| + storageGetSavedArgs.match(eq('googleNowEnabled')),
|
| + storageGetSavedArgs.match(ANYTHING)).
|
| + will(invokeCallback(
|
| + storageGetSavedArgs, 1, {googleNowEnabled: testGoogleNowEnabled}));
|
| +
|
| fixture.mockGlobals.expects(once()).
|
| setBackgroundEnable(ANYTHING);
|
| }
|
| @@ -567,6 +578,7 @@ TEST_F(
|
| var testGeolocationPref = false;
|
| var testExperimentVariationParams = {};
|
| var testNotificationPermissionLevel = 'denied';
|
| + var testGoogleNowEnabled = undefined;
|
|
|
| mockInitializeDependencies(this);
|
|
|
| @@ -583,7 +595,8 @@ TEST_F(
|
| testIdentityToken,
|
| testGeolocationPref,
|
| testExperimentVariationParams,
|
| - testNotificationPermissionLevel);
|
| + testNotificationPermissionLevel,
|
| + testGoogleNowEnabled);
|
|
|
| // Invoking the tested function.
|
| initialize();
|
| @@ -602,6 +615,7 @@ TEST_F(
|
| var testGeolocationPref = false;
|
| var testExperimentVariationParams = {};
|
| var testNotificationPermissionLevel = 'denied';
|
| + var testGoogleNowEnabled = undefined;
|
|
|
| mockInitializeDependencies(this);
|
|
|
| @@ -615,7 +629,8 @@ TEST_F(
|
| testIdentityToken,
|
| testGeolocationPref,
|
| testExperimentVariationParams,
|
| - testNotificationPermissionLevel);
|
| + testNotificationPermissionLevel,
|
| + testGoogleNowEnabled);
|
|
|
| var chromeNotificationGetAllSavedArgs = new SaveMockArguments();
|
| this.mockApis.expects(exactly(1)).
|
| @@ -638,6 +653,7 @@ TEST_F('GoogleNowBackgroundUnitTest', 'Initialize_RunGoogleNow', function() {
|
| var testGeolocationPref = true;
|
| var testExperimentVariationParams = {};
|
| var testNotificationPermissionLevel = 'granted';
|
| + var testGoogleNowEnabled = true;
|
|
|
| mockInitializeDependencies(this);
|
|
|
| @@ -651,7 +667,8 @@ TEST_F('GoogleNowBackgroundUnitTest', 'Initialize_RunGoogleNow', function() {
|
| testIdentityToken,
|
| testGeolocationPref,
|
| testExperimentVariationParams,
|
| - testNotificationPermissionLevel);
|
| + testNotificationPermissionLevel,
|
| + testGoogleNowEnabled);
|
|
|
| this.mockGlobals.expects(once()).startPollingCards();
|
|
|
| @@ -671,6 +688,8 @@ TEST_F(
|
| var testGeolocationPref = false;
|
| var testExperimentVariationParams = {};
|
| var testNotificationPermissionLevel = 'denied';
|
| + var testGoogleNowEnabled = undefined;
|
| +
|
|
|
| mockInitializeDependencies(this);
|
|
|
| @@ -688,7 +707,8 @@ TEST_F(
|
| testGeolocationPref,
|
| testExperimentVariationParams,
|
| testNotificationPermissionLevel,
|
| - testNotificationPermissionLevel);
|
| + testNotificationPermissionLevel,
|
| + testGoogleNowEnabled);
|
|
|
| var chromeNotificationGetAllSavedArgs = new SaveMockArguments();
|
| this.mockApis.expects(exactly(2)).
|
|
|