Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/browser/autofill/autofill_common_test.h" | 6 #include "chrome/browser/autofill/autofill_common_test.h" |
| 7 #include "chrome/browser/sync/profile_sync_service_harness.h" | 7 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 8 #include "chrome/test/live_sync/live_autofill_sync_test.h" | 8 #include "chrome/test/live_sync/live_autofill_sync_test.h" |
| 9 #include "chrome/test/live_sync/performance/sync_timing_helper.h" | 9 #include "chrome/test/live_sync/performance/sync_timing_helper.h" |
| 10 | 10 |
| 11 static const int kNumProfiles = 150; | 11 static const int kNumProfiles = 150; |
| 12 | |
| 13 // TODO(braffert): Consider the range / resolution of these test points. | |
|
Raghu Simha
2011/07/26 06:19:45
Perhaps replace this with a TODO for moving kBench
braffert
2011/07/26 17:46:59
Done.
| |
| 14 static const int kNumBenchmarkPoints = 18; | 12 static const int kNumBenchmarkPoints = 18; |
| 15 static const int kBenchmarkPoints[] = {1, 10, 20, 30, 40, 50, 75, 100, 125, | 13 static const int kBenchmarkPoints[] = {1, 10, 20, 30, 40, 50, 75, 100, 125, |
| 16 150, 175, 200, 225, 250, 300, 350, 400, | 14 150, 175, 200, 225, 250, 300, 350, 400, |
| 17 500}; | 15 500}; |
| 18 | 16 |
| 19 // TODO(braffert): Move this class into its own .h/.cc files. What should the | |
| 20 // class files be named as opposed to the file containing the tests themselves? | |
|
Raghu Simha
2011/07/26 06:19:45
Curious: You're deleting the TODO to move the clas
braffert
2011/07/26 17:46:59
That's what I was thinking as well - currently the
| |
| 21 class AutofillSyncPerfTest | 17 class AutofillSyncPerfTest |
| 22 : public TwoClientLiveAutofillSyncTest { | 18 : public TwoClientLiveAutofillSyncTest { |
| 23 public: | 19 public: |
| 24 AutofillSyncPerfTest() : guid_number_(0), name_number_(0) {} | 20 AutofillSyncPerfTest() : guid_number_(0), name_number_(0) {} |
| 25 | 21 |
| 26 // Adds |num_profiles| new autofill profiles to the sync profile |profile|. | 22 // Adds |num_profiles| new autofill profiles to the sync profile |profile|. |
| 27 void AddProfiles(int profile, int num_profiles); | 23 void AddProfiles(int profile, int num_profiles); |
| 28 | 24 |
| 29 // Updates all autofill profiles for the sync profile |profile|. | 25 // Updates all autofill profiles for the sync profile |profile|. |
| 30 void UpdateProfiles(int profile); | 26 void UpdateProfiles(int profile); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 // TCM ID - 7557873. | 116 // TCM ID - 7557873. |
| 121 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, Add) { | 117 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, Add) { |
| 122 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 118 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 123 | 119 |
| 124 AddProfiles(0, kNumProfiles); | 120 AddProfiles(0, kNumProfiles); |
| 125 base::TimeDelta dt = | 121 base::TimeDelta dt = |
| 126 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 122 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 127 ASSERT_EQ(kNumProfiles, GetProfileCount(0)); | 123 ASSERT_EQ(kNumProfiles, GetProfileCount(0)); |
| 128 ASSERT_TRUE(AllProfilesMatch()); | 124 ASSERT_TRUE(AllProfilesMatch()); |
| 129 | 125 |
| 130 // TODO(braffert): Compare timings against some target value. | 126 SyncTimingHelper::PrintResult("autofill", "add", dt); |
|
Raghu Simha
2011/07/26 06:19:45
Don't you still have to compare the timings? I don
braffert
2011/07/26 17:46:59
The tracking and comparison is done automatically
| |
| 131 VLOG(0) << std::endl << "dt: " << dt.InSecondsF() << " s"; | |
| 132 } | 127 } |
| 133 | 128 |
| 134 // TCM ID - 7549835. | 129 // TCM ID - 7549835. |
| 135 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, Update) { | 130 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, Update) { |
| 136 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 131 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 137 | 132 |
| 138 AddProfiles(0, kNumProfiles); | 133 AddProfiles(0, kNumProfiles); |
| 139 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 134 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 140 | 135 |
| 141 UpdateProfiles(0); | 136 UpdateProfiles(0); |
| 142 base::TimeDelta dt = | 137 base::TimeDelta dt = |
| 143 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 138 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 144 ASSERT_EQ(kNumProfiles, GetProfileCount(0)); | 139 ASSERT_EQ(kNumProfiles, GetProfileCount(0)); |
| 145 ASSERT_TRUE(AllProfilesMatch()); | 140 ASSERT_TRUE(AllProfilesMatch()); |
| 146 | 141 |
| 147 // TODO(braffert): Compare timings against some target value. | 142 SyncTimingHelper::PrintResult("autofill", "update", dt); |
| 148 VLOG(0) << std::endl << "dt: " << dt.InSecondsF() << " s"; | |
| 149 } | 143 } |
| 150 | 144 |
| 151 // TCM ID - 7553678. | 145 // TCM ID - 7553678. |
| 152 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, Delete) { | 146 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, Delete) { |
| 153 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 147 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 154 | 148 |
| 155 AddProfiles(0, kNumProfiles); | 149 AddProfiles(0, kNumProfiles); |
| 156 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 150 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 157 | 151 |
| 158 RemoveProfiles(0); | 152 RemoveProfiles(0); |
| 159 base::TimeDelta dt = | 153 base::TimeDelta dt = |
| 160 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 154 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 161 ASSERT_EQ(0, GetProfileCount(0)); | 155 ASSERT_EQ(0, GetProfileCount(0)); |
| 162 ASSERT_TRUE(AllProfilesMatch()); | 156 ASSERT_TRUE(AllProfilesMatch()); |
| 163 | 157 |
| 164 // TODO(braffert): Compare timings against some target value. | 158 SyncTimingHelper::PrintResult("autofill", "delete", dt); |
| 165 VLOG(0) << std::endl << "dt: " << dt.InSecondsF() << " s"; | |
| 166 } | 159 } |
| 167 | 160 |
| 168 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, DISABLED_Benchmark) { | 161 IN_PROC_BROWSER_TEST_F(AutofillSyncPerfTest, DISABLED_Benchmark) { |
| 169 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 162 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 170 | 163 |
| 171 for (int i = 0; i < kNumBenchmarkPoints; ++i) { | 164 for (int i = 0; i < kNumBenchmarkPoints; ++i) { |
| 172 int num_profiles = kBenchmarkPoints[i]; | 165 int num_profiles = kBenchmarkPoints[i]; |
| 173 AddProfiles(0, num_profiles); | 166 AddProfiles(0, num_profiles); |
| 174 base::TimeDelta dt_add = | 167 base::TimeDelta dt_add = |
| 175 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 168 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 190 base::TimeDelta dt_delete = | 183 base::TimeDelta dt_delete = |
| 191 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 184 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 192 ASSERT_EQ(0, GetProfileCount(0)); | 185 ASSERT_EQ(0, GetProfileCount(0)); |
| 193 ASSERT_TRUE(AllProfilesMatch()); | 186 ASSERT_TRUE(AllProfilesMatch()); |
| 194 VLOG(0) << std::endl << "Delete: " << num_profiles << " " | 187 VLOG(0) << std::endl << "Delete: " << num_profiles << " " |
| 195 << dt_delete.InSecondsF(); | 188 << dt_delete.InSecondsF(); |
| 196 | 189 |
| 197 Cleanup(); | 190 Cleanup(); |
| 198 } | 191 } |
| 199 } | 192 } |
| OLD | NEW |