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

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

Issue 686563003: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 syncer::DataTypeConfigurationStats>& configuration_stats) override { 440 syncer::DataTypeConfigurationStats>& configuration_stats) override {
441 ASSERT_EQ(1u, configuration_stats.size()); 441 ASSERT_EQ(1u, configuration_stats.size());
442 association_stats_ = configuration_stats[0].association_stats; 442 association_stats_ = configuration_stats[0].association_stats;
443 } 443 }
444 444
445 protected: 445 protected:
446 ProfileSyncServiceAutofillTest() 446 ProfileSyncServiceAutofillTest()
447 : profile_manager_(TestingBrowserProcess::GetGlobal()), 447 : profile_manager_(TestingBrowserProcess::GetGlobal()),
448 debug_ptr_factory_(this) { 448 debug_ptr_factory_(this) {
449 } 449 }
450 virtual ~ProfileSyncServiceAutofillTest() { 450 ~ProfileSyncServiceAutofillTest() override {}
451 }
452 451
453 AutofillProfileFactory profile_factory_; 452 AutofillProfileFactory profile_factory_;
454 AutofillEntryFactory entry_factory_; 453 AutofillEntryFactory entry_factory_;
455 454
456 AbstractAutofillFactory* GetFactory(syncer::ModelType type) { 455 AbstractAutofillFactory* GetFactory(syncer::ModelType type) {
457 if (type == syncer::AUTOFILL) { 456 if (type == syncer::AUTOFILL) {
458 return &entry_factory_; 457 return &entry_factory_;
459 } else if (type == syncer::AUTOFILL_PROFILE) { 458 } else if (type == syncer::AUTOFILL_PROFILE) {
460 return &profile_factory_; 459 return &profile_factory_;
461 } else { 460 } else {
462 NOTREACHED(); 461 NOTREACHED();
463 return NULL; 462 return NULL;
464 } 463 }
465 } 464 }
466 465
467 virtual void SetUp() override { 466 void SetUp() override {
468 AbstractProfileSyncServiceTest::SetUp(); 467 AbstractProfileSyncServiceTest::SetUp();
469 ASSERT_TRUE(profile_manager_.SetUp()); 468 ASSERT_TRUE(profile_manager_.SetUp());
470 TestingProfile::TestingFactories testing_factories; 469 TestingProfile::TestingFactories testing_factories;
471 testing_factories.push_back(std::make_pair( 470 testing_factories.push_back(std::make_pair(
472 ProfileOAuth2TokenServiceFactory::GetInstance(), 471 ProfileOAuth2TokenServiceFactory::GetInstance(),
473 BuildAutoIssuingFakeProfileOAuth2TokenService)); 472 BuildAutoIssuingFakeProfileOAuth2TokenService));
474 profile_ = profile_manager_.CreateTestingProfile( 473 profile_ = profile_manager_.CreateTestingProfile(
475 kTestProfileName, 474 kTestProfileName,
476 scoped_ptr<PrefServiceSyncable>(), 475 scoped_ptr<PrefServiceSyncable>(),
477 base::UTF8ToUTF16(kTestProfileName), 476 base::UTF8ToUTF16(kTestProfileName),
(...skipping 25 matching lines...) Expand all
503 502
504 web_data_service_->StartSyncableService(); 503 web_data_service_->StartSyncableService();
505 504
506 // When UpdateAutofillEntries() is called with an empty list, the return 505 // When UpdateAutofillEntries() is called with an empty list, the return
507 // value should be |true|, rather than the default of |false|. 506 // value should be |true|, rather than the default of |false|.
508 std::vector<AutofillEntry> empty; 507 std::vector<AutofillEntry> empty;
509 EXPECT_CALL(autofill_table_, UpdateAutofillEntries(empty)) 508 EXPECT_CALL(autofill_table_, UpdateAutofillEntries(empty))
510 .WillRepeatedly(Return(true)); 509 .WillRepeatedly(Return(true));
511 } 510 }
512 511
513 virtual void TearDown() override { 512 void TearDown() override {
514 // Note: The tear down order is important. 513 // Note: The tear down order is important.
515 ProfileSyncServiceFactory::GetInstance()->SetTestingFactory(profile_, NULL); 514 ProfileSyncServiceFactory::GetInstance()->SetTestingFactory(profile_, NULL);
516 web_data_service_->ShutdownOnUIThread(); 515 web_data_service_->ShutdownOnUIThread();
517 web_data_service_->ShutdownSyncableService(); 516 web_data_service_->ShutdownSyncableService();
518 web_data_service_ = NULL; 517 web_data_service_ = NULL;
519 // To prevent a leak, fully release TestURLRequestContext to ensure its 518 // To prevent a leak, fully release TestURLRequestContext to ensure its
520 // destruction on the IO message loop. 519 // destruction on the IO message loop.
521 profile_ = NULL; 520 profile_ = NULL;
522 profile_manager_.DeleteTestingProfile(kTestProfileName); 521 profile_manager_.DeleteTestingProfile(kTestProfileName);
523 AbstractProfileSyncServiceTest::TearDown(); 522 AbstractProfileSyncServiceTest::TearDown();
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 std::vector<AutofillEntry> sync_entries; 1371 std::vector<AutofillEntry> sync_entries;
1373 std::vector<AutofillProfile> sync_profiles; 1372 std::vector<AutofillProfile> sync_profiles;
1374 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); 1373 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles));
1375 EXPECT_EQ(3U, sync_entries.size()); 1374 EXPECT_EQ(3U, sync_entries.size());
1376 EXPECT_EQ(0U, sync_profiles.size()); 1375 EXPECT_EQ(0U, sync_profiles.size());
1377 for (size_t i = 0; i < sync_entries.size(); i++) { 1376 for (size_t i = 0; i < sync_entries.size(); i++) {
1378 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() 1377 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name()
1379 << ", " << sync_entries[i].key().value(); 1378 << ", " << sync_entries[i].key().value();
1380 } 1379 }
1381 } 1380 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698