| 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 "webkit/glue/webkit_glue.h" | 5 #include "webkit/glue/webkit_glue.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 | 1057 |
| 1058 TEST_F(SpellCheckTest, CreateTextCheckingResults) { | 1058 TEST_F(SpellCheckTest, CreateTextCheckingResults) { |
| 1059 // Verify that the SpellCheck class keeps the spelling marker added to a | 1059 // Verify that the SpellCheck class keeps the spelling marker added to a |
| 1060 // misspelled word "zz". | 1060 // misspelled word "zz". |
| 1061 { | 1061 { |
| 1062 string16 text = ASCIIToUTF16("zz"); | 1062 string16 text = ASCIIToUTF16("zz"); |
| 1063 std::vector<SpellCheckResult> spellcheck_results; | 1063 std::vector<SpellCheckResult> spellcheck_results; |
| 1064 spellcheck_results.push_back(SpellCheckResult( | 1064 spellcheck_results.push_back(SpellCheckResult( |
| 1065 SpellCheckResult::SPELLING, 0, 2, string16())); | 1065 SpellCheckResult::SPELLING, 0, 2, string16())); |
| 1066 WebKit::WebVector<WebKit::WebTextCheckingResult> textcheck_results; | 1066 WebKit::WebVector<WebKit::WebTextCheckingResult> textcheck_results; |
| 1067 spell_check()->CreateTextCheckingResults( | 1067 spell_check()->CreateTextCheckingResults(SpellCheck::USE_NATIVE_CHECKER, |
| 1068 0, text, spellcheck_results, &textcheck_results); | 1068 0, |
| 1069 text, |
| 1070 spellcheck_results, |
| 1071 &textcheck_results); |
| 1069 EXPECT_EQ(spellcheck_results.size(), textcheck_results.size()); | 1072 EXPECT_EQ(spellcheck_results.size(), textcheck_results.size()); |
| 1070 EXPECT_EQ(WebKit::WebTextCheckingTypeSpelling, textcheck_results[0].type); | 1073 EXPECT_EQ(WebKit::WebTextCheckingTypeSpelling, textcheck_results[0].type); |
| 1071 EXPECT_EQ(spellcheck_results[0].location, textcheck_results[0].location); | 1074 EXPECT_EQ(spellcheck_results[0].location, textcheck_results[0].location); |
| 1072 EXPECT_EQ(spellcheck_results[0].length, textcheck_results[0].length); | 1075 EXPECT_EQ(spellcheck_results[0].length, textcheck_results[0].length); |
| 1073 } | 1076 } |
| 1074 | 1077 |
| 1075 // Verify that the SpellCheck class replaces the spelling marker added to a | 1078 // Verify that the SpellCheck class replaces the spelling marker added to a |
| 1076 // contextually-misspelled word "bean" with a grammar marker. | 1079 // contextually-misspelled word "bean" with a grammar marker. |
| 1077 { | 1080 { |
| 1078 string16 text = ASCIIToUTF16("I have bean to USA."); | 1081 string16 text = ASCIIToUTF16("I have bean to USA."); |
| 1079 std::vector<SpellCheckResult> spellcheck_results; | 1082 std::vector<SpellCheckResult> spellcheck_results; |
| 1080 spellcheck_results.push_back(SpellCheckResult( | 1083 spellcheck_results.push_back(SpellCheckResult( |
| 1081 SpellCheckResult::SPELLING, 7, 4, string16())); | 1084 SpellCheckResult::SPELLING, 7, 4, string16())); |
| 1082 WebKit::WebVector<WebKit::WebTextCheckingResult> textcheck_results; | 1085 WebKit::WebVector<WebKit::WebTextCheckingResult> textcheck_results; |
| 1083 spell_check()->CreateTextCheckingResults( | 1086 spell_check()->CreateTextCheckingResults(SpellCheck::USE_NATIVE_CHECKER, |
| 1084 0, text, spellcheck_results, &textcheck_results); | 1087 0, |
| 1088 text, |
| 1089 spellcheck_results, |
| 1090 &textcheck_results); |
| 1085 EXPECT_EQ(spellcheck_results.size(), textcheck_results.size()); | 1091 EXPECT_EQ(spellcheck_results.size(), textcheck_results.size()); |
| 1086 EXPECT_EQ(WebKit::WebTextCheckingTypeGrammar, textcheck_results[0].type); | 1092 EXPECT_EQ(WebKit::WebTextCheckingTypeGrammar, textcheck_results[0].type); |
| 1087 EXPECT_EQ(spellcheck_results[0].location, textcheck_results[0].location); | 1093 EXPECT_EQ(spellcheck_results[0].location, textcheck_results[0].location); |
| 1088 EXPECT_EQ(spellcheck_results[0].length, textcheck_results[0].length); | 1094 EXPECT_EQ(spellcheck_results[0].length, textcheck_results[0].length); |
| 1089 } | 1095 } |
| 1090 } | 1096 } |
| 1091 | 1097 |
| 1092 // Checks some words that should be present in all English dictionaries. | 1098 // Checks some words that should be present in all English dictionaries. |
| 1093 TEST_F(SpellCheckTest, EnglishWords) { | 1099 TEST_F(SpellCheckTest, EnglishWords) { |
| 1094 static const struct { | 1100 static const struct { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 &misspelling_start, | 1141 &misspelling_start, |
| 1136 &misspelling_length, NULL); | 1142 &misspelling_length, NULL); |
| 1137 | 1143 |
| 1138 EXPECT_EQ(kTestCases[i].should_pass, result) << kTestCases[i].input << | 1144 EXPECT_EQ(kTestCases[i].should_pass, result) << kTestCases[i].input << |
| 1139 " in " << kLocales[j]; | 1145 " in " << kLocales[j]; |
| 1140 } | 1146 } |
| 1141 } | 1147 } |
| 1142 } | 1148 } |
| 1143 | 1149 |
| 1144 #endif | 1150 #endif |
| OLD | NEW |