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

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

Issue 14630003: signin: move SigninManagerBase::Signout to SigninManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: apocalypse Created 7 years, 7 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
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 EXPECT_FALSE(harness_.service->sync_initialized()); 275 EXPECT_FALSE(harness_.service->sync_initialized());
276 EXPECT_TRUE( 276 EXPECT_TRUE(
277 harness_.profile->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart)); 277 harness_.profile->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
278 278
279 harness_.service->UnsuppressAndStart(); 279 harness_.service->UnsuppressAndStart();
280 EXPECT_TRUE(harness_.service->sync_initialized()); 280 EXPECT_TRUE(harness_.service->sync_initialized());
281 EXPECT_FALSE( 281 EXPECT_FALSE(
282 harness_.profile->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart)); 282 harness_.profile->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
283 } 283 }
284 284
285 // Certain ProfileSyncService tests don't apply to Chrome OS, for example
286 // things that deal with concepts like "signing out" and policy.
287 #if !defined (OS_CHROMEOS)
288
285 TEST_F(ProfileSyncServiceTest, EnableSyncAndSignOut) { 289 TEST_F(ProfileSyncServiceTest, EnableSyncAndSignOut) {
286 SigninManagerBase* signin = 290 SigninManager* signin =
287 SigninManagerFactory::GetForProfile(harness_.profile.get()); 291 SigninManagerFactory::GetForProfile(harness_.profile.get());
288 signin->SetAuthenticatedUsername("test@test.com"); 292 signin->SetAuthenticatedUsername("test@test.com");
289 ProfileSyncComponentsFactoryMock* factory = 293 ProfileSyncComponentsFactoryMock* factory =
290 new ProfileSyncComponentsFactoryMock(); 294 new ProfileSyncComponentsFactoryMock();
291 harness_.service.reset(new TestProfileSyncService( 295 harness_.service.reset(new TestProfileSyncService(
292 factory, 296 factory,
293 harness_.profile.get(), 297 harness_.profile.get(),
294 signin, 298 signin,
295 ProfileSyncService::AUTO_START, 299 ProfileSyncService::AUTO_START,
296 true)); 300 true));
297 // Register the bookmark data type. 301 // Register the bookmark data type.
298 EXPECT_CALL(*factory, CreateDataTypeManager(_, _, _, _, _)). 302 EXPECT_CALL(*factory, CreateDataTypeManager(_, _, _, _, _)).
299 WillRepeatedly(ReturnNewDataTypeManager()); 303 WillRepeatedly(ReturnNewDataTypeManager());
300 304
301 harness_.IssueTestTokens(); 305 harness_.IssueTestTokens();
302 306
303 harness_.service->Initialize(); 307 harness_.service->Initialize();
304 EXPECT_TRUE(harness_.service->sync_initialized()); 308 EXPECT_TRUE(harness_.service->sync_initialized());
305 EXPECT_TRUE(harness_.service->GetBackendForTest() != NULL); 309 EXPECT_TRUE(harness_.service->GetBackendForTest() != NULL);
306 EXPECT_FALSE( 310 EXPECT_FALSE(
307 harness_.profile->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart)); 311 harness_.profile->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
308 312
309 signin->SignOut(); 313 signin->SignOut();
310 EXPECT_FALSE(harness_.service->sync_initialized()); 314 EXPECT_FALSE(harness_.service->sync_initialized());
311 } 315 }
312 316
317 #endif // !defined(OS_CHROMEOS)
318
313 TEST_F(ProfileSyncServiceTest, JsControllerHandlersBasic) { 319 TEST_F(ProfileSyncServiceTest, JsControllerHandlersBasic) {
314 harness_.StartSyncService(); 320 harness_.StartSyncService();
315 EXPECT_TRUE(harness_.service->sync_initialized()); 321 EXPECT_TRUE(harness_.service->sync_initialized());
316 EXPECT_TRUE(harness_.service->GetBackendForTest() != NULL); 322 EXPECT_TRUE(harness_.service->GetBackendForTest() != NULL);
317 323
318 syncer::JsController* js_controller = harness_.service->GetJsController(); 324 syncer::JsController* js_controller = harness_.service->GetJsController();
319 StrictMock<syncer::MockJsEventHandler> event_handler; 325 StrictMock<syncer::MockJsEventHandler> event_handler;
320 js_controller->AddJsEventHandler(&event_handler); 326 js_controller->AddJsEventHandler(&event_handler);
321 js_controller->RemoveJsEventHandler(&event_handler); 327 js_controller->RemoveJsEventHandler(&event_handler);
322 } 328 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 namespace syncer { 629 namespace syncer {
624 namespace { 630 namespace {
625 631
626 // ProfileSyncService should behave just like an invalidator. 632 // ProfileSyncService should behave just like an invalidator.
627 INSTANTIATE_TYPED_TEST_CASE_P( 633 INSTANTIATE_TYPED_TEST_CASE_P(
628 ProfileSyncServiceInvalidatorTest, InvalidatorTest, 634 ProfileSyncServiceInvalidatorTest, InvalidatorTest,
629 ::browser_sync::ProfileSyncServiceInvalidatorTestDelegate); 635 ::browser_sync::ProfileSyncServiceInvalidatorTestDelegate);
630 636
631 } // namespace 637 } // namespace
632 } // namespace syncer 638 } // namespace syncer
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_startup_unittest.cc ('k') | chrome/browser/sync/sync_ui_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698