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

Side by Side Diff: chrome/browser/sync/sync_global_error_unittest.cc

Issue 9959038: Removed ProfileSyncService::UIShouldDepictAuthInProgress (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT. Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/sync_global_error.h" 5 #include "chrome/browser/sync/sync_global_error.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/signin/signin_manager.h" 10 #include "chrome/browser/signin/signin_manager.h"
11 #include "chrome/browser/signin/signin_manager_factory.h"
11 #include "chrome/browser/sync/profile_sync_service_mock.h" 12 #include "chrome/browser/sync/profile_sync_service_mock.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/test/base/browser_with_test_window_test.h" 14 #include "chrome/test/base/browser_with_test_window_test.h"
14 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
15 #include "content/test/test_browser_thread.h" 16 #include "content/test/test_browser_thread.h"
16 #include "testing/gmock/include/gmock/gmock-actions.h" 17 #include "testing/gmock/include/gmock/gmock-actions.h"
17 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 using ::testing::NiceMock; 21 using ::testing::NiceMock;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 #endif 106 #endif
106 } 107 }
107 108
108 } // namespace 109 } // namespace
109 110
110 // Test that SyncGlobalError shows an error if a passphrase is required. 111 // Test that SyncGlobalError shows an error if a passphrase is required.
111 TEST_F(SyncGlobalErrorTest, PassphraseGlobalError) { 112 TEST_F(SyncGlobalErrorTest, PassphraseGlobalError) {
112 scoped_ptr<Profile> profile( 113 scoped_ptr<Profile> profile(
113 ProfileSyncServiceMock::MakeSignedInTestingProfile()); 114 ProfileSyncServiceMock::MakeSignedInTestingProfile());
114 NiceMock<ProfileSyncServiceMock> service(profile.get()); 115 NiceMock<ProfileSyncServiceMock> service(profile.get());
115 SyncGlobalError error(&service); 116 SigninManager* signin = SigninManagerFactory::GetForProfile(profile.get());
117 SyncGlobalError error(&service, signin);
116 118
117 EXPECT_CALL(service, IsPassphraseRequired()) 119 EXPECT_CALL(service, IsPassphraseRequired())
118 .WillRepeatedly(Return(true)); 120 .WillRepeatedly(Return(true));
119 EXPECT_CALL(service, IsPassphraseRequiredForDecryption()) 121 EXPECT_CALL(service, IsPassphraseRequiredForDecryption())
120 .WillRepeatedly(Return(true)); 122 .WillRepeatedly(Return(true));
121 VerifySyncGlobalErrorResult( 123 VerifySyncGlobalErrorResult(
122 &service, browser(), &error, GoogleServiceAuthError::NONE, true, true); 124 &service, browser(), &error, GoogleServiceAuthError::NONE, true, true);
123 } 125 }
124 126
125 // Test that SyncGlobalError shows an error for conditions that can be resolved 127 // Test that SyncGlobalError shows an error for conditions that can be resolved
126 // by the user and suppresses errors for conditions that cannot be resolved by 128 // by the user and suppresses errors for conditions that cannot be resolved by
127 // the user. 129 // the user.
128 TEST_F(SyncGlobalErrorTest, AuthStateGlobalError) { 130 TEST_F(SyncGlobalErrorTest, AuthStateGlobalError) {
129 scoped_ptr<Profile> profile( 131 scoped_ptr<Profile> profile(
130 ProfileSyncServiceMock::MakeSignedInTestingProfile()); 132 ProfileSyncServiceMock::MakeSignedInTestingProfile());
131 NiceMock<ProfileSyncServiceMock> service(profile.get()); 133 NiceMock<ProfileSyncServiceMock> service(profile.get());
132 SyncGlobalError error(&service); 134 SigninManager* signin = SigninManagerFactory::GetForProfile(profile.get());
135 SyncGlobalError error(&service, signin);
133 136
134 browser_sync::SyncBackendHost::Status status; 137 browser_sync::SyncBackendHost::Status status;
135 EXPECT_CALL(service, QueryDetailedSyncStatus()) 138 EXPECT_CALL(service, QueryDetailedSyncStatus())
136 .WillRepeatedly(Return(status)); 139 .WillRepeatedly(Return(status));
137 140
138 struct { 141 struct {
139 GoogleServiceAuthError::State error_state; 142 GoogleServiceAuthError::State error_state;
140 bool is_error; 143 bool is_error;
141 } table[] = { 144 } table[] = {
142 { GoogleServiceAuthError::NONE, false }, 145 { GoogleServiceAuthError::NONE, false },
143 { GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, true }, 146 { GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, true },
144 { GoogleServiceAuthError::USER_NOT_SIGNED_UP, true }, 147 { GoogleServiceAuthError::USER_NOT_SIGNED_UP, true },
145 { GoogleServiceAuthError::CONNECTION_FAILED, false }, 148 { GoogleServiceAuthError::CONNECTION_FAILED, false },
146 { GoogleServiceAuthError::CAPTCHA_REQUIRED, true }, 149 { GoogleServiceAuthError::CAPTCHA_REQUIRED, true },
147 { GoogleServiceAuthError::ACCOUNT_DELETED, true }, 150 { GoogleServiceAuthError::ACCOUNT_DELETED, true },
148 { GoogleServiceAuthError::ACCOUNT_DISABLED, true }, 151 { GoogleServiceAuthError::ACCOUNT_DISABLED, true },
149 { GoogleServiceAuthError::SERVICE_UNAVAILABLE, true }, 152 { GoogleServiceAuthError::SERVICE_UNAVAILABLE, true },
150 { GoogleServiceAuthError::TWO_FACTOR, true }, 153 { GoogleServiceAuthError::TWO_FACTOR, true },
151 { GoogleServiceAuthError::REQUEST_CANCELED, true }, 154 { GoogleServiceAuthError::REQUEST_CANCELED, true },
152 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, 155 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true },
153 }; 156 };
154 157
155 for (size_t i = 0; i < sizeof(table)/sizeof(*table); ++i) { 158 for (size_t i = 0; i < sizeof(table)/sizeof(*table); ++i) {
156 VerifySyncGlobalErrorResult(&service, browser(), &error, 159 VerifySyncGlobalErrorResult(&service, browser(), &error,
157 table[i].error_state, true, table[i].is_error); 160 table[i].error_state, true, table[i].is_error);
158 VerifySyncGlobalErrorResult(&service, browser(), &error, 161 VerifySyncGlobalErrorResult(&service, browser(), &error,
159 table[i].error_state, false, false); 162 table[i].error_state, false, false);
160 } 163 }
161 } 164 }
OLDNEW
« 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