| 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 "chrome/browser/sync/test/integration/dictionary_helper.h" | 5 #include "chrome/browser/sync/test/integration/dictionary_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 SpellcheckCustomDictionary* GetVerifierDictionary() { | 50 SpellcheckCustomDictionary* GetVerifierDictionary() { |
| 51 return SpellcheckServiceFactory::GetForContext( | 51 return SpellcheckServiceFactory::GetForContext( |
| 52 sync_datatype_helper::test()->verifier())->GetCustomDictionary(); | 52 sync_datatype_helper::test()->verifier())->GetCustomDictionary(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void LoadDictionary(SpellcheckCustomDictionary* dictionary) { | 55 void LoadDictionary(SpellcheckCustomDictionary* dictionary) { |
| 56 if (dictionary->IsLoaded()) | 56 if (dictionary->IsLoaded()) |
| 57 return; | 57 return; |
| 58 base::RunLoop run_loop; | 58 base::RunLoop run_loop; |
| 59 DictionaryLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop)); | 59 DictionaryLoadObserver observer( |
| 60 content::GetDeferredQuitTaskForRunLoop(&run_loop)); |
| 60 dictionary->AddObserver(&observer); | 61 dictionary->AddObserver(&observer); |
| 61 dictionary->Load(); | 62 dictionary->Load(); |
| 62 content::RunThisRunLoop(&run_loop); | 63 content::RunThisRunLoop(&run_loop); |
| 63 dictionary->RemoveObserver(&observer); | 64 dictionary->RemoveObserver(&observer); |
| 64 ASSERT_TRUE(dictionary->IsLoaded()); | 65 ASSERT_TRUE(dictionary->IsLoaded()); |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace | 68 } // namespace |
| 68 | 69 |
| 69 | 70 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 160 |
| 160 bool NumDictionaryEntriesChecker::IsExitConditionSatisfied() { | 161 bool NumDictionaryEntriesChecker::IsExitConditionSatisfied() { |
| 161 return dictionary_helper::GetDictionarySize(index_) == num_words_; | 162 return dictionary_helper::GetDictionarySize(index_) == num_words_; |
| 162 } | 163 } |
| 163 | 164 |
| 164 std::string NumDictionaryEntriesChecker::GetDebugMessage() const { | 165 std::string NumDictionaryEntriesChecker::GetDebugMessage() const { |
| 165 return base::StringPrintf( | 166 return base::StringPrintf( |
| 166 "Waiting for client %d: %" PRIuS " / %" PRIuS " words downloaded", index_, | 167 "Waiting for client %d: %" PRIuS " / %" PRIuS " words downloaded", index_, |
| 167 dictionary_helper::GetDictionarySize(index_), num_words_); | 168 dictionary_helper::GetDictionarySize(index_), num_words_); |
| 168 } | 169 } |
| OLD | NEW |