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

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

Issue 2044003005: [Sync] Display correct message for actionable error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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_ui_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/sync_ui_util_unittest.cc
diff --git a/chrome/browser/sync/sync_ui_util_unittest.cc b/chrome/browser/sync/sync_ui_util_unittest.cc
index 7fdf0d18834ce9853977bb6d176c0917a20df281..5c0ecf0d53d529e02b8deb9088085b2f62cd64a2 100644
--- a/chrome/browser/sync/sync_ui_util_unittest.cc
+++ b/chrome/browser/sync/sync_ui_util_unittest.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/signin/account_tracker_service_factory.h"
#include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/signin_error_controller_factory.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/sync/profile_sync_test_util.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/grit/generated_resources.h"
@@ -158,9 +159,6 @@ TEST_F(SyncUIUtilTest, AuthStateGlobalError) {
GoogleServiceAuthError::HOSTED_NOT_ALLOWED
};
- FakeSigninManagerBase signin(
- ChromeSigninClientFactory::GetForProfile(profile.get()),
- AccountTrackerServiceFactory::GetForProfile(profile.get()));
for (size_t i = 0; i < arraysize(table); ++i) {
VerifySyncGlobalErrorResult(&service,
table[i],
@@ -405,3 +403,36 @@ TEST_F(SyncUIUtilTest, HtmlNotIncludedInStatusIfNotRequested) {
signin.Shutdown();
}
}
+
+TEST_F(SyncUIUtilTest, UnrecoverableErrorWithActionableError) {
+ std::unique_ptr<Profile> profile(MakeSignedInTestingProfile());
+ SigninManagerBase* signin =
+ SigninManagerFactory::GetForProfile(profile.get());
+
+ ProfileSyncServiceMock service(
+ CreateProfileSyncServiceParamsForTest(profile.get()));
+ EXPECT_CALL(service, IsFirstSetupComplete()).WillRepeatedly(Return(true));
+ EXPECT_CALL(service, HasUnrecoverableError()).WillRepeatedly(Return(true));
+
+ // First time action is not set. We should get unrecoverable error.
+ syncer::SyncStatus status;
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillOnce(DoAll(SetArgPointee<0>(status), Return(true)));
+
+ base::string16 link_label;
+ base::string16 unrecoverable_error_status_label;
+ sync_ui_util::GetStatusLabels(profile.get(), &service, *signin,
+ sync_ui_util::PLAIN_TEXT,
+ &unrecoverable_error_status_label, &link_label);
+
+ // This time set action to UPGRADE_CLIENT. Ensure that status label differs
+ // from previous one.
+ status.sync_protocol_error.action = syncer::UPGRADE_CLIENT;
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillOnce(DoAll(SetArgPointee<0>(status), Return(true)));
+ base::string16 upgrade_client_status_label;
+ sync_ui_util::GetStatusLabels(profile.get(), &service, *signin,
+ sync_ui_util::PLAIN_TEXT,
+ &upgrade_client_status_label, &link_label);
+ EXPECT_NE(unrecoverable_error_status_label, upgrade_client_status_label);
+}
« no previous file with comments | « chrome/browser/sync/sync_ui_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698