| 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 | 8 |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 10 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 DISALLOW_COPY_AND_ASSIGN(DictionarySyncIntegrationTestHelper); | 34 DISALLOW_COPY_AND_ASSIGN(DictionarySyncIntegrationTestHelper); |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 | 37 |
| 38 namespace dictionary_helper { | 38 namespace dictionary_helper { |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 SpellcheckCustomDictionary* GetDictionary(int index) { | 41 SpellcheckCustomDictionary* GetDictionary(int index) { |
| 42 return SpellcheckServiceFactory::GetForProfile( | 42 return SpellcheckServiceFactory::GetForContext( |
| 43 sync_datatype_helper::test()->GetProfile(index))->GetCustomDictionary(); | 43 sync_datatype_helper::test()->GetProfile(index))->GetCustomDictionary(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 SpellcheckCustomDictionary* GetVerifierDictionary() { | 46 SpellcheckCustomDictionary* GetVerifierDictionary() { |
| 47 return SpellcheckServiceFactory::GetForProfile( | 47 return SpellcheckServiceFactory::GetForContext( |
| 48 sync_datatype_helper::test()->verifier())->GetCustomDictionary(); | 48 sync_datatype_helper::test()->verifier())->GetCustomDictionary(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void LoadDictionary(SpellcheckCustomDictionary* dictionary) { | 51 void LoadDictionary(SpellcheckCustomDictionary* dictionary) { |
| 52 if (dictionary->IsLoaded()) | 52 if (dictionary->IsLoaded()) |
| 53 return; | 53 return; |
| 54 base::RunLoop run_loop; | 54 base::RunLoop run_loop; |
| 55 DictionaryLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop)); | 55 DictionaryLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop)); |
| 56 dictionary->AddObserver(&observer); | 56 dictionary->AddObserver(&observer); |
| 57 dictionary->Load(); | 57 dictionary->Load(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 bool result = DictionarySyncIntegrationTestHelper::ApplyChange( | 121 bool result = DictionarySyncIntegrationTestHelper::ApplyChange( |
| 122 GetDictionary(index), dictionary_change); | 122 GetDictionary(index), dictionary_change); |
| 123 if (sync_datatype_helper::test()->use_verifier()) { | 123 if (sync_datatype_helper::test()->use_verifier()) { |
| 124 result &= DictionarySyncIntegrationTestHelper::ApplyChange( | 124 result &= DictionarySyncIntegrationTestHelper::ApplyChange( |
| 125 GetVerifierDictionary(), dictionary_change); | 125 GetVerifierDictionary(), dictionary_change); |
| 126 } | 126 } |
| 127 return result; | 127 return result; |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace dictionary_helper | 130 } // namespace dictionary_helper |
| OLD | NEW |