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

Unified Diff: chrome/browser/ui/webui/settings/people_handler_unittest.cc

Issue 2711993002: Ensure PeopleHandler only calls PSS::RequestStart in response to intention to configure sync (Closed)
Patch Set: Address comment Created 3 years, 10 months 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/settings/people_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/settings/people_handler_unittest.cc
diff --git a/chrome/browser/ui/webui/settings/people_handler_unittest.cc b/chrome/browser/ui/webui/settings/people_handler_unittest.cc
index c99641ff9f26eb05587c2c0558fb42830c36efa7..45c7fc1e74eea395207d05a254b0fd9952568ae4 100644
--- a/chrome/browser/ui/webui/settings/people_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/people_handler_unittest.cc
@@ -291,6 +291,8 @@ class PeopleHandlerTest : public testing::Test {
handler_->sync_startup_tracker_->OnStateChanged(mock_pss_);
}
+ void NotifySyncStateChanged() { handler_->OnStateChanged(mock_pss_); }
+
virtual std::string GetTestUser() {
return std::string(kTestUser);
}
@@ -370,6 +372,7 @@ TEST_F(PeopleHandlerTest, DisplayConfigureWithEngineDisabledAndCancel) {
EXPECT_CALL(*mock_pss_, IsFirstSetupComplete()).WillRepeatedly(Return(false));
error_ = GoogleServiceAuthError::AuthErrorNone();
EXPECT_CALL(*mock_pss_, IsEngineInitialized()).WillRepeatedly(Return(false));
+ EXPECT_CALL(*mock_pss_, RequestStart());
// We're simulating a user setting up sync, which would cause the engine to
// kick off initialization, but not download user data types. The sync
@@ -394,6 +397,7 @@ TEST_F(PeopleHandlerTest,
error_ = GoogleServiceAuthError::AuthErrorNone();
// Sync engine is stopped initially, and will start up.
EXPECT_CALL(*mock_pss_, IsEngineInitialized()).WillRepeatedly(Return(false));
+ EXPECT_CALL(*mock_pss_, RequestStart());
SetDefaultExpectationsForConfigPage();
handler_->OpenSyncSetup();
@@ -431,6 +435,7 @@ TEST_F(PeopleHandlerTest,
EXPECT_CALL(*mock_pss_, IsEngineInitialized())
.WillOnce(Return(false))
.WillRepeatedly(Return(true));
+ EXPECT_CALL(*mock_pss_, RequestStart());
SetDefaultExpectationsForConfigPage();
handler_->OpenSyncSetup();
@@ -451,6 +456,7 @@ TEST_F(PeopleHandlerTest, DisplayConfigureWithEngineDisabledAndSigninFailed) {
EXPECT_CALL(*mock_pss_, IsFirstSetupComplete()).WillRepeatedly(Return(false));
error_ = GoogleServiceAuthError::AuthErrorNone();
EXPECT_CALL(*mock_pss_, IsEngineInitialized()).WillRepeatedly(Return(false));
+ EXPECT_CALL(*mock_pss_, RequestStart());
handler_->OpenSyncSetup();
ExpectPageStatusChanged(PeopleHandler::kSpinnerPageStatus);
@@ -466,6 +472,14 @@ TEST_F(PeopleHandlerTest, DisplayConfigureWithEngineDisabledAndSigninFailed) {
profile_)->current_login_ui());
}
+// Tests that signals not related to user intention to configure sync don't
+// trigger sync engine start.
+TEST_F(PeopleHandlerTest, OnlyStartEngineWhenConfiguringSync) {
+ EXPECT_CALL(*mock_pss_, IsEngineInitialized()).WillRepeatedly(Return(false));
+ EXPECT_CALL(*mock_pss_, RequestStart()).Times(0);
+ NotifySyncStateChanged();
+}
+
#if !defined(OS_CHROMEOS)
class PeopleHandlerNonCrosTest : public PeopleHandlerTest {
« no previous file with comments | « chrome/browser/ui/webui/settings/people_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698