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

Unified Diff: chrome/renderer/spellchecker/spellcheck_unittest.cc

Issue 9368052: Removed WebTextCheckingResult legacy API use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a build break on Mac. Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/spellchecker/spellcheck_unittest.cc
diff --git a/chrome/renderer/spellchecker/spellcheck_unittest.cc b/chrome/renderer/spellchecker/spellcheck_unittest.cc
index ed06323ac903de31e7c733baee85bf5a88c735d5..e21c8ffc3d4364a15aebedf3828923a3d1dfd859 100644
--- a/chrome/renderer/spellchecker/spellcheck_unittest.cc
+++ b/chrome/renderer/spellchecker/spellcheck_unittest.cc
@@ -13,8 +13,9 @@
#include "chrome/renderer/spellchecker/spellcheck.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/spellcheck_common.h"
+#include "chrome/common/spellcheck_result.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult.h"
+
namespace {
@@ -57,8 +58,8 @@ class SpellCheckTest : public testing::Test {
protected:
void TestSpellCheckParagraph(
const string16& input,
- const std::vector<WebKit::WebTextCheckingResult>& expected) {
- std::vector<WebKit::WebTextCheckingResult> results;
+ const std::vector<SpellCheckResult>& expected) {
+ std::vector<SpellCheckResult> results;
spell_check()->SpellCheckParagraph(input,
0,
&results);
@@ -66,9 +67,9 @@ class SpellCheckTest : public testing::Test {
EXPECT_EQ(results.size(), expected.size());
size_t size = std::min(results.size(), expected.size());
for (size_t j = 0; j < size; ++j) {
- EXPECT_EQ(results[j].type, WebKit::WebTextCheckingTypeSpelling);
- EXPECT_EQ(results[j].location, expected[j].location);
- EXPECT_EQ(results[j].length, expected[j].length);
+ EXPECT_EQ(results[j].type(), SpellCheckResult::Spelling);
+ EXPECT_EQ(results[j].location(), expected[j].location());
+ EXPECT_EQ(results[j].length(), expected[j].length());
}
}
#endif
@@ -733,23 +734,23 @@ TEST_F(SpellCheckTest, GetAutoCorrectionWord_EN_US) {
// Make sure SpellCheckParagraph does not crash if the input is empty.
TEST_F(SpellCheckTest, SpellCheckParagraphEmptyParagraph) {
- std::vector<WebKit::WebTextCheckingResult> expected;
+ std::vector<SpellCheckResult> expected;
TestSpellCheckParagraph(UTF8ToUTF16(""), expected);
}
// A simple test case having no misspellings.
TEST_F(SpellCheckTest, SpellCheckParagraphNoMisspellings) {
const string16 text = UTF8ToUTF16("apple");
- std::vector<WebKit::WebTextCheckingResult> expected;
+ std::vector<SpellCheckResult> expected;
TestSpellCheckParagraph(text, expected);
}
// A simple test case having one misspelling.
TEST_F(SpellCheckTest, SpellCheckParagraphSingleMisspellings) {
const string16 text = UTF8ToUTF16("zz");
- std::vector<WebKit::WebTextCheckingResult> expected;
- expected.push_back(WebKit::WebTextCheckingResult(
- WebKit::WebTextCheckingTypeSpelling, 0, 2));
+ std::vector<SpellCheckResult> expected;
+ expected.push_back(SpellCheckResult(
+ SpellCheckResult::Spelling, 0, 2));
TestSpellCheckParagraph(text, expected);
}
@@ -757,18 +758,18 @@ TEST_F(SpellCheckTest, SpellCheckParagraphSingleMisspellings) {
// A simple test case having multiple misspellings.
TEST_F(SpellCheckTest, SpellCheckParagraphMultipleMisspellings) {
const string16 text = UTF8ToUTF16("zz, zz");
- std::vector<WebKit::WebTextCheckingResult> expected;
- expected.push_back(WebKit::WebTextCheckingResult(
- WebKit::WebTextCheckingTypeSpelling, 0, 2));
- expected.push_back(WebKit::WebTextCheckingResult(
- WebKit::WebTextCheckingTypeSpelling, 4, 2));
+ std::vector<SpellCheckResult> expected;
+ expected.push_back(SpellCheckResult(
+ SpellCheckResult::Spelling, 0, 2));
+ expected.push_back(SpellCheckResult(
+ SpellCheckResult::Spelling, 4, 2));
TestSpellCheckParagraph(text, expected);
}
// Make sure a relatively long (correct) sentence can be spellchecked.
TEST_F(SpellCheckTest, SpellCheckParagraphLongSentence) {
- std::vector<WebKit::WebTextCheckingResult> expected;
+ std::vector<SpellCheckResult> expected;
// The text is taken from US constitution preamble.
const string16 text = UTF8ToUTF16(
"We the people of the United States, in order to form a more perfect "
@@ -782,7 +783,7 @@ TEST_F(SpellCheckTest, SpellCheckParagraphLongSentence) {
// Make sure all misspellings can be found in a relatively long sentence.
TEST_F(SpellCheckTest, SpellCheckParagraphLongSentenceMultipleMisspellings) {
- std::vector<WebKit::WebTextCheckingResult> expected;
+ std::vector<SpellCheckResult> expected;
// All 'the' are converted to 'hte' in US consitition preamble.
const string16 text = UTF8ToUTF16(
@@ -792,18 +793,18 @@ TEST_F(SpellCheckTest, SpellCheckParagraphLongSentenceMultipleMisspellings) {
"blessings of liberty to ourselves and our posterity, do ordain and "
"establish this Constitution for hte United States of America.");
- expected.push_back(WebKit::WebTextCheckingResult(
- WebKit::WebTextCheckingTypeSpelling, 3, 3));
- expected.push_back(WebKit::WebTextCheckingResult(
- WebKit::WebTextCheckingTypeSpelling, 17, 3));
- expected.push_back(WebKit::WebTextCheckingResult(
- WebKit::WebTextCheckingTypeSpelling, 135, 3));
- expected.push_back(WebKit::WebTextCheckingResult(
- WebKit::WebTextCheckingTypeSpelling, 163, 3));
- expected.push_back(WebKit::WebTextCheckingResult(
- WebKit::WebTextCheckingTypeSpelling, 195, 3));
- expected.push_back(WebKit::WebTextCheckingResult(
- WebKit::WebTextCheckingTypeSpelling, 298, 3));
+ expected.push_back(SpellCheckResult(
+ SpellCheckResult::Spelling, 3, 3));
+ expected.push_back(SpellCheckResult(
+ SpellCheckResult::Spelling, 17, 3));
+ expected.push_back(SpellCheckResult(
+ SpellCheckResult::Spelling, 135, 3));
+ expected.push_back(SpellCheckResult(
+ SpellCheckResult::Spelling, 163, 3));
+ expected.push_back(SpellCheckResult(
+ SpellCheckResult::Spelling, 195, 3));
+ expected.push_back(SpellCheckResult(
+ SpellCheckResult::Spelling, 298, 3));
TestSpellCheckParagraph(text, expected);
}

Powered by Google App Engine
This is Rietveld 408576698