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

Unified Diff: chrome/browser/sync/sync_global_error_unittest.cc

Issue 11886079: Revert 177136 due to memory error on Mac ASAN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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/sync/sync_global_error.cc ('k') | chrome/browser/sync/sync_ui_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/sync_global_error_unittest.cc
===================================================================
--- chrome/browser/sync/sync_global_error_unittest.cc (revision 177205)
+++ chrome/browser/sync/sync_global_error_unittest.cc (working copy)
@@ -113,7 +113,8 @@
// If there is an error then a wrench button badge, menu item, and bubble view
// should be shown.
EXPECT_EQ(error->HasBadge(), is_error);
- EXPECT_EQ(error->HasMenuItem() || error->HasBadge(), is_error);
+ EXPECT_EQ(error->HasMenuItem() || error->HasCustomizedSyncMenuItem(),
+ is_error);
EXPECT_EQ(error->HasBubbleView(), is_error);
// If there is an error then labels should not be empty.
@@ -181,3 +182,47 @@
&service, login_ui_service, browser(), &error,
GoogleServiceAuthError::NONE, true, true);
}
+
+// Test that SyncGlobalError shows an error for conditions that can be resolved
+// by the user and suppresses errors for conditions that cannot be resolved by
+// the user.
+TEST_F(SyncGlobalErrorTest, AuthStateGlobalError) {
+ scoped_ptr<Profile> profile(
+ ProfileSyncServiceMock::MakeSignedInTestingProfile());
+ NiceMock<ProfileSyncServiceMock> service(profile.get());
+ SigninManager* signin = SigninManagerFactory::GetForProfile(profile.get());
+ FakeLoginUIService* login_ui_service = static_cast<FakeLoginUIService*>(
+ LoginUIServiceFactory::GetInstance()->SetTestingFactoryAndUse(
+ profile.get(), BuildMockLoginUIService));
+ FakeLoginUI login_ui;
+ login_ui_service->SetLoginUI(&login_ui);
+ SyncGlobalError error(&service, signin);
+
+ browser_sync::SyncBackendHost::Status status;
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillRepeatedly(Return(false));
+
+ struct {
+ GoogleServiceAuthError::State error_state;
+ bool is_error;
+ } table[] = {
+ { GoogleServiceAuthError::NONE, false },
+ { GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, true },
+ { GoogleServiceAuthError::USER_NOT_SIGNED_UP, true },
+ { GoogleServiceAuthError::CONNECTION_FAILED, false },
+ { GoogleServiceAuthError::CAPTCHA_REQUIRED, true },
+ { GoogleServiceAuthError::ACCOUNT_DELETED, true },
+ { GoogleServiceAuthError::ACCOUNT_DISABLED, true },
+ { GoogleServiceAuthError::SERVICE_UNAVAILABLE, true },
+ { GoogleServiceAuthError::TWO_FACTOR, true },
+ { GoogleServiceAuthError::REQUEST_CANCELED, true },
+ { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true },
+ };
+
+ for (size_t i = 0; i < sizeof(table)/sizeof(*table); ++i) {
+ VerifySyncGlobalErrorResult(&service, login_ui_service, browser(), &error,
+ table[i].error_state, true, table[i].is_error);
+ VerifySyncGlobalErrorResult(&service, login_ui_service, browser(), &error,
+ table[i].error_state, false, false);
+ }
+}
« no previous file with comments | « chrome/browser/sync/sync_global_error.cc ('k') | chrome/browser/sync/sync_ui_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698