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

Side by Side Diff: chrome/test/live_sync/performance/autofill_sync_perf_test.cc

Issue 7491062: Sync performance test: Remove disabled benchmark tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 9 years, 4 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 | « no previous file | chrome/test/live_sync/performance/bookmarks_sync_perf_test.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/stringprintf.h" 5 #include "base/stringprintf.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/autofill/autofill_common_test.h" 7 #include "chrome/browser/autofill/autofill_common_test.h"
8 #include "chrome/browser/autofill/autofill_profile.h" 8 #include "chrome/browser/autofill/autofill_profile.h"
9 #include "chrome/browser/sync/profile_sync_service_harness.h" 9 #include "chrome/browser/sync/profile_sync_service_harness.h"
10 #include "chrome/browser/webdata/autofill_entry.h" 10 #include "chrome/browser/webdata/autofill_entry.h"
11 #include "chrome/test/live_sync/autofill_helper.h" 11 #include "chrome/test/live_sync/autofill_helper.h"
12 #include "chrome/test/live_sync/live_sync_test.h" 12 #include "chrome/test/live_sync/live_sync_test.h"
13 #include "chrome/test/live_sync/performance/sync_timing_helper.h" 13 #include "chrome/test/live_sync/performance/sync_timing_helper.h"
14 14
15 using autofill_helper::AllProfilesMatch; 15 using autofill_helper::AllProfilesMatch;
16 using autofill_helper::GetAllKeys; 16 using autofill_helper::GetAllKeys;
17 using autofill_helper::GetAllProfiles; 17 using autofill_helper::GetAllProfiles;
18 using autofill_helper::GetKeyCount; 18 using autofill_helper::GetKeyCount;
19 using autofill_helper::GetProfileCount; 19 using autofill_helper::GetProfileCount;
20 using autofill_helper::RemoveKey; 20 using autofill_helper::RemoveKey;
21 using autofill_helper::SetProfiles; 21 using autofill_helper::SetProfiles;
22 22
23 // TODO(braffert): Move kNumBenchmarkPoints and kBenchmarkPoints for all
24 // datatypes into a performance test base class, once it is possible to do so.
25 static const int kNumKeys = 150; 23 static const int kNumKeys = 150;
26 static const int kNumProfiles = 150; 24 static const int kNumProfiles = 150;
27 static const int kNumBenchmarkPoints = 18;
28 static const int kBenchmarkPoints[] = {1, 10, 20, 30, 40, 50, 75, 100, 125,
29 150, 175, 200, 225, 250, 300, 350, 400,
30 500};
31 25
32 class AutofillSyncPerfTest : public LiveSyncTest { 26 class AutofillSyncPerfTest : public LiveSyncTest {
33 public: 27 public:
34 AutofillSyncPerfTest() 28 AutofillSyncPerfTest()
35 : LiveSyncTest(TWO_CLIENT), 29 : LiveSyncTest(TWO_CLIENT),
36 guid_number_(0), 30 guid_number_(0),
37 name_number_(0), 31 name_number_(0),
38 value_number_(0) {} 32 value_number_(0) {}
39 33
40 // Adds |num_profiles| new autofill profiles to the sync profile |profile|. 34 // Adds |num_profiles| new autofill profiles to the sync profile |profile|.
41 void AddProfiles(int profile, int num_profiles); 35 void AddProfiles(int profile, int num_profiles);
42 36
43 // Updates all autofill profiles for the sync profile |profile|. 37 // Updates all autofill profiles for the sync profile |profile|.
44 void UpdateProfiles(int profile); 38 void UpdateProfiles(int profile);
45 39
46 // Removes all autofill profiles from |profile|. 40 // Removes all autofill profiles from |profile|.
47 void RemoveProfiles(int profile); 41 void RemoveProfiles(int profile);
48 42
49 // Adds |num_keys| new autofill keys to the sync profile |profile|. 43 // Adds |num_keys| new autofill keys to the sync profile |profile|.
50 void AddKeys(int profile, int num_keys); 44 void AddKeys(int profile, int num_keys);
51 45
52 // Removes all autofill keys from |profile|. 46 // Removes all autofill keys from |profile|.
53 void RemoveKeys(int profile); 47 void RemoveKeys(int profile);
54 48
55 // Removes all autofill profiles in all sync profiles. Called between
56 // benchmark iterations.
57 void Cleanup();
58
59 private: 49 private:
60 // Returns a new unique autofill profile. 50 // Returns a new unique autofill profile.
61 const AutofillProfile NextAutofillProfile(); 51 const AutofillProfile NextAutofillProfile();
62 52
63 // Returns a new unique autofill key. 53 // Returns a new unique autofill key.
64 const AutofillKey NextAutofillKey(); 54 const AutofillKey NextAutofillKey();
65 55
66 // Returns an unused unique guid. 56 // Returns an unused unique guid.
67 const std::string NextGUID(); 57 const std::string NextGUID();
68 58
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 116 }
127 117
128 void AutofillSyncPerfTest::RemoveKeys(int profile) { 118 void AutofillSyncPerfTest::RemoveKeys(int profile) {
129 std::set<AutofillEntry> keys = GetAllKeys(profile); 119 std::set<AutofillEntry> keys = GetAllKeys(profile);
130 for (std::set<AutofillEntry>::const_iterator it = keys.begin(); 120 for (std::set<AutofillEntry>::const_iterator it = keys.begin();
131 it != keys.end(); ++it) { 121 it != keys.end(); ++it) {
132 RemoveKey(profile, it->key()); 122 RemoveKey(profile, it->key());
133 } 123 }
134 } 124 }
135 125
136 void AutofillSyncPerfTest::Cleanup() {
137 for (int i = 0; i < num_clients(); ++i) {
138 RemoveProfiles(i);
139 }
140 ASSERT_TRUE(AwaitQuiescence());
141 }
142
143 const AutofillProfile AutofillSyncPerfTest::NextAutofillProfile() { 126 const AutofillProfile AutofillSyncPerfTest::NextAutofillProfile() {
144 AutofillProfile profile; 127 AutofillProfile profile;
145 autofill_test::SetProfileInfoWithGuid(&profile, NextGUID().c_str(), 128 autofill_test::SetProfileInfoWithGuid(&profile, NextGUID().c_str(),
146 NextName().c_str(), "", "", "", "", "", 129 NextName().c_str(), "", "", "", "", "",
147 "", "", "", "", "", "", ""); 130 "", "", "", "", "", "", "");
148 return profile; 131 return profile;
149 } 132 }
150 133
151 const AutofillKey AutofillSyncPerfTest::NextAutofillKey() { 134 const AutofillKey AutofillSyncPerfTest::NextAutofillKey() {
152 return AutofillKey(NextName().c_str(), NextName().c_str()); 135 return AutofillKey(NextName().c_str(), NextName().c_str());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 base::TimeDelta dt = 189 base::TimeDelta dt =
207 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); 190 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1));
208 ASSERT_EQ(kNumKeys, GetKeyCount(1)); 191 ASSERT_EQ(kNumKeys, GetKeyCount(1));
209 SyncTimingHelper::PrintResult("autofill", "add_autofill_keys", dt); 192 SyncTimingHelper::PrintResult("autofill", "add_autofill_keys", dt);
210 193
211 RemoveKeys(0); 194 RemoveKeys(0);
212 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); 195 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1));
213 ASSERT_EQ(0, GetKeyCount(1)); 196 ASSERT_EQ(0, GetKeyCount(1));
214 SyncTimingHelper::PrintResult("autofill", "delete_autofill_keys", dt); 197 SyncTimingHelper::PrintResult("autofill", "delete_autofill_keys", dt);
215 } 198 }
216
217 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, DISABLED_Benchmark) {
218 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
219
220 for (int i = 0; i < kNumBenchmarkPoints; ++i) {
221 int num_profiles = kBenchmarkPoints[i];
222 AddProfiles(0, num_profiles);
223 base::TimeDelta dt_add =
224 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1));
225 ASSERT_EQ(num_profiles, GetProfileCount(0));
226 ASSERT_TRUE(AllProfilesMatch());
227 VLOG(0) << std::endl << "Add: " << num_profiles << " "
228 << dt_add.InSecondsF();
229
230 UpdateProfiles(0);
231 base::TimeDelta dt_update =
232 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1));
233 ASSERT_EQ(num_profiles, GetProfileCount(0));
234 ASSERT_TRUE(AllProfilesMatch());
235 VLOG(0) << std::endl << "Update: " << num_profiles << " "
236 << dt_update.InSecondsF();
237
238 RemoveProfiles(0);
239 base::TimeDelta dt_delete =
240 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1));
241 ASSERT_EQ(0, GetProfileCount(0));
242 ASSERT_TRUE(AllProfilesMatch());
243 VLOG(0) << std::endl << "Delete: " << num_profiles << " "
244 << dt_delete.InSecondsF();
245
246 Cleanup();
247 }
248 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/live_sync/performance/bookmarks_sync_perf_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698