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

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: Another trial... 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
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck_provider_mac_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..eeb0a4d64f52e49c317c95b66f5cc42e5ea2131a 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,7 +67,7 @@ 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].type, SpellCheckResult::SPELLING);
EXPECT_EQ(results[j].location, expected[j].location);
EXPECT_EQ(results[j].length, expected[j].length);
}
@@ -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);
}
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck_provider_mac_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698