| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "chrome/browser/sync/test/integration/dictionary_helper.h" | 9 #include "chrome/browser/sync/test/integration/dictionary_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" |
| 11 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 11 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| 12 #include "chrome/browser/sync/test/integration/sync_test.h" | 12 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 13 #include "components/spellcheck/common/spellcheck_common.h" | 13 #include "components/spellcheck/common/spellcheck_common.h" |
| 14 | 14 |
| 15 using sync_timing_helper::PrintResult; |
| 16 using sync_timing_helper::TimeMutualSyncCycle; |
| 17 |
| 15 class DictionarySyncPerfTest : public SyncTest { | 18 class DictionarySyncPerfTest : public SyncTest { |
| 16 public: | 19 public: |
| 17 DictionarySyncPerfTest() : SyncTest(TWO_CLIENT) {} | 20 DictionarySyncPerfTest() : SyncTest(TWO_CLIENT) {} |
| 18 ~DictionarySyncPerfTest() override {} | 21 ~DictionarySyncPerfTest() override {} |
| 19 | 22 |
| 20 private: | 23 private: |
| 21 DISALLOW_COPY_AND_ASSIGN(DictionarySyncPerfTest); | 24 DISALLOW_COPY_AND_ASSIGN(DictionarySyncPerfTest); |
| 22 }; | 25 }; |
| 23 | 26 |
| 24 IN_PROC_BROWSER_TEST_F(DictionarySyncPerfTest, P0) { | 27 IN_PROC_BROWSER_TEST_F(DictionarySyncPerfTest, P0) { |
| 25 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 28 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 26 dictionary_helper::LoadDictionaries(); | 29 dictionary_helper::LoadDictionaries(); |
| 27 ASSERT_TRUE(dictionary_helper::DictionariesMatch()); | 30 ASSERT_TRUE(dictionary_helper::DictionariesMatch()); |
| 28 | 31 |
| 29 base::TimeDelta dt; | 32 base::TimeDelta dt; |
| 30 for (size_t i = 0; i < spellcheck::MAX_SYNCABLE_DICTIONARY_WORDS; ++i) { | 33 for (size_t i = 0; i < spellcheck::MAX_SYNCABLE_DICTIONARY_WORDS; ++i) { |
| 31 ASSERT_TRUE(dictionary_helper::AddWord( | 34 ASSERT_TRUE(dictionary_helper::AddWord( |
| 32 0, "foo" + base::Uint64ToString(i))); | 35 0, "foo" + base::Uint64ToString(i))); |
| 33 } | 36 } |
| 34 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 37 dt = TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 35 ASSERT_EQ(spellcheck::MAX_SYNCABLE_DICTIONARY_WORDS, | 38 ASSERT_EQ(spellcheck::MAX_SYNCABLE_DICTIONARY_WORDS, |
| 36 dictionary_helper::GetDictionarySize(1)); | 39 dictionary_helper::GetDictionarySize(1)); |
| 37 SyncTimingHelper::PrintResult("dictionary", "add_words", dt); | 40 PrintResult("dictionary", "add_words", dt); |
| 38 | 41 |
| 39 for (size_t i = 0; i < spellcheck::MAX_SYNCABLE_DICTIONARY_WORDS; ++i) { | 42 for (size_t i = 0; i < spellcheck::MAX_SYNCABLE_DICTIONARY_WORDS; ++i) { |
| 40 ASSERT_TRUE(dictionary_helper::RemoveWord( | 43 ASSERT_TRUE(dictionary_helper::RemoveWord( |
| 41 0, "foo" + base::Uint64ToString(i))); | 44 0, "foo" + base::Uint64ToString(i))); |
| 42 } | 45 } |
| 43 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 46 dt = TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 44 ASSERT_EQ(0UL, dictionary_helper::GetDictionarySize(1)); | 47 ASSERT_EQ(0UL, dictionary_helper::GetDictionarySize(1)); |
| 45 SyncTimingHelper::PrintResult("dictionary", "remove_words", dt); | 48 PrintResult("dictionary", "remove_words", dt); |
| 46 } | 49 } |
| OLD | NEW |