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

Unified Diff: chrome/browser/ui/webui/sync_setup_handler_unittest.cc

Issue 11348220: sync: centralize sync startup decisions in TryStart. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reviews Created 8 years, 1 month 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 | « chrome/browser/ui/webui/sync_setup_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
« no previous file with comments | « chrome/browser/ui/webui/sync_setup_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698