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

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

Issue 3913005: sync: enable password sync by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/debug
Patch Set: fix mac again Created 10 years, 2 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) 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 wait_for_syncapi_); 413 wait_for_syncapi_);
414 414
415 // Create actual entry based on autofill protobuf information. 415 // Create actual entry based on autofill protobuf information.
416 // Simulates effects of SyncerUtil::UpdateLocalDataFromServerData 416 // Simulates effects of SyncerUtil::UpdateLocalDataFromServerData
417 MutableEntry parent(&trans, GET_BY_SERVER_TAG, kAutofillTag); 417 MutableEntry parent(&trans, GET_BY_SERVER_TAG, kAutofillTag);
418 MutableEntry item(&trans, CREATE, parent.Get(syncable::ID), tag); 418 MutableEntry item(&trans, CREATE, parent.Get(syncable::ID), tag);
419 ASSERT_TRUE(item.good()); 419 ASSERT_TRUE(item.good());
420 item.Put(SPECIFICS, entity_specifics); 420 item.Put(SPECIFICS, entity_specifics);
421 item.Put(SERVER_SPECIFICS, entity_specifics); 421 item.Put(SERVER_SPECIFICS, entity_specifics);
422 item.Put(BASE_VERSION, 1); 422 item.Put(BASE_VERSION, 1);
423 syncable::Id server_parent_id = ids_.NewServerId(); 423 syncable::Id server_parent_id = service_->id_factory()->NewServerId();
424 item.Put(syncable::ID, server_parent_id); 424 item.Put(syncable::ID, server_parent_id);
425 syncable::Id new_predecessor = 425 syncable::Id new_predecessor =
426 SyncerUtil::ComputePrevIdFromServerPosition(&trans, &item, 426 SyncerUtil::ComputePrevIdFromServerPosition(&trans, &item,
427 server_parent_id); 427 server_parent_id);
428 ASSERT_TRUE(item.PutPredecessor(new_predecessor)); 428 ASSERT_TRUE(item.PutPredecessor(new_predecessor));
429 } 429 }
430 LOG(INFO) << "FakeServerUpdater finishing."; 430 LOG(INFO) << "FakeServerUpdater finishing.";
431 is_finished_.Signal(); 431 is_finished_.Signal();
432 } 432 }
433 433
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 private: 466 private:
467 friend class base::RefCountedThreadSafe<FakeServerUpdater>; 467 friend class base::RefCountedThreadSafe<FakeServerUpdater>;
468 ~FakeServerUpdater() { } 468 ~FakeServerUpdater() { }
469 469
470 AutofillEntry entry_; 470 AutofillEntry entry_;
471 TestProfileSyncService *service_; 471 TestProfileSyncService *service_;
472 scoped_ptr<WaitableEvent> *wait_for_start_; 472 scoped_ptr<WaitableEvent> *wait_for_start_;
473 scoped_ptr<WaitableEvent> *wait_for_syncapi_; 473 scoped_ptr<WaitableEvent> *wait_for_syncapi_;
474 WaitableEvent is_finished_; 474 WaitableEvent is_finished_;
475 syncable::Id parent_id_; 475 syncable::Id parent_id_;
476 TestIdFactory ids_;
477 }; 476 };
478 477
479 // TODO(skrul): Test abort startup. 478 // TODO(skrul): Test abort startup.
480 // TODO(skrul): Test processing of cloud changes. 479 // TODO(skrul): Test processing of cloud changes.
481 // TODO(tim): Add autofill data type controller test, and a case to cover 480 // TODO(tim): Add autofill data type controller test, and a case to cover
482 // waiting for the PersonalDataManager. 481 // waiting for the PersonalDataManager.
483 TEST_F(ProfileSyncServiceAutofillTest, FailModelAssociation) { 482 TEST_F(ProfileSyncServiceAutofillTest, FailModelAssociation) {
484 // Don't create the root autofill node so startup fails. 483 // Don't create the root autofill node so startup fails.
485 StartSyncService(NULL, true); 484 StartSyncService(NULL, true);
486 EXPECT_TRUE(service_->unrecoverable_error_detected()); 485 EXPECT_TRUE(service_->unrecoverable_error_detected());
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 std::vector<AutofillEntry> sync_entries; 1209 std::vector<AutofillEntry> sync_entries;
1211 std::vector<AutoFillProfile> sync_profiles; 1210 std::vector<AutoFillProfile> sync_profiles;
1212 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); 1211 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles));
1213 EXPECT_EQ(3U, sync_entries.size()); 1212 EXPECT_EQ(3U, sync_entries.size());
1214 EXPECT_EQ(0U, sync_profiles.size()); 1213 EXPECT_EQ(0U, sync_profiles.size());
1215 for (size_t i = 0; i < sync_entries.size(); i++) { 1214 for (size_t i = 0; i < sync_entries.size(); i++) {
1216 LOG(INFO) << "Entry " << i << ": " << sync_entries[i].key().name() << ", " 1215 LOG(INFO) << "Entry " << i << ": " << sync_entries[i].key().name() << ", "
1217 << sync_entries[i].key().value(); 1216 << sync_entries[i].key().value();
1218 } 1217 }
1219 } 1218 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698