summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/sync_ui_util_unittest.cc
diff options
context:
space:
mode:
authorrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-09 21:11:41 +0000
committerrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-09 21:11:41 +0000
commite1011c9cd18af7ec751bf94d02b3b37a7f64f92f (patch)
tree6a749a53f2ed1d45cc2ef7362a0b80650b3af646 /chrome/browser/sync/sync_ui_util_unittest.cc
parentf22fae44c1e8dadee6cf78b7a01a6465dfe33656 (diff)
downloadchromium_src-e1011c9cd18af7ec751bf94d02b3b37a7f64f92f.zip
chromium_src-e1011c9cd18af7ec751bf94d02b3b37a7f64f92f.tar.gz
chromium_src-e1011c9cd18af7ec751bf94d02b3b37a7f64f92f.tar.bz2
Move ownership of SigninGlobalError from SigninManager to
ProfileOAuth2TokenService. BUG=249467 Review URL: https://chromiumcodereview.appspot.com/17007003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210618 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/sync_ui_util_unittest.cc')
-rw-r--r--chrome/browser/sync/sync_ui_util_unittest.cc34
1 files changed, 21 insertions, 13 deletions
diff --git a/chrome/browser/sync/sync_ui_util_unittest.cc b/chrome/browser/sync/sync_ui_util_unittest.cc
index 00d0073..7246f8f 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/sync/profile_sync_service_mock.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "grit/generated_resources.h"
#include "testing/gmock/include/gmock/gmock-actions.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -66,11 +67,14 @@ void VerifySyncGlobalErrorResult(NiceMock<ProfileSyncServiceMock>* service,
} // namespace
+class SyncUIUtilTest : public testing::Test {
+ private:
+ content::TestBrowserThreadBundle thread_bundle_;
+};
+
// Test that GetStatusLabelsForSyncGlobalError returns an error if a
// passphrase is required.
-TEST(SyncUIUtilTest, PassphraseGlobalError) {
- base::MessageLoopForUI message_loop;
- content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
+TEST_F(SyncUIUtilTest, PassphraseGlobalError) {
scoped_ptr<Profile> profile(
ProfileSyncServiceMock::MakeSignedInTestingProfile());
NiceMock<ProfileSyncServiceMock> service(profile.get());
@@ -88,9 +92,7 @@ TEST(SyncUIUtilTest, PassphraseGlobalError) {
// Test that GetStatusLabelsForSyncGlobalError returns an error if a
// passphrase is required and not for auth errors.
-TEST(SyncUIUtilTest, AuthAndPassphraseGlobalError) {
- base::MessageLoopForUI message_loop;
- content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
+TEST_F(SyncUIUtilTest, AuthAndPassphraseGlobalError) {
scoped_ptr<Profile> profile(
ProfileSyncServiceMock::MakeSignedInTestingProfile());
NiceMock<ProfileSyncServiceMock> service(profile.get());
@@ -120,9 +122,7 @@ TEST(SyncUIUtilTest, AuthAndPassphraseGlobalError) {
// Test that GetStatusLabelsForSyncGlobalError does not indicate errors for
// auth errors (these are reported through SigninGlobalError).
-TEST(SyncUIUtilTest, AuthStateGlobalError) {
- base::MessageLoopForUI message_loop;
- content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
+TEST_F(SyncUIUtilTest, AuthStateGlobalError) {
scoped_ptr<Profile> profile(
ProfileSyncServiceMock::MakeSignedInTestingProfile());
NiceMock<ProfileSyncServiceMock> service(profile.get());
@@ -319,15 +319,18 @@ void GetDistinctCase(ProfileSyncServiceMock& service,
// This test ensures that a each distinctive ProfileSyncService statuses
// will return a unique combination of status and link messages from
// GetStatusLabels().
-TEST(SyncUIUtilTest, DistinctCasesReportUniqueMessageSets) {
+TEST_F(SyncUIUtilTest, DistinctCasesReportUniqueMessageSets) {
std::set<string16> messages;
for (int idx = 0; idx != NUMBER_OF_STATUS_CASES; idx++) {
scoped_ptr<Profile> profile(new TestingProfile());
ProfileSyncServiceMock service(profile.get());
+ GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone();
+ EXPECT_CALL(service, GetAuthError()).WillRepeatedly(ReturnRef(error));
FakeSigninManagerForSyncUIUtilTest signin(profile.get());
signin.SetAuthenticatedUsername("test_user@test.com");
scoped_ptr<FakeAuthStatusProvider> provider(
- new FakeAuthStatusProvider(signin.signin_global_error()));
+ new FakeAuthStatusProvider(
+ SigninGlobalError::GetForProfile(profile.get())));
GetDistinctCase(service, &signin, provider.get(), idx);
string16 status_label;
string16 link_label;
@@ -348,6 +351,7 @@ TEST(SyncUIUtilTest, DistinctCasesReportUniqueMessageSets) {
messages.insert(combined_label);
testing::Mock::VerifyAndClearExpectations(&service);
testing::Mock::VerifyAndClearExpectations(&signin);
+ EXPECT_CALL(service, GetAuthError()).WillRepeatedly(ReturnRef(error));
provider.reset();
signin.Shutdown();
}
@@ -355,15 +359,18 @@ TEST(SyncUIUtilTest, DistinctCasesReportUniqueMessageSets) {
// This test ensures that the html_links parameter on GetStatusLabels() is
// honored.
-TEST(SyncUIUtilTest, HtmlNotIncludedInStatusIfNotRequested) {
+TEST_F(SyncUIUtilTest, HtmlNotIncludedInStatusIfNotRequested) {
for (int idx = 0; idx != NUMBER_OF_STATUS_CASES; idx++) {
scoped_ptr<Profile> profile(
ProfileSyncServiceMock::MakeSignedInTestingProfile());
ProfileSyncServiceMock service(profile.get());
+ GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone();
+ EXPECT_CALL(service, GetAuthError()).WillRepeatedly(ReturnRef(error));
FakeSigninManagerForSyncUIUtilTest signin(profile.get());
signin.SetAuthenticatedUsername("test_user@test.com");
scoped_ptr<FakeAuthStatusProvider> provider(
- new FakeAuthStatusProvider(signin.signin_global_error()));
+ new FakeAuthStatusProvider(
+ SigninGlobalError::GetForProfile(profile.get())));
GetDistinctCase(service, &signin, provider.get(), idx);
string16 status_label;
string16 link_label;
@@ -381,6 +388,7 @@ TEST(SyncUIUtilTest, HtmlNotIncludedInStatusIfNotRequested) {
string16::npos);
testing::Mock::VerifyAndClearExpectations(&service);
testing::Mock::VerifyAndClearExpectations(&signin);
+ EXPECT_CALL(service, GetAuthError()).WillRepeatedly(ReturnRef(error));
provider.reset();
signin.Shutdown();
}