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

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

Issue 6588119: First-time sync: asymptotic running time improvement (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/Release
Patch Set: Fix test bug. Created 9 years, 9 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
« no previous file with comments | « chrome/browser/sync/engine/syncer_util.cc ('k') | chrome/browser/sync/syncable/syncable.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/ref_counted.h" 13 #include "base/ref_counted.h"
14 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "base/task.h" 16 #include "base/task.h"
17 #include "base/time.h" 17 #include "base/time.h"
18 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
19 #include "base/synchronization/waitable_event.h" 19 #include "base/synchronization/waitable_event.h"
20 #include "chrome/browser/autofill/autofill_common_test.h" 20 #include "chrome/browser/autofill/autofill_common_test.h"
21 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" 21 #include "chrome/browser/sync/abstract_profile_sync_service_test.h"
22 #include "chrome/browser/sync/engine/model_changing_syncer_command.h" 22 #include "chrome/browser/sync/engine/model_changing_syncer_command.h"
23 #include "chrome/browser/sync/engine/syncapi.h" 23 #include "chrome/browser/sync/engine/syncapi.h"
24 #include "chrome/browser/sync/engine/syncer_util.h"
25 #include "chrome/browser/sync/glue/autofill_change_processor.h" 24 #include "chrome/browser/sync/glue/autofill_change_processor.h"
26 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" 25 #include "chrome/browser/sync/glue/autofill_data_type_controller.h"
27 #include "chrome/browser/sync/glue/autofill_model_associator.h" 26 #include "chrome/browser/sync/glue/autofill_model_associator.h"
28 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" 27 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h"
29 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" 28 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h"
30 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" 29 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h"
31 #include "chrome/browser/sync/glue/data_type_controller.h" 30 #include "chrome/browser/sync/glue/data_type_controller.h"
32 #include "chrome/browser/sync/profile_sync_factory.h" 31 #include "chrome/browser/sync/profile_sync_factory.h"
33 #include "chrome/browser/sync/profile_sync_service.h" 32 #include "chrome/browser/sync/profile_sync_service.h"
34 #include "chrome/browser/sync/profile_sync_test_util.h" 33 #include "chrome/browser/sync/profile_sync_test_util.h"
(...skipping 19 matching lines...) Expand all
54 using browser_sync::AutofillChangeProcessor; 53 using browser_sync::AutofillChangeProcessor;
55 using browser_sync::AutofillDataTypeController; 54 using browser_sync::AutofillDataTypeController;
56 using browser_sync::AutofillModelAssociator; 55 using browser_sync::AutofillModelAssociator;
57 using browser_sync::AutofillProfileChangeProcessor; 56 using browser_sync::AutofillProfileChangeProcessor;
58 using browser_sync::AutofillProfileDataTypeController; 57 using browser_sync::AutofillProfileDataTypeController;
59 using browser_sync::AutofillProfileModelAssociator; 58 using browser_sync::AutofillProfileModelAssociator;
60 using browser_sync::DataTypeController; 59 using browser_sync::DataTypeController;
61 using browser_sync::GROUP_DB; 60 using browser_sync::GROUP_DB;
62 using browser_sync::kAutofillTag; 61 using browser_sync::kAutofillTag;
63 using browser_sync::SyncBackendHostForProfileSyncTest; 62 using browser_sync::SyncBackendHostForProfileSyncTest;
64 using browser_sync::SyncerUtil;
65 using browser_sync::UnrecoverableErrorHandler; 63 using browser_sync::UnrecoverableErrorHandler;
66 using syncable::CREATE_NEW_UPDATE_ITEM; 64 using syncable::CREATE_NEW_UPDATE_ITEM;
67 using syncable::AUTOFILL; 65 using syncable::AUTOFILL;
68 using syncable::BASE_VERSION; 66 using syncable::BASE_VERSION;
69 using syncable::CREATE; 67 using syncable::CREATE;
70 using syncable::DirectoryChangeEvent; 68 using syncable::DirectoryChangeEvent;
71 using syncable::GET_BY_SERVER_TAG; 69 using syncable::GET_BY_SERVER_TAG;
72 using syncable::INVALID; 70 using syncable::INVALID;
73 using syncable::MutableEntry; 71 using syncable::MutableEntry;
74 using syncable::OriginalEntries; 72 using syncable::OriginalEntries;
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 wait_for_syncapi_); 542 wait_for_syncapi_);
545 543
546 // Create actual entry based on autofill protobuf information. 544 // Create actual entry based on autofill protobuf information.
547 // Simulates effects of SyncerUtil::UpdateLocalDataFromServerData 545 // Simulates effects of SyncerUtil::UpdateLocalDataFromServerData
548 MutableEntry parent(&trans, GET_BY_SERVER_TAG, kAutofillTag); 546 MutableEntry parent(&trans, GET_BY_SERVER_TAG, kAutofillTag);
549 MutableEntry item(&trans, CREATE, parent.Get(syncable::ID), tag); 547 MutableEntry item(&trans, CREATE, parent.Get(syncable::ID), tag);
550 ASSERT_TRUE(item.good()); 548 ASSERT_TRUE(item.good());
551 item.Put(SPECIFICS, entity_specifics); 549 item.Put(SPECIFICS, entity_specifics);
552 item.Put(SERVER_SPECIFICS, entity_specifics); 550 item.Put(SERVER_SPECIFICS, entity_specifics);
553 item.Put(BASE_VERSION, 1); 551 item.Put(BASE_VERSION, 1);
554 syncable::Id server_parent_id = service_->id_factory()->NewServerId(); 552 syncable::Id server_item_id = service_->id_factory()->NewServerId();
555 item.Put(syncable::ID, server_parent_id); 553 item.Put(syncable::ID, server_item_id);
556 syncable::Id new_predecessor = 554 syncable::Id new_predecessor;
557 SyncerUtil::ComputePrevIdFromServerPosition(&trans, &item,
558 server_parent_id);
559 ASSERT_TRUE(item.PutPredecessor(new_predecessor)); 555 ASSERT_TRUE(item.PutPredecessor(new_predecessor));
560 } 556 }
561 VLOG(1) << "FakeServerUpdater finishing."; 557 VLOG(1) << "FakeServerUpdater finishing.";
562 is_finished_.Signal(); 558 is_finished_.Signal();
563 } 559 }
564 560
565 void CreateNewEntry(const AutofillEntry& entry) { 561 void CreateNewEntry(const AutofillEntry& entry) {
566 entry_ = entry; 562 entry_ = entry;
567 scoped_ptr<Callback0::Type> c(NewCallback((FakeServerUpdater *)this, 563 scoped_ptr<Callback0::Type> c(NewCallback((FakeServerUpdater *)this,
568 &FakeServerUpdater::Update)); 564 &FakeServerUpdater::Update));
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 std::vector<AutofillEntry> sync_entries; 1067 std::vector<AutofillEntry> sync_entries;
1072 std::vector<AutoFillProfile> sync_profiles; 1068 std::vector<AutoFillProfile> sync_profiles;
1073 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); 1069 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles));
1074 EXPECT_EQ(3U, sync_entries.size()); 1070 EXPECT_EQ(3U, sync_entries.size());
1075 EXPECT_EQ(0U, sync_profiles.size()); 1071 EXPECT_EQ(0U, sync_profiles.size());
1076 for (size_t i = 0; i < sync_entries.size(); i++) { 1072 for (size_t i = 0; i < sync_entries.size(); i++) {
1077 VLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() 1073 VLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name()
1078 << ", " << sync_entries[i].key().value(); 1074 << ", " << sync_entries[i].key().value();
1079 } 1075 }
1080 } 1076 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_util.cc ('k') | chrome/browser/sync/syncable/syncable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698