| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "base/format_macros.h" | 5 #include "base/format_macros.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "base/stringprintf.h" |
| 7 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "webkit/tools/test_shell/mock_spellcheck.h" | 10 #include "webkit/tools/test_shell/mock_spellcheck.h" |
| 10 | 11 |
| 11 class MockSpellCheckTest : public testing::Test { | 12 class MockSpellCheckTest : public testing::Test { |
| 12 public: | 13 public: |
| 13 MockSpellCheckTest() { | 14 MockSpellCheckTest() { |
| 14 } | 15 } |
| 15 | 16 |
| 16 ~MockSpellCheckTest() { | 17 ~MockSpellCheckTest() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 {L" " L"ifmmp", false, 1, 5}, | 57 {L" " L"ifmmp", false, 1, 5}, |
| 57 {L"ifmmp" L" ", false, 0, 5}, | 58 {L"ifmmp" L" ", false, 0, 5}, |
| 58 {L"ifmmp" L" " L"ifmmp", false, 0, 5}, | 59 {L"ifmmp" L" " L"ifmmp", false, 0, 5}, |
| 59 | 60 |
| 60 {L"qwertyuiopasd", false, 0, 13}, | 61 {L"qwertyuiopasd", false, 0, 13}, |
| 61 {L"qwertyuiopasdf", false, 0, 14}, | 62 {L"qwertyuiopasdf", false, 0, 14}, |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 MockSpellCheck spellchecker; | 65 MockSpellCheck spellchecker; |
| 65 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { | 66 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { |
| 66 SCOPED_TRACE(StringPrintf("kTestCases[%" PRIuS "]", i)); | 67 SCOPED_TRACE(base::StringPrintf("kTestCases[%" PRIuS "]", i)); |
| 67 | 68 |
| 68 std::wstring input(kTestCases[i].input); | 69 std::wstring input(kTestCases[i].input); |
| 69 int misspelling_start; | 70 int misspelling_start; |
| 70 int misspelling_length; | 71 int misspelling_length; |
| 71 bool result = spellchecker.SpellCheckWord(WideToUTF16(input), | 72 bool result = spellchecker.SpellCheckWord(WideToUTF16(input), |
| 72 &misspelling_start, | 73 &misspelling_start, |
| 73 &misspelling_length); | 74 &misspelling_length); |
| 74 | 75 |
| 75 EXPECT_EQ(kTestCases[i].expected_result, result); | 76 EXPECT_EQ(kTestCases[i].expected_result, result); |
| 76 EXPECT_EQ(kTestCases[i].misspelling_start, misspelling_start); | 77 EXPECT_EQ(kTestCases[i].misspelling_start, misspelling_start); |
| 77 EXPECT_EQ(kTestCases[i].misspelling_length, misspelling_length); | 78 EXPECT_EQ(kTestCases[i].misspelling_length, misspelling_length); |
| 78 } | 79 } |
| 79 } | 80 } |
| OLD | NEW |