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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" | 7 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" |
8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
9 #include "chrome/browser/sync/test/integration/sync_test.h" | 9 #include "chrome/browser/sync/test/integration/sync_test.h" |
10 #include "chrome/browser/sync/test/integration/typed_urls_helper.h" | 10 #include "chrome/browser/sync/test/integration/typed_urls_helper.h" |
11 #include "components/sync/engine_impl/cycle/sync_cycle_context.h" | 11 #include "components/sync/engine_impl/cycle/sync_cycle_context.h" |
12 | 12 |
13 using typed_urls_helper::AddUrlToHistory; | 13 using typed_urls_helper::AddUrlToHistory; |
14 using typed_urls_helper::DeleteUrlsFromHistory; | 14 using typed_urls_helper::DeleteUrlsFromHistory; |
15 using typed_urls_helper::GetTypedUrlsFromClient; | 15 using typed_urls_helper::GetTypedUrlsFromClient; |
16 | 16 using sync_timing_helper::PrintResult; |
| 17 using sync_timing_helper::TimeMutualSyncCycle; |
17 // This number should be as far away from a multiple of | 18 // This number should be as far away from a multiple of |
18 // kDefaultMaxCommitBatchSize as possible, so that sync cycle counts | 19 // kDefaultMaxCommitBatchSize as possible, so that sync cycle counts |
19 // for batch operations stay the same even if some batches end up not | 20 // for batch operations stay the same even if some batches end up not |
20 // being completely full. | 21 // being completely full. |
21 static const int kNumUrls = 163; | 22 static const int kNumUrls = 163; |
22 // This compile assert basically asserts that kNumUrls is right in the | 23 // This compile assert basically asserts that kNumUrls is right in the |
23 // middle between two multiples of kDefaultMaxCommitBatchSize. | 24 // middle between two multiples of kDefaultMaxCommitBatchSize. |
24 static_assert( | 25 static_assert( |
25 ((kNumUrls % syncer::kDefaultMaxCommitBatchSize) >= | 26 ((kNumUrls % syncer::kDefaultMaxCommitBatchSize) >= |
26 (syncer::kDefaultMaxCommitBatchSize / 2)) && | 27 (syncer::kDefaultMaxCommitBatchSize / 2)) && |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 92 |
92 GURL TypedUrlsSyncPerfTest::IntToURL(int n) { | 93 GURL TypedUrlsSyncPerfTest::IntToURL(int n) { |
93 return GURL(base::StringPrintf("http://history%d.google.com/", n)); | 94 return GURL(base::StringPrintf("http://history%d.google.com/", n)); |
94 } | 95 } |
95 | 96 |
96 IN_PROC_BROWSER_TEST_F(TypedUrlsSyncPerfTest, P0) { | 97 IN_PROC_BROWSER_TEST_F(TypedUrlsSyncPerfTest, P0) { |
97 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 98 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
98 | 99 |
99 // TCM ID - 7985716. | 100 // TCM ID - 7985716. |
100 AddURLs(0, kNumUrls); | 101 AddURLs(0, kNumUrls); |
101 base::TimeDelta dt = | 102 base::TimeDelta dt = TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
102 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | |
103 ASSERT_EQ(kNumUrls, GetURLCount(1)); | 103 ASSERT_EQ(kNumUrls, GetURLCount(1)); |
104 SyncTimingHelper::PrintResult("typed_urls", "add_typed_urls", dt); | 104 PrintResult("typed_urls", "add_typed_urls", dt); |
105 | 105 |
106 // TCM ID - 7981755. | 106 // TCM ID - 7981755. |
107 UpdateURLs(0); | 107 UpdateURLs(0); |
108 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 108 dt = TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
109 ASSERT_EQ(kNumUrls, GetURLCount(1)); | 109 ASSERT_EQ(kNumUrls, GetURLCount(1)); |
110 SyncTimingHelper::PrintResult("typed_urls", "update_typed_urls", dt); | 110 PrintResult("typed_urls", "update_typed_urls", dt); |
111 | 111 |
112 // TCM ID - 7651271. | 112 // TCM ID - 7651271. |
113 RemoveURLs(0); | 113 RemoveURLs(0); |
114 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 114 dt = TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
115 ASSERT_EQ(0, GetURLCount(1)); | 115 ASSERT_EQ(0, GetURLCount(1)); |
116 SyncTimingHelper::PrintResult("typed_urls", "delete_typed_urls", dt); | 116 PrintResult("typed_urls", "delete_typed_urls", dt); |
117 } | 117 } |
OLD | NEW |