| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/sync/test/integration/autofill_helper.h" | 10 #include "chrome/browser/sync/test/integration/autofill_helper.h" |
| 11 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 11 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
| 12 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" | 12 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" |
| 13 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 13 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| 14 #include "chrome/browser/sync/test/integration/sync_test.h" | 14 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 15 #include "components/autofill/core/browser/autofill_profile.h" | 15 #include "components/autofill/core/browser/autofill_profile.h" |
| 16 #include "components/autofill/core/browser/autofill_test_utils.h" | 16 #include "components/autofill/core/browser/autofill_test_utils.h" |
| 17 #include "components/autofill/core/browser/webdata/autofill_entry.h" | 17 #include "components/autofill/core/browser/webdata/autofill_entry.h" |
| 18 | 18 |
| 19 using autofill::ServerFieldType; | 19 using autofill::ServerFieldType; |
| 20 using autofill::AutofillKey; | 20 using autofill::AutofillKey; |
| 21 using autofill::AutofillProfile; | 21 using autofill::AutofillProfile; |
| 22 | 22 |
| 23 using autofill_helper::AllProfilesMatch; | 23 using autofill_helper::AllProfilesMatch; |
| 24 using autofill_helper::GetAllAutoFillProfiles; |
| 24 using autofill_helper::GetAllKeys; | 25 using autofill_helper::GetAllKeys; |
| 25 using autofill_helper::GetAllProfiles; | |
| 26 using autofill_helper::GetKeyCount; | 26 using autofill_helper::GetKeyCount; |
| 27 using autofill_helper::GetProfileCount; | 27 using autofill_helper::GetProfileCount; |
| 28 using autofill_helper::RemoveKeys; | 28 using autofill_helper::RemoveKeys; |
| 29 using autofill_helper::SetProfiles; | 29 using autofill_helper::SetProfiles; |
| 30 | 30 |
| 31 // See comments in typed_urls_sync_perf_test.cc for reasons for these | 31 // See comments in typed_urls_sync_perf_test.cc for reasons for these |
| 32 // magic numbers. | 32 // magic numbers. |
| 33 // | 33 // |
| 34 // TODO(akalin): If this works, decomp the magic number calculation | 34 // TODO(akalin): If this works, decomp the magic number calculation |
| 35 // into a macro and have all the perf tests use it. | 35 // into a macro and have all the perf tests use it. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 const std::string IntToValue(int n); | 82 const std::string IntToValue(int n); |
| 83 | 83 |
| 84 int guid_number_; | 84 int guid_number_; |
| 85 int name_number_; | 85 int name_number_; |
| 86 int value_number_; | 86 int value_number_; |
| 87 DISALLOW_COPY_AND_ASSIGN(AutofillSyncPerfTest); | 87 DISALLOW_COPY_AND_ASSIGN(AutofillSyncPerfTest); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 void AutofillSyncPerfTest::AddProfiles(int profile, int num_profiles) { | 90 void AutofillSyncPerfTest::AddProfiles(int profile, int num_profiles) { |
| 91 const std::vector<AutofillProfile*>& all_profiles = | 91 const std::vector<AutofillProfile*>& all_profiles = |
| 92 GetAllProfiles(profile); | 92 GetAllAutoFillProfiles(profile); |
| 93 std::vector<AutofillProfile> autofill_profiles; | 93 std::vector<AutofillProfile> autofill_profiles; |
| 94 for (size_t i = 0; i < all_profiles.size(); ++i) { | 94 for (size_t i = 0; i < all_profiles.size(); ++i) { |
| 95 autofill_profiles.push_back(*all_profiles[i]); | 95 autofill_profiles.push_back(*all_profiles[i]); |
| 96 } | 96 } |
| 97 for (int i = 0; i < num_profiles; ++i) { | 97 for (int i = 0; i < num_profiles; ++i) { |
| 98 autofill_profiles.push_back(NextAutofillProfile()); | 98 autofill_profiles.push_back(NextAutofillProfile()); |
| 99 } | 99 } |
| 100 SetProfiles(profile, &autofill_profiles); | 100 SetProfiles(profile, &autofill_profiles); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void AutofillSyncPerfTest::UpdateProfiles(int profile) { | 103 void AutofillSyncPerfTest::UpdateProfiles(int profile) { |
| 104 const std::vector<AutofillProfile*>& all_profiles = | 104 const std::vector<AutofillProfile*>& all_profiles = |
| 105 GetAllProfiles(profile); | 105 GetAllAutoFillProfiles(profile); |
| 106 std::vector<AutofillProfile> autofill_profiles; | 106 std::vector<AutofillProfile> autofill_profiles; |
| 107 for (size_t i = 0; i < all_profiles.size(); ++i) { | 107 for (size_t i = 0; i < all_profiles.size(); ++i) { |
| 108 autofill_profiles.push_back(*all_profiles[i]); | 108 autofill_profiles.push_back(*all_profiles[i]); |
| 109 autofill_profiles.back().SetRawInfo(autofill::NAME_FIRST, | 109 autofill_profiles.back().SetRawInfo(autofill::NAME_FIRST, |
| 110 base::UTF8ToUTF16(NextName())); | 110 base::UTF8ToUTF16(NextName())); |
| 111 } | 111 } |
| 112 SetProfiles(profile, &autofill_profiles); | 112 SetProfiles(profile, &autofill_profiles); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void AutofillSyncPerfTest::RemoveProfiles(int profile) { | 115 void AutofillSyncPerfTest::RemoveProfiles(int profile) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 ASSERT_EQ(kNumKeys, GetKeyCount(1)); | 204 ASSERT_EQ(kNumKeys, GetKeyCount(1)); |
| 205 SyncTimingHelper::PrintResult("autofill", "add_autofill_keys", dt); | 205 SyncTimingHelper::PrintResult("autofill", "add_autofill_keys", dt); |
| 206 | 206 |
| 207 RemoveKeys(0); | 207 RemoveKeys(0); |
| 208 // TODO(lipalani): fix this. The following line is added to force sync. | 208 // TODO(lipalani): fix this. The following line is added to force sync. |
| 209 ForceSync(0); | 209 ForceSync(0); |
| 210 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 210 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 211 ASSERT_EQ(0, GetKeyCount(1)); | 211 ASSERT_EQ(0, GetKeyCount(1)); |
| 212 SyncTimingHelper::PrintResult("autofill", "delete_autofill_keys", dt); | 212 SyncTimingHelper::PrintResult("autofill", "delete_autofill_keys", dt); |
| 213 } | 213 } |
| OLD | NEW |