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

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

Issue 10696107: sync: Track validity of about:sync fields (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another rebase Created 8 years, 5 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') | chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm » ('j') | 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 2f8ea41fcbeac27e806d82ad92c08685cb0a1d5b..0448118334e066bf96ff1dea13dff38967667116 100644
--- a/chrome/browser/sync/sync_ui_util_unittest.cc
+++ b/chrome/browser/sync/sync_ui_util_unittest.cc
@@ -4,7 +4,6 @@
#include <set>
#include "base/basictypes.h"
-#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_manager.h"
@@ -19,9 +18,11 @@
#include "ui/base/l10n/l10n_util.h"
using ::testing::AtMost;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
+using ::testing::SetArgPointee;
+using ::testing::_;
using content::BrowserThread;
// A number of distinct states of the ProfileSyncService can be generated for
@@ -68,34 +69,6 @@ void VerifySyncGlobalErrorResult(NiceMock<ProfileSyncServiceMock>* service,
} // namespace
-TEST(SyncUIUtilTest, ConstructAboutInformationWithUnrecoverableErrorTest) {
- MessageLoopForUI message_loop;
- content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
- scoped_ptr<Profile> profile(
- ProfileSyncServiceMock::MakeSignedInTestingProfile());
- NiceMock<ProfileSyncServiceMock> service(profile.get());
- DictionaryValue strings;
-
- // Will be released when the dictionary is destroyed
- string16 str(ASCIIToUTF16("none"));
-
- browser_sync::SyncBackendHost::Status status;
-
- EXPECT_CALL(service, HasSyncSetupCompleted())
- .WillOnce(Return(true));
- EXPECT_CALL(service, QueryDetailedSyncStatus())
- .WillOnce(Return(status));
-
- EXPECT_CALL(service, HasUnrecoverableError())
- .WillRepeatedly(Return(true));
-
- EXPECT_CALL(service, GetLastSyncedTimeString())
- .WillOnce(Return(str));
-
- sync_ui_util::ConstructAboutInformation(&service, &strings);
-
- EXPECT_TRUE(strings.HasKey("unrecoverable_error_detected"));
-}
// Test that GetStatusLabelsForSyncGlobalError returns an error if a
// passphrase is required.
@@ -107,8 +80,8 @@ TEST(SyncUIUtilTest, PassphraseGlobalError) {
NiceMock<ProfileSyncServiceMock> service(profile.get());
FakeSigninManager signin;
browser_sync::SyncBackendHost::Status status;
- EXPECT_CALL(service, QueryDetailedSyncStatus())
- .WillRepeatedly(Return(status));
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillRepeatedly(Return(false));
EXPECT_CALL(service, IsPassphraseRequired())
.WillRepeatedly(Return(true));
@@ -128,8 +101,8 @@ TEST(SyncUIUtilTest, AuthAndPassphraseGlobalError) {
NiceMock<ProfileSyncServiceMock> service(profile.get());
FakeSigninManager signin;
browser_sync::SyncBackendHost::Status status;
- EXPECT_CALL(service, QueryDetailedSyncStatus())
- .WillRepeatedly(Return(status));
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillRepeatedly(Return(false));
EXPECT_CALL(service, IsPassphraseRequired())
.WillRepeatedly(Return(true));
@@ -160,8 +133,8 @@ TEST(SyncUIUtilTest, AuthStateGlobalError) {
NiceMock<ProfileSyncServiceMock> service(profile.get());
browser_sync::SyncBackendHost::Status status;
- EXPECT_CALL(service, QueryDetailedSyncStatus())
- .WillRepeatedly(Return(status));
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillRepeatedly(Return(false));
struct {
GoogleServiceAuthError::State error_state;
@@ -204,8 +177,9 @@ void GetDistinctCase(ProfileSyncServiceMock& service,
EXPECT_CALL(service, FirstSetupInProgress())
.WillOnce(Return(true));
browser_sync::SyncBackendHost::Status status;
- EXPECT_CALL(service, QueryDetailedSyncStatus())
- .WillOnce(Return(status));
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillOnce(DoAll(SetArgPointee<0>(status),
+ Return(false)));
*auth_error = new GoogleServiceAuthError(GoogleServiceAuthError::NONE);
EXPECT_CALL(service, GetAuthError())
.WillOnce(ReturnRef(**auth_error));
@@ -221,16 +195,18 @@ void GetDistinctCase(ProfileSyncServiceMock& service,
.WillOnce(Return(true));
EXPECT_CALL(signin, AuthInProgress()).WillRepeatedly(Return(false));
browser_sync::SyncBackendHost::Status status;
- EXPECT_CALL(service, QueryDetailedSyncStatus())
- .WillOnce(Return(status));
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillOnce(DoAll(SetArgPointee<0>(status),
+ Return(false)));
return;
}
case STATUS_CASE_AUTHENTICATING: {
EXPECT_CALL(service, HasSyncSetupCompleted())
.WillOnce(Return(true));
browser_sync::SyncBackendHost::Status status;
- EXPECT_CALL(service, QueryDetailedSyncStatus())
- .WillOnce(Return(status));
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillOnce(DoAll(SetArgPointee<0>(status),
+ Return(false)));
EXPECT_CALL(service, HasUnrecoverableError())
.WillOnce(Return(false));
EXPECT_CALL(signin, AuthInProgress()).WillRepeatedly(Return(true));
@@ -243,8 +219,9 @@ void GetDistinctCase(ProfileSyncServiceMock& service,
EXPECT_CALL(service, HasSyncSetupCompleted())
.WillOnce(Return(true));
browser_sync::SyncBackendHost::Status status;
- EXPECT_CALL(service, QueryDetailedSyncStatus())
- .WillOnce(Return(status));
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillOnce(DoAll(SetArgPointee<0>(status),
+ Return(false)));
*auth_error = new GoogleServiceAuthError(
GoogleServiceAuthError::SERVICE_UNAVAILABLE);
EXPECT_CALL(service, HasUnrecoverableError())
@@ -261,8 +238,9 @@ void GetDistinctCase(ProfileSyncServiceMock& service,
protocolError.action = syncer::STOP_AND_RESTART_SYNC;
browser_sync::SyncBackendHost::Status status;
status.sync_protocol_error = protocolError;
- EXPECT_CALL(service, QueryDetailedSyncStatus())
- .WillOnce(Return(status));
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillOnce(DoAll(SetArgPointee<0>(status),
+ Return(false)));
*auth_error = new GoogleServiceAuthError(GoogleServiceAuthError::NONE);
EXPECT_CALL(service, GetAuthError())
.WillOnce(ReturnRef(**auth_error));
@@ -275,8 +253,9 @@ void GetDistinctCase(ProfileSyncServiceMock& service,
EXPECT_CALL(service, HasSyncSetupCompleted())
.WillOnce(Return(true));
browser_sync::SyncBackendHost::Status status;
- EXPECT_CALL(service, QueryDetailedSyncStatus())
- .WillOnce(Return(status));
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillOnce(DoAll(SetArgPointee<0>(status),
+ Return(false)));
*auth_error = new GoogleServiceAuthError(GoogleServiceAuthError::NONE);
EXPECT_CALL(service, GetAuthError())
.WillOnce(ReturnRef(**auth_error));
@@ -293,8 +272,9 @@ void GetDistinctCase(ProfileSyncServiceMock& service,
EXPECT_CALL(service, HasSyncSetupCompleted())
.WillOnce(Return(true));
browser_sync::SyncBackendHost::Status status;
- EXPECT_CALL(service, QueryDetailedSyncStatus())
- .WillOnce(Return(status));
+ EXPECT_CALL(service, QueryDetailedSyncStatus(_))
+ .WillOnce(DoAll(SetArgPointee<0>(status),
+ Return(false)));
*auth_error = new GoogleServiceAuthError(GoogleServiceAuthError::NONE);
EXPECT_CALL(service, GetAuthError())
.WillOnce(ReturnRef(**auth_error));
« no previous file with comments | « chrome/browser/sync/sync_ui_util.cc ('k') | chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698