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

Side by Side Diff: chrome/browser/sync/test/integration/performance/autofill_sync_perf_test.cc

Issue 2379433002: [Sync] Refactoring of sync integration test checkers to remove boilerplate await methods. (Closed)
Patch Set: Rebase Created 4 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
OLDNEW
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
23 using autofill_helper::AllProfilesMatch; 22 using autofill_helper::AllProfilesMatch;
24 using autofill_helper::GetAllAutoFillProfiles; 23 using autofill_helper::GetAllAutoFillProfiles;
25 using autofill_helper::GetAllKeys; 24 using autofill_helper::GetAllKeys;
26 using autofill_helper::GetKeyCount; 25 using autofill_helper::GetKeyCount;
27 using autofill_helper::GetProfileCount; 26 using autofill_helper::GetProfileCount;
28 using autofill_helper::RemoveKeys; 27 using autofill_helper::RemoveKeys;
29 using autofill_helper::SetProfiles; 28 using autofill_helper::SetProfiles;
29 using sync_timing_helper::PrintResult;
30 using sync_timing_helper::TimeMutualSyncCycle;
30 31
31 // See comments in typed_urls_sync_perf_test.cc for reasons for these 32 // See comments in typed_urls_sync_perf_test.cc for reasons for these
32 // magic numbers. 33 // magic numbers.
33 // 34 //
34 // TODO(akalin): If this works, decomp the magic number calculation 35 // TODO(akalin): If this works, decomp the magic number calculation
35 // into a macro and have all the perf tests use it. 36 // into a macro and have all the perf tests use it.
36 static const int kNumKeys = 163; 37 static const int kNumKeys = 163;
37 static const int kNumProfiles = 163; 38 static const int kNumProfiles = 163;
38 39
39 class AutofillSyncPerfTest : public SyncTest { 40 class AutofillSyncPerfTest : public SyncTest {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 bookmarks_helper::AddURL(profile, 0, 169 bookmarks_helper::AddURL(profile, 0,
169 bookmarks_helper::IndexedURLTitle(id), 170 bookmarks_helper::IndexedURLTitle(id),
170 GURL(bookmarks_helper::IndexedURL(id))) != NULL); 171 GURL(bookmarks_helper::IndexedURL(id))) != NULL);
171 } 172 }
172 173
173 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, AutofillProfiles_P0) { 174 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, AutofillProfiles_P0) {
174 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 175 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
175 176
176 // TCM ID - 7557873. 177 // TCM ID - 7557873.
177 AddProfiles(0, kNumProfiles); 178 AddProfiles(0, kNumProfiles);
178 base::TimeDelta dt = 179 base::TimeDelta dt = TimeMutualSyncCycle(GetClient(0), GetClient(1));
179 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1));
180 ASSERT_EQ(kNumProfiles, GetProfileCount(1)); 180 ASSERT_EQ(kNumProfiles, GetProfileCount(1));
181 SyncTimingHelper::PrintResult("autofill", "add_autofill_profiles", dt); 181 PrintResult("autofill", "add_autofill_profiles", dt);
182 182
183 // TCM ID - 7549835. 183 // TCM ID - 7549835.
184 UpdateProfiles(0); 184 UpdateProfiles(0);
185 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); 185 dt = TimeMutualSyncCycle(GetClient(0), GetClient(1));
186 ASSERT_EQ(kNumProfiles, GetProfileCount(1)); 186 ASSERT_EQ(kNumProfiles, GetProfileCount(1));
187 SyncTimingHelper::PrintResult("autofill", "update_autofill_profiles", dt); 187 PrintResult("autofill", "update_autofill_profiles", dt);
188 188
189 // TCM ID - 7553678. 189 // TCM ID - 7553678.
190 RemoveProfiles(0); 190 RemoveProfiles(0);
191 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); 191 dt = TimeMutualSyncCycle(GetClient(0), GetClient(1));
192 ASSERT_EQ(0, GetProfileCount(1)); 192 ASSERT_EQ(0, GetProfileCount(1));
193 SyncTimingHelper::PrintResult("autofill", "delete_autofill_profiles", dt); 193 PrintResult("autofill", "delete_autofill_profiles", dt);
194 } 194 }
195 195
196 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, Autofill_P0) { 196 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, Autofill_P0) {
197 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 197 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
198 198
199 AddKeys(0, kNumKeys); 199 AddKeys(0, kNumKeys);
200 // TODO(lipalani): fix this. The following line is added to force sync. 200 // TODO(lipalani): fix this. The following line is added to force sync.
201 ForceSync(0); 201 ForceSync(0);
202 base::TimeDelta dt = 202 base::TimeDelta dt = TimeMutualSyncCycle(GetClient(0), GetClient(1));
203 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1));
204 ASSERT_EQ(kNumKeys, GetKeyCount(1)); 203 ASSERT_EQ(kNumKeys, GetKeyCount(1));
205 SyncTimingHelper::PrintResult("autofill", "add_autofill_keys", dt); 204 PrintResult("autofill", "add_autofill_keys", dt);
206 205
207 RemoveKeys(0); 206 RemoveKeys(0);
208 // TODO(lipalani): fix this. The following line is added to force sync. 207 // TODO(lipalani): fix this. The following line is added to force sync.
209 ForceSync(0); 208 ForceSync(0);
210 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); 209 dt = TimeMutualSyncCycle(GetClient(0), GetClient(1));
211 ASSERT_EQ(0, GetKeyCount(1)); 210 ASSERT_EQ(0, GetKeyCount(1));
212 SyncTimingHelper::PrintResult("autofill", "delete_autofill_keys", dt); 211 PrintResult("autofill", "delete_autofill_keys", dt);
213 } 212 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698