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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" | 7 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" |
8 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 8 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
9 #include "chrome/browser/spellchecker/spellcheck_service.h" | 9 #include "chrome/browser/spellchecker/spellcheck_service.h" |
10 #include "chrome/common/spellcheck_common.h" | 10 #include "chrome/common/spellcheck_common.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 EXPECT_EQ(loaded_custom_words, expected); | 95 EXPECT_EQ(loaded_custom_words, expected); |
96 | 96 |
97 custom_dictionary->WriteWordToCustomDictionary("foo"); | 97 custom_dictionary->WriteWordToCustomDictionary("foo"); |
98 expected.push_back("foo"); | 98 expected.push_back("foo"); |
99 | 99 |
100 custom_dictionary->WriteWordToCustomDictionary("bar"); | 100 custom_dictionary->WriteWordToCustomDictionary("bar"); |
101 expected.push_back("bar"); | 101 expected.push_back("bar"); |
102 | 102 |
103 // The custom word list should include written words. | 103 // The custom word list should include written words. |
104 custom_dictionary->LoadDictionaryIntoCustomWordList(&loaded_custom_words); | 104 custom_dictionary->LoadDictionaryIntoCustomWordList(&loaded_custom_words); |
| 105 std::sort(expected.begin(), expected.end()); |
105 EXPECT_EQ(loaded_custom_words, expected); | 106 EXPECT_EQ(loaded_custom_words, expected); |
106 | 107 |
107 // Load in another instance of SpellCheckService. | 108 // Load in another instance of SpellCheckService. |
108 // The result should be the same. | 109 // The result should be the same. |
109 SpellcheckService spellcheck_service2(profile_.get()); | 110 SpellcheckService spellcheck_service2(profile_.get()); |
110 WordList loaded_custom_words2; | 111 WordList loaded_custom_words2; |
111 spellcheck_service2.GetCustomDictionary()-> | 112 spellcheck_service2.GetCustomDictionary()-> |
112 LoadDictionaryIntoCustomWordList(&loaded_custom_words2); | 113 LoadDictionaryIntoCustomWordList(&loaded_custom_words2); |
113 EXPECT_EQ(loaded_custom_words2, expected); | 114 EXPECT_EQ(loaded_custom_words2, expected); |
114 | 115 |
(...skipping 29 matching lines...) Expand all Loading... |
144 expected1.push_back("foo"); | 145 expected1.push_back("foo"); |
145 expected1.push_back("bar"); | 146 expected1.push_back("bar"); |
146 | 147 |
147 custom_dictionary2->WriteWordToCustomDictionary("hoge"); | 148 custom_dictionary2->WriteWordToCustomDictionary("hoge"); |
148 custom_dictionary2->WriteWordToCustomDictionary("fuga"); | 149 custom_dictionary2->WriteWordToCustomDictionary("fuga"); |
149 expected2.push_back("hoge"); | 150 expected2.push_back("hoge"); |
150 expected2.push_back("fuga"); | 151 expected2.push_back("fuga"); |
151 | 152 |
152 WordList actual1; | 153 WordList actual1; |
153 custom_dictionary->LoadDictionaryIntoCustomWordList(&actual1); | 154 custom_dictionary->LoadDictionaryIntoCustomWordList(&actual1); |
| 155 std::sort(expected1.begin(), expected1.end()); |
154 EXPECT_EQ(actual1, expected1); | 156 EXPECT_EQ(actual1, expected1); |
155 | 157 |
156 WordList actual2; | 158 WordList actual2; |
157 custom_dictionary2->LoadDictionaryIntoCustomWordList(&actual2); | 159 custom_dictionary2->LoadDictionaryIntoCustomWordList(&actual2); |
| 160 std::sort(expected2.begin(), expected2.end()); |
158 EXPECT_EQ(actual2, expected2); | 161 EXPECT_EQ(actual2, expected2); |
159 | 162 |
160 // Flush the loop now to prevent service init tasks from being run during | 163 // Flush the loop now to prevent service init tasks from being run during |
161 // TearDown(); | 164 // TearDown(); |
162 MessageLoop::current()->RunUntilIdle(); | 165 MessageLoop::current()->RunUntilIdle(); |
163 } | 166 } |
OLD | NEW |