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

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

Issue 2388163002: [Sync] Move //components/sync to the syncer namespace, take 2. (Closed)
Patch Set: Rebase. Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_error_notifier_ash.h" 5 #include "chrome/browser/sync/sync_error_notifier_ash.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 profile_ = profile_manager_->CreateTestingProfile(kTestAccountId); 105 profile_ = profile_manager_->CreateTestingProfile(kTestAccountId);
106 106
107 service_.reset(new browser_sync::ProfileSyncServiceMock( 107 service_.reset(new browser_sync::ProfileSyncServiceMock(
108 CreateProfileSyncServiceParamsForTest(profile_))); 108 CreateProfileSyncServiceParamsForTest(profile_)));
109 109
110 FakeLoginUIService* login_ui_service = static_cast<FakeLoginUIService*>( 110 FakeLoginUIService* login_ui_service = static_cast<FakeLoginUIService*>(
111 LoginUIServiceFactory::GetInstance()->SetTestingFactoryAndUse( 111 LoginUIServiceFactory::GetInstance()->SetTestingFactoryAndUse(
112 profile_, BuildMockLoginUIService)); 112 profile_, BuildMockLoginUIService));
113 login_ui_service->SetLoginUI(&login_ui_); 113 login_ui_service->SetLoginUI(&login_ui_);
114 114
115 error_controller_.reset(new SyncErrorController(service_.get())); 115 error_controller_.reset(new syncer::SyncErrorController(service_.get()));
116 error_notifier_.reset(new SyncErrorNotifier(error_controller_.get(), 116 error_notifier_.reset(new SyncErrorNotifier(error_controller_.get(),
117 profile_)); 117 profile_));
118 118
119 notification_ui_manager_ = g_browser_process->notification_ui_manager(); 119 notification_ui_manager_ = g_browser_process->notification_ui_manager();
120 } 120 }
121 121
122 void TearDown() override { 122 void TearDown() override {
123 error_notifier_->Shutdown(); 123 error_notifier_->Shutdown();
124 service_.reset(); 124 service_.reset();
125 profile_manager_.reset(); 125 profile_manager_.reset();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 ASSERT_EQ((size_t)1, notification->buttons().size()); 159 ASSERT_EQ((size_t)1, notification->buttons().size());
160 } else { 160 } else {
161 ASSERT_FALSE(notification); 161 ASSERT_FALSE(notification);
162 } 162 }
163 } 163 }
164 164
165 #if defined(OS_WIN) 165 #if defined(OS_WIN)
166 std::unique_ptr<display::Screen> test_screen_; 166 std::unique_ptr<display::Screen> test_screen_;
167 #endif 167 #endif
168 std::unique_ptr<TestingProfileManager> profile_manager_; 168 std::unique_ptr<TestingProfileManager> profile_manager_;
169 std::unique_ptr<SyncErrorController> error_controller_; 169 std::unique_ptr<syncer::SyncErrorController> error_controller_;
170 std::unique_ptr<SyncErrorNotifier> error_notifier_; 170 std::unique_ptr<SyncErrorNotifier> error_notifier_;
171 std::unique_ptr<browser_sync::ProfileSyncServiceMock> service_; 171 std::unique_ptr<browser_sync::ProfileSyncServiceMock> service_;
172 TestingProfile* profile_; 172 TestingProfile* profile_;
173 FakeLoginUI login_ui_; 173 FakeLoginUI login_ui_;
174 NotificationUIManager* notification_ui_manager_; 174 NotificationUIManager* notification_ui_manager_;
175 175
176 private: 176 private:
177 DISALLOW_COPY_AND_ASSIGN(SyncErrorNotifierTest); 177 DISALLOW_COPY_AND_ASSIGN(SyncErrorNotifierTest);
178 }; 178 };
179 179
180 } // namespace 180 } // namespace
181 181
182 // Test that SyncErrorNotifier shows an notification if a passphrase is 182 // Test that SyncErrorNotifier shows an notification if a passphrase is
183 // required. 183 // required.
184 // Disabled on Windows: http://crbug.com/373238 184 // Disabled on Windows: http://crbug.com/373238
185 #if defined(OS_WIN) 185 #if defined(OS_WIN)
186 #define MAYBE_PassphraseNotification DISABLED_PassphraseNotification 186 #define MAYBE_PassphraseNotification DISABLED_PassphraseNotification
187 #else 187 #else
188 #define MAYBE_PassphraseNotification PassphraseNotification 188 #define MAYBE_PassphraseNotification PassphraseNotification
189 #endif 189 #endif
190 TEST_F(SyncErrorNotifierTest, MAYBE_PassphraseNotification) { 190 TEST_F(SyncErrorNotifierTest, MAYBE_PassphraseNotification) {
191 #if defined(OS_CHROMEOS) 191 #if defined(OS_CHROMEOS)
192 chromeos::ScopedUserManagerEnabler scoped_enabler( 192 chromeos::ScopedUserManagerEnabler scoped_enabler(
193 new chromeos::MockUserManager()); 193 new chromeos::MockUserManager());
194 #endif 194 #endif
195 ASSERT_FALSE(notification_ui_manager_->FindById( 195 ASSERT_FALSE(notification_ui_manager_->FindById(
196 kNotificationId, NotificationUIManager::GetProfileID(profile_))); 196 kNotificationId, NotificationUIManager::GetProfileID(profile_)));
197 197
198 browser_sync::SyncBackendHost::Status status; 198 syncer::SyncBackendHost::Status status;
199 EXPECT_CALL(*service_, QueryDetailedSyncStatus(_)) 199 EXPECT_CALL(*service_, QueryDetailedSyncStatus(_))
200 .WillRepeatedly(Return(false)); 200 .WillRepeatedly(Return(false));
201 201
202 EXPECT_CALL(*service_, IsPassphraseRequired()) 202 EXPECT_CALL(*service_, IsPassphraseRequired())
203 .WillRepeatedly(Return(true)); 203 .WillRepeatedly(Return(true));
204 EXPECT_CALL(*service_, IsPassphraseRequiredForDecryption()) 204 EXPECT_CALL(*service_, IsPassphraseRequiredForDecryption())
205 .WillRepeatedly(Return(true)); 205 .WillRepeatedly(Return(true));
206 { 206 {
207 SCOPED_TRACE("Expected a notification for passphrase error"); 207 SCOPED_TRACE("Expected a notification for passphrase error");
208 VerifySyncErrorNotifierResult(GoogleServiceAuthError::NONE, 208 VerifySyncErrorNotifierResult(GoogleServiceAuthError::NONE,
(...skipping 22 matching lines...) Expand all
231 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); 231 SCOPED_TRACE("Not expecting notification since sync setup is incomplete");
232 VerifySyncErrorNotifierResult( 232 VerifySyncErrorNotifierResult(
233 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, 233 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS,
234 false /* not signed in */, 234 false /* not signed in */,
235 false /* no error */); 235 false /* no error */);
236 } 236 }
237 } 237 }
238 238
239 } // namespace test 239 } // namespace test
240 } // namespace ash 240 } // namespace ash
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_error_notifier_ash.cc ('k') | chrome/browser/sync/sync_error_notifier_factory_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698