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 6ed7d5d37c20ff202a903cb807fcbf81a112308e..b00954853e1f54937470a723fe46582b0917d2bc 100644 |
--- a/chrome/browser/sync/sync_ui_util_unittest.cc |
+++ b/chrome/browser/sync/sync_ui_util_unittest.cc |
@@ -4,7 +4,9 @@ |
#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/sync/profile_sync_service_mock.h" |
#include "chrome/browser/sync/sync_ui_util.h" |
#include "content/test/test_browser_thread.h" |
@@ -42,14 +44,6 @@ void VerifySyncGlobalErrorResult(NiceMock<ProfileSyncServiceMock>* service, |
EXPECT_CALL(*service, HasSyncSetupCompleted()) |
.WillRepeatedly(Return(is_signed_in)); |
- if (error_state == GoogleServiceAuthError::SERVICE_UNAVAILABLE) { |
- EXPECT_CALL(*service, GetAuthenticatedUsername()) |
- .WillRepeatedly(Return(UTF8ToUTF16(""))); |
- } else { |
- EXPECT_CALL(*service, GetAuthenticatedUsername()) |
- .WillRepeatedly(Return(UTF8ToUTF16("foo"))); |
- } |
- |
GoogleServiceAuthError auth_error(error_state); |
EXPECT_CALL(*service, GetAuthError()).WillRepeatedly(ReturnRef(auth_error)); |
@@ -66,7 +60,9 @@ void VerifySyncGlobalErrorResult(NiceMock<ProfileSyncServiceMock>* service, |
TEST(SyncUIUtilTest, ConstructAboutInformationWithUnrecoverableErrorTest) { |
MessageLoopForUI message_loop; |
content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); |
- NiceMock<ProfileSyncServiceMock> service; |
+ scoped_ptr<Profile> profile( |
+ ProfileSyncServiceMock::MakeSignedInTestingProfile()); |
+ NiceMock<ProfileSyncServiceMock> service(profile.get()); |
DictionaryValue strings; |
// Will be released when the dictionary is destroyed |
@@ -99,7 +95,9 @@ TEST(SyncUIUtilTest, ConstructAboutInformationWithUnrecoverableErrorTest) { |
TEST(SyncUIUtilTest, PassphraseGlobalError) { |
MessageLoopForUI message_loop; |
content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); |
- NiceMock<ProfileSyncServiceMock> service; |
+ scoped_ptr<Profile> profile( |
+ ProfileSyncServiceMock::MakeSignedInTestingProfile()); |
+ NiceMock<ProfileSyncServiceMock> service(profile.get()); |
EXPECT_CALL(service, IsPassphraseRequired()) |
.WillOnce(Return(true)); |
@@ -115,7 +113,9 @@ TEST(SyncUIUtilTest, PassphraseGlobalError) { |
TEST(SyncUIUtilTest, AuthStateGlobalError) { |
MessageLoopForUI message_loop; |
content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); |
- NiceMock<ProfileSyncServiceMock> service; |
+ scoped_ptr<Profile> profile( |
+ ProfileSyncServiceMock::MakeSignedInTestingProfile()); |
+ NiceMock<ProfileSyncServiceMock> service(profile.get()); |
browser_sync::SyncBackendHost::Status status; |
EXPECT_CALL(service, QueryDetailedSyncStatus()) |