OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 |
| 5 #include "base/strings/utf_string_conversions.h" |
4 #include "chrome/renderer/spellchecker/custom_dictionary_engine.h" | 6 #include "chrome/renderer/spellchecker/custom_dictionary_engine.h" |
5 | |
6 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
7 | 8 |
8 TEST(CustomDictionaryTest, HandlesEmptyWordWithInvalidSubstring) { | 9 TEST(CustomDictionaryTest, HandlesEmptyWordWithInvalidSubstring) { |
9 CustomDictionaryEngine engine; | 10 CustomDictionaryEngine engine; |
10 std::vector<std::string> custom_words; | 11 std::set<std::string> custom_words; |
11 | |
12 engine.Init(custom_words); | 12 engine.Init(custom_words); |
13 EXPECT_FALSE(engine.SpellCheckWord(string16().c_str(), 15, 23)); | 13 EXPECT_FALSE(engine.SpellCheckWord(string16().c_str(), 15, 23)); |
14 } | 14 } |
15 | 15 |
| 16 TEST(CustomDictionaryTest, Basic) { |
| 17 CustomDictionaryEngine engine; |
| 18 EXPECT_FALSE(engine.SpellCheckWord(ASCIIToUTF16("helllo").c_str(), 0, 6)); |
| 19 std::set<std::string> custom_words; |
| 20 custom_words.insert("helllo"); |
| 21 engine.Init(custom_words); |
| 22 EXPECT_TRUE(engine.SpellCheckWord(ASCIIToUTF16("helllo").c_str(), 0, 6)); |
| 23 } |
OLD | NEW |