| OLD | NEW |
| 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 profile_.reset(new ProfileMock()); | 506 profile_.reset(new ProfileMock()); |
| 507 profile_->CreateRequestContext(); | |
| 508 web_database_.reset(new WebDatabaseFake(&autofill_table_)); | 507 web_database_.reset(new WebDatabaseFake(&autofill_table_)); |
| 509 MockWebDataServiceWrapper* wrapper = | 508 MockWebDataServiceWrapper* wrapper = |
| 510 static_cast<MockWebDataServiceWrapper*>( | 509 static_cast<MockWebDataServiceWrapper*>( |
| 511 WebDataServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 510 WebDataServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 512 profile_.get(), BuildMockWebDataServiceWrapper)); | 511 profile_.get(), BuildMockWebDataServiceWrapper)); |
| 513 web_data_service_ = | 512 web_data_service_ = |
| 514 static_cast<WebDataServiceFake*>(wrapper->GetAutofillWebData().get()); | 513 static_cast<WebDataServiceFake*>(wrapper->GetAutofillWebData().get()); |
| 515 web_data_service_->SetDatabase(web_database_.get()); | 514 web_data_service_->SetDatabase(web_database_.get()); |
| 516 | 515 |
| 517 MockPersonalDataManagerService* personal_data_manager_service = | 516 MockPersonalDataManagerService* personal_data_manager_service = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 535 web_data_service_->StartSyncableService(); | 534 web_data_service_->StartSyncableService(); |
| 536 } | 535 } |
| 537 | 536 |
| 538 virtual void TearDown() OVERRIDE { | 537 virtual void TearDown() OVERRIDE { |
| 539 // Note: The tear down order is important. | 538 // Note: The tear down order is important. |
| 540 ProfileSyncServiceFactory::GetInstance()->SetTestingFactory( | 539 ProfileSyncServiceFactory::GetInstance()->SetTestingFactory( |
| 541 profile_.get(), NULL); | 540 profile_.get(), NULL); |
| 542 web_data_service_->ShutdownOnUIThread(); | 541 web_data_service_->ShutdownOnUIThread(); |
| 543 web_data_service_->ShutdownSyncableService(); | 542 web_data_service_->ShutdownSyncableService(); |
| 544 web_data_service_ = NULL; | 543 web_data_service_ = NULL; |
| 545 profile_->ResetRequestContext(); | |
| 546 // To prevent a leak, fully release TestURLRequestContext to ensure its | 544 // To prevent a leak, fully release TestURLRequestContext to ensure its |
| 547 // destruction on the IO message loop. | 545 // destruction on the IO message loop. |
| 548 profile_.reset(); | 546 profile_.reset(); |
| 549 AbstractProfileSyncServiceTest::TearDown(); | 547 AbstractProfileSyncServiceTest::TearDown(); |
| 550 } | 548 } |
| 551 | 549 |
| 552 | 550 |
| 553 int GetSyncCount(syncer::ModelType type) { | 551 int GetSyncCount(syncer::ModelType type) { |
| 554 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 552 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
| 555 syncer::ReadNode node(&trans); | 553 syncer::ReadNode node(&trans); |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 std::vector<AutofillEntry> sync_entries; | 1405 std::vector<AutofillEntry> sync_entries; |
| 1408 std::vector<AutofillProfile> sync_profiles; | 1406 std::vector<AutofillProfile> sync_profiles; |
| 1409 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); | 1407 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); |
| 1410 EXPECT_EQ(3U, sync_entries.size()); | 1408 EXPECT_EQ(3U, sync_entries.size()); |
| 1411 EXPECT_EQ(0U, sync_profiles.size()); | 1409 EXPECT_EQ(0U, sync_profiles.size()); |
| 1412 for (size_t i = 0; i < sync_entries.size(); i++) { | 1410 for (size_t i = 0; i < sync_entries.size(); i++) { |
| 1413 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() | 1411 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() |
| 1414 << ", " << sync_entries[i].key().value(); | 1412 << ", " << sync_entries[i].key().value(); |
| 1415 } | 1413 } |
| 1416 } | 1414 } |
| OLD | NEW |