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 14d8e58429e11417fd0ff857ca6979d62f869761..8b902afd1b624afd4976242ceb2e2681ba7b45d0 100644 |
--- a/chrome/browser/resources/google_now/background_unittest.gtestjs |
+++ b/chrome/browser/resources/google_now/background_unittest.gtestjs |
@@ -279,6 +279,9 @@ TEST_F( |
this.mockGlobals.expects(once()).recordEvent( |
GoogleNowEvent.STOPPED); |
+ this.mockGlobals.expects(once()).recordEvent( |
+ GoogleNowEvent.SIGNED_OUT); |
+ |
expectInitialization(this.mockApis); |
expectStateMachineCalls( |
@@ -323,6 +326,104 @@ TEST_F('GoogleNowBackgroundUnitTest', 'Initialize_RunGoogleNow', function() { |
}); |
/** |
+ * No Cards Event Recording Tests |
+ */ |
+TEST_F('GoogleNowBackgroundUnitTest', 'NoCardsSignedOut', function() { |
+ var signedIn = false; |
+ var notificationEnabled = false; |
+ var googleNowEnabled = false; |
+ this.makeAndRegisterMockGlobals([ |
+ 'recordEvent', |
+ 'setBackgroundEnable', |
+ 'setShouldPollCards']); |
+ |
+ this.mockGlobals.stubs().setBackgroundEnable(ANYTHING); |
+ this.mockGlobals.stubs().setShouldPollCards(ANYTHING); |
+ |
+ this.mockGlobals.expects(once()).recordEvent( |
+ GoogleNowEvent.STOPPED); |
+ this.mockGlobals.expects(once()).recordEvent( |
+ GoogleNowEvent.SIGNED_OUT); |
+ this.mockGlobals.expects(never()).recordEvent( |
+ GoogleNowEvent.NOTIFICATION_DISABLED); |
+ this.mockGlobals.expects(never()).recordEvent( |
+ GoogleNowEvent.GOOGLE_NOW_DISABLED); |
+ updateRunningState(signedIn, true, notificationEnabled, googleNowEnabled); |
+}); |
+ |
+TEST_F( |
+ 'GoogleNowBackgroundUnitTest', |
+ 'NoCardsNotificationsDisabled', |
+ function() { |
+ var signedIn = true; |
+ var notificationEnabled = false; |
+ var googleNowEnabled = false; |
+ this.makeAndRegisterMockGlobals([ |
+ 'recordEvent', |
+ 'setBackgroundEnable', |
+ 'setShouldPollCards']); |
+ |
+ this.mockGlobals.stubs().setBackgroundEnable(ANYTHING); |
+ this.mockGlobals.stubs().setShouldPollCards(ANYTHING); |
+ |
+ this.mockGlobals.expects(once()).recordEvent( |
+ GoogleNowEvent.STOPPED); |
+ this.mockGlobals.expects(never()).recordEvent( |
+ GoogleNowEvent.SIGNED_OUT); |
+ this.mockGlobals.expects(once()).recordEvent( |
+ GoogleNowEvent.NOTIFICATION_DISABLED); |
+ this.mockGlobals.expects(never()).recordEvent( |
+ GoogleNowEvent.GOOGLE_NOW_DISABLED); |
+ updateRunningState(signedIn, true, notificationEnabled, googleNowEnabled); |
+ }); |
+ |
+TEST_F('GoogleNowBackgroundUnitTest', 'NoCardsGoogleNowDisabled', function() { |
+ var signedIn = true; |
+ var notificationEnabled = true; |
+ var googleNowEnabled = false; |
+ this.makeAndRegisterMockGlobals([ |
+ 'recordEvent', |
+ 'setBackgroundEnable', |
+ 'setShouldPollCards']); |
+ |
+ this.mockGlobals.stubs().setBackgroundEnable(ANYTHING); |
+ this.mockGlobals.stubs().setShouldPollCards(ANYTHING); |
+ |
+ this.mockGlobals.expects(never()).recordEvent( |
+ GoogleNowEvent.STOPPED); |
+ this.mockGlobals.expects(never()).recordEvent( |
+ GoogleNowEvent.SIGNED_OUT); |
+ this.mockGlobals.expects(never()).recordEvent( |
+ GoogleNowEvent.NOTIFICATION_DISABLED); |
+ this.mockGlobals.expects(once()).recordEvent( |
+ GoogleNowEvent.GOOGLE_NOW_DISABLED); |
+ updateRunningState(signedIn, true, notificationEnabled, googleNowEnabled); |
+}); |
+ |
+TEST_F('GoogleNowBackgroundUnitTest', 'NoCardsEverythingEnabled', function() { |
+ var signedIn = true; |
+ var notificationEnabled = true; |
+ var googleNowEnabled = true; |
+ this.makeAndRegisterMockGlobals([ |
+ 'recordEvent', |
+ 'setBackgroundEnable', |
+ 'setShouldPollCards']); |
+ |
+ this.mockGlobals.stubs().setBackgroundEnable(ANYTHING); |
+ this.mockGlobals.stubs().setShouldPollCards(ANYTHING); |
+ |
+ this.mockGlobals.expects(never()).recordEvent( |
+ GoogleNowEvent.STOPPED); |
+ this.mockGlobals.expects(never()).recordEvent( |
+ GoogleNowEvent.SIGNED_OUT); |
+ this.mockGlobals.expects(never()).recordEvent( |
+ GoogleNowEvent.NOTIFICATION_DISABLED); |
+ this.mockGlobals.expects(never()).recordEvent( |
+ GoogleNowEvent.GOOGLE_NOW_DISABLED); |
+ updateRunningState(signedIn, true, notificationEnabled, googleNowEnabled); |
+}); |
+ |
+/** |
* Mocks global functions and APIs that onNotificationClicked() depends upon. |
* @param {Test} fixture Test fixture. |
*/ |