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/basictypes.h" | 5 #include "base/basictypes.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 "sync/sessions/sync_session_context.h" | 11 #include "sync/sessions/sync_session_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 |
17 // This number should be as far away from a multiple of | 17 // This number should be as far away from a multiple of |
18 // kDefaultMaxCommitBatchSize as possible, so that sync cycle counts | 18 // kDefaultMaxCommitBatchSize as possible, so that sync cycle counts |
19 // for batch operations stay the same even if some batches end up not | 19 // for batch operations stay the same even if some batches end up not |
20 // being completely full. | 20 // being completely full. |
21 static const int kNumUrls = 163; | 21 static const int kNumUrls = 163; |
22 // This compile assert basically asserts that kNumUrls is right in the | 22 // This compile assert basically asserts that kNumUrls is right in the |
23 // middle between two multiples of kDefaultMaxCommitBatchSize. | 23 // middle between two multiples of kDefaultMaxCommitBatchSize. |
24 COMPILE_ASSERT( | 24 static_assert( |
25 ((kNumUrls % syncer::kDefaultMaxCommitBatchSize) >= | 25 ((kNumUrls % syncer::kDefaultMaxCommitBatchSize) >= |
26 (syncer::kDefaultMaxCommitBatchSize / 2)) && | 26 (syncer::kDefaultMaxCommitBatchSize / 2)) && |
27 ((kNumUrls % syncer::kDefaultMaxCommitBatchSize) <= | 27 ((kNumUrls % syncer::kDefaultMaxCommitBatchSize) <= |
28 ((syncer::kDefaultMaxCommitBatchSize + 1) / 2)), | 28 ((syncer::kDefaultMaxCommitBatchSize + 1) / 2)), |
29 kNumUrlsShouldBeBetweenTwoMultiplesOfkDefaultMaxCommitBatchSize); | 29 "kNumUrls should be between two multiples of kDefaultMaxCommitBatchSize"); |
30 | 30 |
31 class TypedUrlsSyncPerfTest : public SyncTest { | 31 class TypedUrlsSyncPerfTest : public SyncTest { |
32 public: | 32 public: |
33 TypedUrlsSyncPerfTest() | 33 TypedUrlsSyncPerfTest() |
34 : SyncTest(TWO_CLIENT), | 34 : SyncTest(TWO_CLIENT), |
35 url_number_(0) {} | 35 url_number_(0) {} |
36 | 36 |
37 // Adds |num_urls| new unique typed urls to |profile|. | 37 // Adds |num_urls| new unique typed urls to |profile|. |
38 void AddURLs(int profile, int num_urls); | 38 void AddURLs(int profile, int num_urls); |
39 | 39 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 108 dt = SyncTimingHelper::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 SyncTimingHelper::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 = SyncTimingHelper::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 SyncTimingHelper::PrintResult("typed_urls", "delete_typed_urls", dt); |
117 } | 117 } |
OLD | NEW |