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

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

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing a unit test, addressing comments from courage@ Created 7 years, 3 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } else if (type == syncer::AUTOFILL_PROFILE) { 496 } else if (type == syncer::AUTOFILL_PROFILE) {
497 return &profile_factory_; 497 return &profile_factory_;
498 } else { 498 } else {
499 NOTREACHED(); 499 NOTREACHED();
500 return NULL; 500 return NULL;
501 } 501 }
502 } 502 }
503 503
504 virtual void SetUp() OVERRIDE { 504 virtual void SetUp() OVERRIDE {
505 AbstractProfileSyncServiceTest::SetUp(); 505 AbstractProfileSyncServiceTest::SetUp();
506 DLOG(INFO) << "In setup";
Andrew T Wilson (Slow) 2013/09/06 09:23:10 Remove
fgorski 2013/09/12 23:46:24 Done.
506 TestingProfile::Builder builder; 507 TestingProfile::Builder builder;
507 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), 508 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
508 FakeOAuth2TokenService::BuildTokenService); 509 FakeOAuth2TokenService::BuildTokenService);
509 profile_ = builder.Build().Pass(); 510 profile_ = builder.Build().Pass();
510 web_database_.reset(new WebDatabaseFake(&autofill_table_)); 511 web_database_.reset(new WebDatabaseFake(&autofill_table_));
511 MockWebDataServiceWrapper* wrapper = 512 MockWebDataServiceWrapper* wrapper =
512 static_cast<MockWebDataServiceWrapper*>( 513 static_cast<MockWebDataServiceWrapper*>(
513 WebDataServiceFactory::GetInstance()->SetTestingFactoryAndUse( 514 WebDataServiceFactory::GetInstance()->SetTestingFactoryAndUse(
514 profile_.get(), BuildMockWebDataServiceWrapper)); 515 profile_.get(), BuildMockWebDataServiceWrapper));
515 web_data_service_ = 516 web_data_service_ =
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 web_data_service_.get(), 582 web_data_service_.get(),
582 data_type_controller); 583 data_type_controller);
583 584
584 EXPECT_CALL(*components, CreateDataTypeManager(_, _, _, _, _, _)). 585 EXPECT_CALL(*components, CreateDataTypeManager(_, _, _, _, _, _)).
585 WillOnce(ReturnNewDataTypeManagerWithDebugListener( 586 WillOnce(ReturnNewDataTypeManagerWithDebugListener(
586 syncer::MakeWeakHandle(debug_ptr_factory_.GetWeakPtr()))); 587 syncer::MakeWeakHandle(debug_ptr_factory_.GetWeakPtr())));
587 588
588 EXPECT_CALL(*personal_data_manager_, IsDataLoaded()). 589 EXPECT_CALL(*personal_data_manager_, IsDataLoaded()).
589 WillRepeatedly(Return(true)); 590 WillRepeatedly(Return(true));
590 591
591 // We need tokens to get the tests going 592 // We need tokens to get the tests going
592 token_service_->IssueAuthTokenForTest( 593 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get())
593 GaiaConstants::kGaiaOAuth2LoginRefreshToken, "oauth2_login_token"); 594 ->UpdateCredentials("test_user@gmail.com", "oauth2_login_token");
594 token_service_->IssueAuthTokenForTest( 595 token_service_->IssueAuthTokenForTest(GaiaConstants::kSyncService, "token");
595 GaiaConstants::kSyncService, "token");
596 596
597 sync_service_->RegisterDataTypeController(data_type_controller); 597 sync_service_->RegisterDataTypeController(data_type_controller);
598 sync_service_->Initialize(); 598 sync_service_->Initialize();
599 base::MessageLoop::current()->Run(); 599 base::MessageLoop::current()->Run();
600 600
601 // It's possible this test triggered an unrecoverable error, in which case 601 // It's possible this test triggered an unrecoverable error, in which case
602 // we can't get the sync count. 602 // we can't get the sync count.
603 if (sync_service_->ShouldPushChanges()) { 603 if (sync_service_->ShouldPushChanges()) {
604 EXPECT_EQ(GetSyncCount(type), 604 EXPECT_EQ(GetSyncCount(type),
605 association_stats_.num_sync_items_after_association); 605 association_stats_.num_sync_items_after_association);
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 std::vector<AutofillEntry> sync_entries; 1406 std::vector<AutofillEntry> sync_entries;
1407 std::vector<AutofillProfile> sync_profiles; 1407 std::vector<AutofillProfile> sync_profiles;
1408 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); 1408 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles));
1409 EXPECT_EQ(3U, sync_entries.size()); 1409 EXPECT_EQ(3U, sync_entries.size());
1410 EXPECT_EQ(0U, sync_profiles.size()); 1410 EXPECT_EQ(0U, sync_profiles.size());
1411 for (size_t i = 0; i < sync_entries.size(); i++) { 1411 for (size_t i = 0; i < sync_entries.size(); i++) {
1412 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() 1412 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name()
1413 << ", " << sync_entries[i].key().value(); 1413 << ", " << sync_entries[i].key().value();
1414 } 1414 }
1415 } 1415 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698