| 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 ff8fdcb79987943b008aa69738812ad856a2c5a6..badde4435c1e93e29ac1440a38ddeabb5b28cc1d 100644
|
| --- a/chrome/browser/resources/google_now/background_unittest.gtestjs
|
| +++ b/chrome/browser/resources/google_now/background_unittest.gtestjs
|
| @@ -467,6 +467,7 @@ function mockInitializeDependencies(fixture) {
|
| 'chrome.storage.local.remove',
|
| 'instrumented.metricsPrivate.getVariationParams',
|
| 'instrumented.notifications.getAll',
|
| + 'instrumented.notifications.getPermissionLevel',
|
| 'instrumented.preferencesPrivate.googleGeolocationAccessEnabled.get',
|
| 'instrumented.storage.local.get',
|
| 'tasks.add',
|
| @@ -485,13 +486,16 @@ function mockInitializeDependencies(fixture) {
|
| * @param {string} testIdentityToken getAuthToken callback token.
|
| * @param {boolean} testGeolocationPref Geolocation Preference callback value.
|
| * @param {object} testExperimentVariationParams Response of
|
| - * metricsPrivate.getVariationParams
|
| + * metricsPrivate.getVariationParams.
|
| + * @param {string} testExperimentVariationParams Response of
|
| + * notifications.getPermissionLevel.
|
| */
|
| function expectStateMachineCalls(
|
| fixture,
|
| testIdentityToken,
|
| testGeolocationPref,
|
| - testExperimentVariationParams) {
|
| + testExperimentVariationParams,
|
| + testNotificationPermissionLevel) {
|
| var authenticationManagerIsSignedInSavedArgs = new SaveMockArguments();
|
| fixture.mockApis.expects(once()).
|
| authenticationManager_isSignedIn(
|
| @@ -517,6 +521,15 @@ function expectStateMachineCalls(
|
| will(invokeCallback(
|
| googleGeolocationPrefGetSavedArgs, 1, {value: testGeolocationPref}));
|
|
|
| + var notificationGetPermissionLevelSavedArgs = new SaveMockArguments();
|
| + fixture.mockApis.expects(once()).
|
| + instrumented_notifications_getPermissionLevel(
|
| + notificationGetPermissionLevelSavedArgs.match(ANYTHING)).
|
| + will(invokeCallback(
|
| + notificationGetPermissionLevelSavedArgs,
|
| + 0,
|
| + testNotificationPermissionLevel))
|
| +
|
| fixture.mockGlobals.expects(once()).
|
| setBackgroundEnable(ANYTHING);
|
| }
|
| @@ -556,6 +569,7 @@ TEST_F(
|
| var testIdentityToken = undefined;
|
| var testGeolocationPref = false;
|
| var testExperimentVariationParams = {};
|
| + var testNotificationPermissionLevel = 'denied';
|
|
|
| mockInitializeDependencies(this);
|
|
|
| @@ -571,7 +585,8 @@ TEST_F(
|
| this,
|
| testIdentityToken,
|
| testGeolocationPref,
|
| - testExperimentVariationParams);
|
| + testExperimentVariationParams,
|
| + testNotificationPermissionLevel);
|
|
|
| // Invoking the tested function.
|
| initialize();
|
| @@ -589,6 +604,7 @@ TEST_F(
|
| var testIdentityToken = 'some identity token';
|
| var testGeolocationPref = false;
|
| var testExperimentVariationParams = {};
|
| + var testNotificationPermissionLevel = 'denied';
|
|
|
| mockInitializeDependencies(this);
|
|
|
| @@ -601,7 +617,8 @@ TEST_F(
|
| this,
|
| testIdentityToken,
|
| testGeolocationPref,
|
| - testExperimentVariationParams);
|
| + testExperimentVariationParams,
|
| + testNotificationPermissionLevel);
|
|
|
| var chromeNotificationGetAllSavedArgs = new SaveMockArguments();
|
| this.mockApis.expects(exactly(1)).
|
| @@ -623,6 +640,7 @@ TEST_F('GoogleNowBackgroundUnitTest', 'Initialize_RunGoogleNow', function() {
|
| var testIdentityToken = 'some identity token';
|
| var testGeolocationPref = true;
|
| var testExperimentVariationParams = {};
|
| + var testNotificationPermissionLevel = 'granted';
|
|
|
| mockInitializeDependencies(this);
|
|
|
| @@ -635,7 +653,8 @@ TEST_F('GoogleNowBackgroundUnitTest', 'Initialize_RunGoogleNow', function() {
|
| this,
|
| testIdentityToken,
|
| testGeolocationPref,
|
| - testExperimentVariationParams);
|
| + testExperimentVariationParams,
|
| + testNotificationPermissionLevel);
|
|
|
| this.mockGlobals.expects(once()).startPollingCards();
|
|
|
| @@ -654,6 +673,7 @@ TEST_F(
|
| var testIdentityToken = 'some identity token';
|
| var testGeolocationPref = false;
|
| var testExperimentVariationParams = {};
|
| + var testNotificationPermissionLevel = 'denied';
|
|
|
| mockInitializeDependencies(this);
|
|
|
| @@ -669,7 +689,9 @@ TEST_F(
|
| this,
|
| testIdentityToken,
|
| testGeolocationPref,
|
| - testExperimentVariationParams);
|
| + testExperimentVariationParams,
|
| + testNotificationPermissionLevel,
|
| + testNotificationPermissionLevel);
|
|
|
| var chromeNotificationGetAllSavedArgs = new SaveMockArguments();
|
| this.mockApis.expects(exactly(2)).
|
|
|