OLD | NEW |
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 "base/files/file_util.h" | 5 #include "base/files/file_util.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 base::MessageLoop loop; | 103 base::MessageLoop loop; |
104 }; | 104 }; |
105 | 105 |
106 // A fake completion object for verification. | 106 // A fake completion object for verification. |
107 class MockTextCheckingCompletion : public blink::WebTextCheckingCompletion { | 107 class MockTextCheckingCompletion : public blink::WebTextCheckingCompletion { |
108 public: | 108 public: |
109 MockTextCheckingCompletion() | 109 MockTextCheckingCompletion() |
110 : completion_count_(0) { | 110 : completion_count_(0) { |
111 } | 111 } |
112 | 112 |
113 virtual void didFinishCheckingText( | 113 void didFinishCheckingText( |
114 const blink::WebVector<blink::WebTextCheckingResult>& results) | 114 const blink::WebVector<blink::WebTextCheckingResult>& results) override { |
115 override { | |
116 completion_count_++; | 115 completion_count_++; |
117 last_results_ = results; | 116 last_results_ = results; |
118 } | 117 } |
119 | 118 |
120 virtual void didCancelCheckingText() override { | 119 void didCancelCheckingText() override { |
121 completion_count_++; | 120 completion_count_++; |
122 } | 121 } |
123 | 122 |
124 size_t completion_count_; | 123 size_t completion_count_; |
125 blink::WebVector<blink::WebTextCheckingResult> last_results_; | 124 blink::WebVector<blink::WebTextCheckingResult> last_results_; |
126 }; | 125 }; |
127 | 126 |
128 // Operates unit tests for the content::SpellCheck::SpellCheckWord() function | 127 // Operates unit tests for the content::SpellCheck::SpellCheckWord() function |
129 // with the US English dictionary. | 128 // with the US English dictionary. |
130 // The unit tests in this function consist of: | 129 // The unit tests in this function consist of: |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 strlen(kTestCases[i].misspelled), | 1365 strlen(kTestCases[i].misspelled), |
1367 0, | 1366 0, |
1368 &misspelling_start, | 1367 &misspelling_start, |
1369 &misspelling_length, | 1368 &misspelling_length, |
1370 &suggestions)); | 1369 &suggestions)); |
1371 EXPECT_GE(suggestions.size(), static_cast<size_t>(1)); | 1370 EXPECT_GE(suggestions.size(), static_cast<size_t>(1)); |
1372 if (suggestions.size() > 0) | 1371 if (suggestions.size() > 0) |
1373 EXPECT_EQ(suggestions[0], base::ASCIIToUTF16(kTestCases[i].suggestion)); | 1372 EXPECT_EQ(suggestions[0], base::ASCIIToUTF16(kTestCases[i].suggestion)); |
1374 } | 1373 } |
1375 } | 1374 } |
OLD | NEW |