| 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/sync/profile_sync_service_harness.h" | 6 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 7 #include "chrome/test/live_sync/live_extensions_sync_test.h" | 7 #include "chrome/test/live_sync/live_extensions_sync_test.h" |
| 8 #include "chrome/test/live_sync/performance/sync_timing_helper.h" | 8 #include "chrome/test/live_sync/performance/sync_timing_helper.h" |
| 9 | 9 |
| 10 // TODO(braffert): Replicate these tests for apps. | 10 // TODO(braffert): Replicate these tests for apps. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 85 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 86 int num_default_extensions = GetExtensionCount(0); | 86 int num_default_extensions = GetExtensionCount(0); |
| 87 int expected_extension_count = num_default_extensions + kNumExtensions; | 87 int expected_extension_count = num_default_extensions + kNumExtensions; |
| 88 | 88 |
| 89 // TCM ID - 7563874. | 89 // TCM ID - 7563874. |
| 90 AddExtensions(0, kNumExtensions); | 90 AddExtensions(0, kNumExtensions); |
| 91 base::TimeDelta dt = | 91 base::TimeDelta dt = |
| 92 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 92 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 93 InstallExtensionsPendingForSync(GetProfile(1)); | 93 InstallExtensionsPendingForSync(GetProfile(1)); |
| 94 ASSERT_EQ(expected_extension_count, GetExtensionCount(1)); | 94 ASSERT_EQ(expected_extension_count, GetExtensionCount(1)); |
| 95 SyncTimingHelper::PrintResult("extensions", "add", dt); | 95 SyncTimingHelper::PrintResult("extensions", "add_extensions", dt); |
| 96 | 96 |
| 97 // TCM ID - 7655397. | 97 // TCM ID - 7655397. |
| 98 UpdateExtensions(0); | 98 UpdateExtensions(0); |
| 99 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 99 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 100 ASSERT_EQ(expected_extension_count, GetExtensionCount(1)); | 100 ASSERT_EQ(expected_extension_count, GetExtensionCount(1)); |
| 101 SyncTimingHelper::PrintResult("extensions", "update", dt); | 101 SyncTimingHelper::PrintResult("extensions", "update_extensions", dt); |
| 102 | 102 |
| 103 // TCM ID - 7567721. | 103 // TCM ID - 7567721. |
| 104 RemoveExtensions(0); | 104 RemoveExtensions(0); |
| 105 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 105 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 106 ASSERT_EQ(num_default_extensions, GetExtensionCount(1)); | 106 ASSERT_EQ(num_default_extensions, GetExtensionCount(1)); |
| 107 SyncTimingHelper::PrintResult("extensions", "delete", dt); | 107 SyncTimingHelper::PrintResult("extensions", "delete_extensions", dt); |
| 108 } | 108 } |
| 109 | 109 |
| 110 IN_PROC_BROWSER_TEST_F(ExtensionsSyncPerfTest, DISABLED_Benchmark) { | 110 IN_PROC_BROWSER_TEST_F(ExtensionsSyncPerfTest, DISABLED_Benchmark) { |
| 111 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 111 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 112 | 112 |
| 113 for (int i = 0; i < kNumBenchmarkPoints; ++i) { | 113 for (int i = 0; i < kNumBenchmarkPoints; ++i) { |
| 114 int num_extensions = kBenchmarkPoints[i]; | 114 int num_extensions = kBenchmarkPoints[i]; |
| 115 AddExtensions(0, num_extensions); | 115 AddExtensions(0, num_extensions); |
| 116 base::TimeDelta dt_add = | 116 base::TimeDelta dt_add = |
| 117 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 117 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 118 InstallExtensionsPendingForSync(GetProfile(1)); | 118 InstallExtensionsPendingForSync(GetProfile(1)); |
| 119 VLOG(0) << std::endl << "Add: " << num_extensions << " " | 119 VLOG(0) << std::endl << "Add: " << num_extensions << " " |
| 120 << dt_add.InSecondsF(); | 120 << dt_add.InSecondsF(); |
| 121 | 121 |
| 122 UpdateExtensions(0); | 122 UpdateExtensions(0); |
| 123 base::TimeDelta dt_update = | 123 base::TimeDelta dt_update = |
| 124 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 124 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 125 VLOG(0) << std::endl << "Update: " << num_extensions << " " | 125 VLOG(0) << std::endl << "Update: " << num_extensions << " " |
| 126 << dt_update.InSecondsF(); | 126 << dt_update.InSecondsF(); |
| 127 | 127 |
| 128 RemoveExtensions(0); | 128 RemoveExtensions(0); |
| 129 base::TimeDelta dt_delete = | 129 base::TimeDelta dt_delete = |
| 130 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 130 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 131 VLOG(0) << std::endl << "Delete: " << num_extensions << " " | 131 VLOG(0) << std::endl << "Delete: " << num_extensions << " " |
| 132 << dt_delete.InSecondsF(); | 132 << dt_delete.InSecondsF(); |
| 133 | 133 |
| 134 Cleanup(); | 134 Cleanup(); |
| 135 } | 135 } |
| 136 } | 136 } |
| OLD | NEW |