Index: chrome/browser/ui/webui/sync_setup_handler_unittest.cc |
diff --git a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc |
index 3c2ae6d66cb2ca184cfce3884abfe4331a2c44fe..a27deb5c2632ee3747810d137f2de62569334230 100644 |
--- a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc |
+++ b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc |
@@ -497,6 +497,10 @@ TEST_F(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { |
EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); |
EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(false)); |
+ // We're simulating a user setting up sync, which would cause the backend to |
+ // kick off initialization, but not download user data types. It will try to |
James Hawkins
2012/11/30 19:54:08
Does 'it' refer to the backend here?
tim (not reviewing)
2012/11/30 20:08:08
Yeah. Changed to make it more obvious.
|
+ // download control data types (e.g encryption info), but that won't finish |
+ // for this test as we're simulating cancelling while the spinner is showing. |
handler_->OpenSyncSetup(false); |
EXPECT_EQ(handler_.get(), |
LoginUIServiceFactory::GetForProfile( |
@@ -557,6 +561,37 @@ TEST_F(SyncSetupHandlerTest, |
CheckBool(dictionary, "usePassphrase", false); |
} |
+// Same as above, except cancel after the sync backend has initialized but |
James Hawkins
2012/11/30 19:54:08
Optional nit: Copy/paste part of the test descript
tim (not reviewing)
2012/11/30 20:08:08
Done.
|
+// before the user has continued on. |
+TEST_F(SyncSetupHandlerTest, |
+ DisplayConfigureWithBackendDisabledAndCancelAfterSigninSuccess) { |
+ EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) |
+ .WillRepeatedly(Return(true)); |
+ EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) |
+ .WillRepeatedly(Return(true)); |
+ EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
+ .WillRepeatedly(Return(false)); |
+ error_ = GoogleServiceAuthError::None(); |
+ EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); |
+ EXPECT_CALL(*mock_pss_, sync_initialized()) |
+ .WillOnce(Return(false)) |
+ .WillRepeatedly(Return(true)); |
+ SetDefaultExpectationsForConfigPage(); |
+ handler_->OpenSyncSetup(false); |
+ handler_->SigninSuccess(); |
+ |
+ // It's important to tell sync the user cancelled the setup flow before we |
+ // tell it we're through with the setup progress. |
+ testing::InSequence seq; |
+ EXPECT_CALL(*mock_pss_, DisableForUser()); |
+ EXPECT_CALL(*mock_pss_, SetSetupInProgress(false)); |
+ |
+ handler_->CloseSyncSetup(); |
+ EXPECT_EQ(NULL, |
+ LoginUIServiceFactory::GetForProfile( |
+ profile_.get())->current_login_ui()); |
+} |
+ |
TEST_F(SyncSetupHandlerTest, |
DisplayConfigureWithBackendDisabledAndSigninFalied) { |
EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) |