| 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/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/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" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 const AutofillKey AutofillSyncPerfTest::NextAutofillKey() { | 129 const AutofillKey AutofillSyncPerfTest::NextAutofillKey() { |
| 130 return AutofillKey(NextName().c_str(), NextName().c_str()); | 130 return AutofillKey(NextName().c_str(), NextName().c_str()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 const std::string AutofillSyncPerfTest::NextGUID() { | 133 const std::string AutofillSyncPerfTest::NextGUID() { |
| 134 return IntToGUID(guid_number_++); | 134 return IntToGUID(guid_number_++); |
| 135 } | 135 } |
| 136 | 136 |
| 137 const std::string AutofillSyncPerfTest::IntToGUID(int n) { | 137 const std::string AutofillSyncPerfTest::IntToGUID(int n) { |
| 138 return StringPrintf("00000000-0000-0000-0000-%012X", n); | 138 return base::StringPrintf("00000000-0000-0000-0000-%012X", n); |
| 139 } | 139 } |
| 140 | 140 |
| 141 const std::string AutofillSyncPerfTest::NextName() { | 141 const std::string AutofillSyncPerfTest::NextName() { |
| 142 return IntToName(name_number_++); | 142 return IntToName(name_number_++); |
| 143 } | 143 } |
| 144 | 144 |
| 145 const std::string AutofillSyncPerfTest::IntToName(int n) { | 145 const std::string AutofillSyncPerfTest::IntToName(int n) { |
| 146 return StringPrintf("Name%d", n); | 146 return base::StringPrintf("Name%d", n); |
| 147 } | 147 } |
| 148 | 148 |
| 149 const std::string AutofillSyncPerfTest::NextValue() { | 149 const std::string AutofillSyncPerfTest::NextValue() { |
| 150 return IntToValue(value_number_++); | 150 return IntToValue(value_number_++); |
| 151 } | 151 } |
| 152 | 152 |
| 153 const std::string AutofillSyncPerfTest::IntToValue(int n) { | 153 const std::string AutofillSyncPerfTest::IntToValue(int n) { |
| 154 return StringPrintf("Value%d", n); | 154 return base::StringPrintf("Value%d", n); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void ForceSync(int profile) { | 157 void ForceSync(int profile) { |
| 158 static int id = 0; | 158 static int id = 0; |
| 159 ++id; | 159 ++id; |
| 160 EXPECT_TRUE( | 160 EXPECT_TRUE( |
| 161 bookmarks_helper::AddURL(profile, 0, | 161 bookmarks_helper::AddURL(profile, 0, |
| 162 bookmarks_helper::IndexedURLTitle(id), | 162 bookmarks_helper::IndexedURLTitle(id), |
| 163 GURL(bookmarks_helper::IndexedURL(id))) != NULL); | 163 GURL(bookmarks_helper::IndexedURL(id))) != NULL); |
| 164 } | 164 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 ASSERT_EQ(kNumKeys, GetKeyCount(1)); | 197 ASSERT_EQ(kNumKeys, GetKeyCount(1)); |
| 198 SyncTimingHelper::PrintResult("autofill", "add_autofill_keys", dt); | 198 SyncTimingHelper::PrintResult("autofill", "add_autofill_keys", dt); |
| 199 | 199 |
| 200 RemoveKeys(0); | 200 RemoveKeys(0); |
| 201 // TODO(lipalani): fix this. The following line is added to force sync. | 201 // TODO(lipalani): fix this. The following line is added to force sync. |
| 202 ForceSync(0); | 202 ForceSync(0); |
| 203 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 203 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 204 ASSERT_EQ(0, GetKeyCount(1)); | 204 ASSERT_EQ(0, GetKeyCount(1)); |
| 205 SyncTimingHelper::PrintResult("autofill", "delete_autofill_keys", dt); | 205 SyncTimingHelper::PrintResult("autofill", "delete_autofill_keys", dt); |
| 206 } | 206 } |
| OLD | NEW |