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

Side by Side Diff: components/spellcheck/renderer/spellcheck_unittest.cc

Issue 2651503003: Use explicit WebString conversions in spellcheck (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
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 "components/spellcheck/renderer/spellcheck.h" 5 #include "components/spellcheck/renderer/spellcheck.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 L"haven" TYPOGRAPHICAL_APOSTROPHE L"t", 1230 L"haven" TYPOGRAPHICAL_APOSTROPHE L"t",
1231 L"in'n" TYPOGRAPHICAL_APOSTROPHE L"out's", 1231 L"in'n" TYPOGRAPHICAL_APOSTROPHE L"out's",
1232 L"I've", 1232 L"I've",
1233 L"haven" TYPOGRAPHICAL_APOSTROPHE L"t", 1233 L"haven" TYPOGRAPHICAL_APOSTROPHE L"t",
1234 L"in'n" TYPOGRAPHICAL_APOSTROPHE L"out" TYPOGRAPHICAL_APOSTROPHE L"s", 1234 L"in'n" TYPOGRAPHICAL_APOSTROPHE L"out" TYPOGRAPHICAL_APOSTROPHE L"s",
1235 }; 1235 };
1236 1236
1237 ASSERT_EQ(arraysize(kExpectedReplacements), textcheck_results.size()); 1237 ASSERT_EQ(arraysize(kExpectedReplacements), textcheck_results.size());
1238 for (size_t i = 0; i < arraysize(kExpectedReplacements); ++i) { 1238 for (size_t i = 0; i < arraysize(kExpectedReplacements); ++i) {
1239 EXPECT_EQ(base::WideToUTF16(kExpectedReplacements[i]), 1239 EXPECT_EQ(base::WideToUTF16(kExpectedReplacements[i]),
1240 textcheck_results[i].replacement) 1240 textcheck_results[i].replacement.utf16())
1241 << "i=" << i << "\nactual: \"" 1241 << "i=" << i << "\nactual: \""
1242 << base::string16(textcheck_results[i].replacement) << "\""; 1242 << textcheck_results[i].replacement.utf16() << "\"";
1243 } 1243 }
1244 } 1244 }
1245 1245
1246 // Checks some words that should be present in all English dictionaries. 1246 // Checks some words that should be present in all English dictionaries.
1247 TEST_F(SpellCheckTest, EnglishWords) { 1247 TEST_F(SpellCheckTest, EnglishWords) {
1248 static const struct { 1248 static const struct {
1249 const char* input; 1249 const char* input;
1250 bool should_pass; 1250 bool should_pass;
1251 } kTestCases[] = { 1251 } kTestCases[] = {
1252 // Issue 146093: "Chromebook" and "Chromebox" not included in spell-checking 1252 // Issue 146093: "Chromebook" and "Chromebox" not included in spell-checking
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 // to be updated accordingly. 1570 // to be updated accordingly.
1571 ASSERT_EQ(5, spellcheck::kMaxSuggestions); 1571 ASSERT_EQ(5, spellcheck::kMaxSuggestions);
1572 FillSuggestions(suggestions_list, &suggestion_results); 1572 FillSuggestions(suggestions_list, &suggestion_results);
1573 ASSERT_EQ(5U, suggestion_results.size()); 1573 ASSERT_EQ(5U, suggestion_results.size());
1574 EXPECT_EQ(base::ASCIIToUTF16("0foo"), suggestion_results[0]); 1574 EXPECT_EQ(base::ASCIIToUTF16("0foo"), suggestion_results[0]);
1575 EXPECT_EQ(base::ASCIIToUTF16("1foo"), suggestion_results[1]); 1575 EXPECT_EQ(base::ASCIIToUTF16("1foo"), suggestion_results[1]);
1576 EXPECT_EQ(base::ASCIIToUTF16("2foo"), suggestion_results[2]); 1576 EXPECT_EQ(base::ASCIIToUTF16("2foo"), suggestion_results[2]);
1577 EXPECT_EQ(base::ASCIIToUTF16("0bar"), suggestion_results[3]); 1577 EXPECT_EQ(base::ASCIIToUTF16("0bar"), suggestion_results[3]);
1578 EXPECT_EQ(base::ASCIIToUTF16("1bar"), suggestion_results[4]); 1578 EXPECT_EQ(base::ASCIIToUTF16("1bar"), suggestion_results[4]);
1579 } 1579 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698