OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/browser/sync/profile_sync_service_harness.h" | 7 #include "chrome/browser/sync/profile_sync_service_harness.h" |
8 #include "chrome/browser/sync/test/integration/autofill_helper.h" | 8 #include "chrome/browser/sync/test/integration/autofill_helper.h" |
9 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 9 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
10 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" | 10 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" |
11 #include "chrome/browser/sync/test/integration/sync_test.h" | 11 #include "chrome/browser/sync/test/integration/sync_test.h" |
12 #include "components/autofill/core/browser/autofill_common_test.h" | 12 #include "components/autofill/core/browser/autofill_common_test.h" |
13 #include "components/autofill/core/browser/autofill_profile.h" | 13 #include "components/autofill/core/browser/autofill_profile.h" |
14 #include "components/autofill/core/browser/webdata/autofill_entry.h" | 14 #include "components/autofill/core/browser/webdata/autofill_entry.h" |
15 | 15 |
16 using autofill::AutofillFieldType; | 16 using autofill::ServerFieldType; |
17 using autofill::AutofillKey; | 17 using autofill::AutofillKey; |
18 using autofill::AutofillProfile; | 18 using autofill::AutofillProfile; |
19 | 19 |
20 using autofill_helper::AllProfilesMatch; | 20 using autofill_helper::AllProfilesMatch; |
21 using autofill_helper::GetAllKeys; | 21 using autofill_helper::GetAllKeys; |
22 using autofill_helper::GetAllProfiles; | 22 using autofill_helper::GetAllProfiles; |
23 using autofill_helper::GetKeyCount; | 23 using autofill_helper::GetKeyCount; |
24 using autofill_helper::GetProfileCount; | 24 using autofill_helper::GetProfileCount; |
25 using autofill_helper::RemoveKeys; | 25 using autofill_helper::RemoveKeys; |
26 using autofill_helper::SetProfiles; | 26 using autofill_helper::SetProfiles; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 SetProfiles(profile, &autofill_profiles); | 97 SetProfiles(profile, &autofill_profiles); |
98 } | 98 } |
99 | 99 |
100 void AutofillSyncPerfTest::UpdateProfiles(int profile) { | 100 void AutofillSyncPerfTest::UpdateProfiles(int profile) { |
101 const std::vector<AutofillProfile*>& all_profiles = | 101 const std::vector<AutofillProfile*>& all_profiles = |
102 GetAllProfiles(profile); | 102 GetAllProfiles(profile); |
103 std::vector<AutofillProfile> autofill_profiles; | 103 std::vector<AutofillProfile> autofill_profiles; |
104 for (size_t i = 0; i < all_profiles.size(); ++i) { | 104 for (size_t i = 0; i < all_profiles.size(); ++i) { |
105 autofill_profiles.push_back(*all_profiles[i]); | 105 autofill_profiles.push_back(*all_profiles[i]); |
106 autofill_profiles.back().SetRawInfo(AutofillFieldType(autofill::NAME_FIRST), | 106 autofill_profiles.back().SetRawInfo(autofill::NAME_FIRST, |
107 UTF8ToUTF16(NextName())); | 107 UTF8ToUTF16(NextName())); |
108 } | 108 } |
109 SetProfiles(profile, &autofill_profiles); | 109 SetProfiles(profile, &autofill_profiles); |
110 } | 110 } |
111 | 111 |
112 void AutofillSyncPerfTest::RemoveProfiles(int profile) { | 112 void AutofillSyncPerfTest::RemoveProfiles(int profile) { |
113 std::vector<AutofillProfile> empty; | 113 std::vector<AutofillProfile> empty; |
114 SetProfiles(profile, &empty); | 114 SetProfiles(profile, &empty); |
115 } | 115 } |
116 | 116 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 ASSERT_EQ(kNumKeys, GetKeyCount(1)); | 201 ASSERT_EQ(kNumKeys, GetKeyCount(1)); |
202 SyncTimingHelper::PrintResult("autofill", "add_autofill_keys", dt); | 202 SyncTimingHelper::PrintResult("autofill", "add_autofill_keys", dt); |
203 | 203 |
204 RemoveKeys(0); | 204 RemoveKeys(0); |
205 // TODO(lipalani): fix this. The following line is added to force sync. | 205 // TODO(lipalani): fix this. The following line is added to force sync. |
206 ForceSync(0); | 206 ForceSync(0); |
207 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 207 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
208 ASSERT_EQ(0, GetKeyCount(1)); | 208 ASSERT_EQ(0, GetKeyCount(1)); |
209 SyncTimingHelper::PrintResult("autofill", "delete_autofill_keys", dt); | 209 SyncTimingHelper::PrintResult("autofill", "delete_autofill_keys", dt); |
210 } | 210 } |
OLD | NEW |