Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: chrome/browser/spellcheck_unittest.cc

Issue 269020: Spellchecker:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: tony comments Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/spellchecker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 0, 285 0,
286 &misspelling_start, 286 &misspelling_start,
287 &misspelling_length, NULL); 287 &misspelling_length, NULL);
288 288
289 EXPECT_EQ(kTestCases[i].expected_result, result); 289 EXPECT_EQ(kTestCases[i].expected_result, result);
290 EXPECT_EQ(kTestCases[i].misspelling_start, misspelling_start); 290 EXPECT_EQ(kTestCases[i].misspelling_start, misspelling_start);
291 EXPECT_EQ(kTestCases[i].misspelling_length, misspelling_length); 291 EXPECT_EQ(kTestCases[i].misspelling_length, misspelling_length);
292 } 292 }
293 } 293 }
294 294
295
296 TEST_F(SpellCheckTest, SpellCheckSuggestions_EN_US) { 295 TEST_F(SpellCheckTest, SpellCheckSuggestions_EN_US) {
297 static const struct { 296 static const struct {
298 // A string to be tested. 297 // A string to be tested.
299 const wchar_t* input; 298 const wchar_t* input;
300 // An expected result for this test case. 299 // An expected result for this test case.
301 // * true: the input string does not have any invalid words. 300 // * true: the input string does not have any invalid words.
302 // * false: the input string has one or more invalid words. 301 // * false: the input string has one or more invalid words.
303 bool expected_result; 302 bool expected_result;
304 // The position and the length of the first invalid word. 303 // The position and the length of the first invalid word.
305 int misspelling_start; 304 int misspelling_start;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 {L"ello", false, 0, 0, L"hello"}, 600 {L"ello", false, 0, 0, L"hello"},
602 {L"ello", false, 0, 0, L"cello"}, 601 {L"ello", false, 0, 0, L"cello"},
603 {L"wate", false, 0, 0, L"water"}, 602 {L"wate", false, 0, 0, L"water"},
604 {L"wate", false, 0, 0, L"waste"}, 603 {L"wate", false, 0, 0, L"waste"},
605 {L"wate", false, 0, 0, L"sate"}, 604 {L"wate", false, 0, 0, L"sate"},
606 {L"wate", false, 0, 0, L"ate"}, 605 {L"wate", false, 0, 0, L"ate"},
607 {L"jum", false, 0, 0, L"jump"}, 606 {L"jum", false, 0, 0, L"jump"},
608 {L"jum", false, 0, 0, L"hum"}, 607 {L"jum", false, 0, 0, L"hum"},
609 {L"jum", false, 0, 0, L"sum"}, 608 {L"jum", false, 0, 0, L"sum"},
610 {L"jum", false, 0, 0, L"um"}, 609 {L"jum", false, 0, 0, L"um"},
611 #endif //!OS_MACOSX 610 #endif // !OS_MACOSX
612 // TODO (Sidchat): add many more examples. 611 // TODO (Sidchat): add many more examples.
613 }; 612 };
614 613
615 FilePath hunspell_directory = GetHunspellDirectory(); 614 FilePath hunspell_directory = GetHunspellDirectory();
616 ASSERT_FALSE(hunspell_directory.empty()); 615 ASSERT_FALSE(hunspell_directory.empty());
617 616
618 scoped_refptr<SpellChecker> spell_checker(new SpellChecker( 617 scoped_refptr<SpellChecker> spell_checker(new SpellChecker(
619 hunspell_directory, "en-US", NULL, FilePath())); 618 hunspell_directory, "en-US", NULL, FilePath()));
620 619
621 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { 620 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 doc_tag, 1158 doc_tag,
1160 &misspelling_start, 1159 &misspelling_start,
1161 &misspelling_length, 1160 &misspelling_length,
1162 &suggestions); 1161 &suggestions);
1163 1162
1164 // The word should now show be spelled wrong again 1163 // The word should now show be spelled wrong again
1165 EXPECT_EQ(kTestCases[i].input_result, result); 1164 EXPECT_EQ(kTestCases[i].input_result, result);
1166 } 1165 }
1167 } // Test IgnoreWords_EN_US 1166 } // Test IgnoreWords_EN_US
1168 #endif // OS_MACOSX 1167 #endif // OS_MACOSX
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/spellchecker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698