Chromium Code Reviews

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

Issue 6249006: Turn password sync on by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 529 matching lines...)
540 wait_for_syncapi_); 540 wait_for_syncapi_);
541 541
542 // Create actual entry based on autofill protobuf information. 542 // Create actual entry based on autofill protobuf information.
543 // Simulates effects of SyncerUtil::UpdateLocalDataFromServerData 543 // Simulates effects of SyncerUtil::UpdateLocalDataFromServerData
544 MutableEntry parent(&trans, GET_BY_SERVER_TAG, kAutofillTag); 544 MutableEntry parent(&trans, GET_BY_SERVER_TAG, kAutofillTag);
545 MutableEntry item(&trans, CREATE, parent.Get(syncable::ID), tag); 545 MutableEntry item(&trans, CREATE, parent.Get(syncable::ID), tag);
546 ASSERT_TRUE(item.good()); 546 ASSERT_TRUE(item.good());
547 item.Put(SPECIFICS, entity_specifics); 547 item.Put(SPECIFICS, entity_specifics);
548 item.Put(SERVER_SPECIFICS, entity_specifics); 548 item.Put(SERVER_SPECIFICS, entity_specifics);
549 item.Put(BASE_VERSION, 1); 549 item.Put(BASE_VERSION, 1);
550 syncable::Id server_parent_id = ids_.NewServerId(); 550 syncable::Id server_parent_id = service_->id_factory()->NewServerId();
551 item.Put(syncable::ID, server_parent_id); 551 item.Put(syncable::ID, server_parent_id);
552 syncable::Id new_predecessor = 552 syncable::Id new_predecessor =
553 SyncerUtil::ComputePrevIdFromServerPosition(&trans, &item, 553 SyncerUtil::ComputePrevIdFromServerPosition(&trans, &item,
554 server_parent_id); 554 server_parent_id);
555 ASSERT_TRUE(item.PutPredecessor(new_predecessor)); 555 ASSERT_TRUE(item.PutPredecessor(new_predecessor));
556 } 556 }
557 VLOG(1) << "FakeServerUpdater finishing."; 557 VLOG(1) << "FakeServerUpdater finishing.";
558 is_finished_.Signal(); 558 is_finished_.Signal();
559 } 559 }
560 560
(...skipping 32 matching lines...)
593 private: 593 private:
594 friend class base::RefCountedThreadSafe<FakeServerUpdater>; 594 friend class base::RefCountedThreadSafe<FakeServerUpdater>;
595 ~FakeServerUpdater() { } 595 ~FakeServerUpdater() { }
596 596
597 AutofillEntry entry_; 597 AutofillEntry entry_;
598 TestProfileSyncService *service_; 598 TestProfileSyncService *service_;
599 scoped_ptr<WaitableEvent> *wait_for_start_; 599 scoped_ptr<WaitableEvent> *wait_for_start_;
600 scoped_ptr<WaitableEvent> *wait_for_syncapi_; 600 scoped_ptr<WaitableEvent> *wait_for_syncapi_;
601 WaitableEvent is_finished_; 601 WaitableEvent is_finished_;
602 syncable::Id parent_id_; 602 syncable::Id parent_id_;
603 TestIdFactory ids_;
604 }; 603 };
605 604
606 // TODO(skrul): Test abort startup. 605 // TODO(skrul): Test abort startup.
607 // TODO(skrul): Test processing of cloud changes. 606 // TODO(skrul): Test processing of cloud changes.
608 // TODO(tim): Add autofill data type controller test, and a case to cover 607 // TODO(tim): Add autofill data type controller test, and a case to cover
609 // waiting for the PersonalDataManager. 608 // waiting for the PersonalDataManager.
610 TEST_F(ProfileSyncServiceAutofillTest, FailModelAssociation) { 609 TEST_F(ProfileSyncServiceAutofillTest, FailModelAssociation) {
611 // Don't create the root autofill node so startup fails. 610 // Don't create the root autofill node so startup fails.
612 StartSyncService(NULL, true, syncable::AUTOFILL); 611 StartSyncService(NULL, true, syncable::AUTOFILL);
613 EXPECT_TRUE(service_->unrecoverable_error_detected()); 612 EXPECT_TRUE(service_->unrecoverable_error_detected());
(...skipping 454 matching lines...)
1068 std::vector<AutofillEntry> sync_entries; 1067 std::vector<AutofillEntry> sync_entries;
1069 std::vector<AutoFillProfile> sync_profiles; 1068 std::vector<AutoFillProfile> sync_profiles;
1070 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); 1069 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles));
1071 EXPECT_EQ(3U, sync_entries.size()); 1070 EXPECT_EQ(3U, sync_entries.size());
1072 EXPECT_EQ(0U, sync_profiles.size()); 1071 EXPECT_EQ(0U, sync_profiles.size());
1073 for (size_t i = 0; i < sync_entries.size(); i++) { 1072 for (size_t i = 0; i < sync_entries.size(); i++) {
1074 VLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() 1073 VLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name()
1075 << ", " << sync_entries[i].key().value(); 1074 << ", " << sync_entries[i].key().value();
1076 } 1075 }
1077 } 1076 }
OLDNEW

Powered by Google App Engine