OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/renderer/test_runner/mock_grammar_check.h" | 5 #include "content/shell/renderer/test_runner/mock_grammar_check.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/shell/renderer/test_runner/test_common.h" | 10 #include "content/shell/renderer/test_runner/test_common.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 {"I have an muscat.", 7, 2}, | 37 {"I have an muscat.", 7, 2}, |
38 {"You has the right.", 4, 3}, | 38 {"You has the right.", 4, 3}, |
39 {"apple orange zz.", 0, 16}, | 39 {"apple orange zz.", 0, 16}, |
40 {"apple zz orange.", 0, 16}, | 40 {"apple zz orange.", 0, 16}, |
41 {"apple,zz,orange.", 0, 16}, | 41 {"apple,zz,orange.", 0, 16}, |
42 {"orange,zz,apple.", 0, 16}, | 42 {"orange,zz,apple.", 0, 16}, |
43 {"the the adlj adaasj sdklj. there there", 4, 3}, | 43 {"the the adlj adaasj sdklj. there there", 4, 3}, |
44 {"the the adlj adaasj sdklj. there there", 33, 5}, | 44 {"the the adlj adaasj sdklj. there there", 33, 5}, |
45 {"zz apple orange.", 0, 16}, | 45 {"zz apple orange.", 0, 16}, |
46 }; | 46 }; |
47 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kGrammarErrors); ++i) { | 47 for (size_t i = 0; i < arraysize(kGrammarErrors); ++i) { |
48 size_t offset = 0; | 48 size_t offset = 0; |
49 base::string16 error( | 49 base::string16 error( |
50 kGrammarErrors[i].text, | 50 kGrammarErrors[i].text, |
51 kGrammarErrors[i].text + strlen(kGrammarErrors[i].text)); | 51 kGrammarErrors[i].text + strlen(kGrammarErrors[i].text)); |
52 while ((offset = string_text.find(error, offset)) != base::string16::npos) { | 52 while ((offset = string_text.find(error, offset)) != base::string16::npos) { |
53 results->push_back( | 53 results->push_back( |
54 blink::WebTextCheckingResult(blink::WebTextDecorationTypeGrammar, | 54 blink::WebTextCheckingResult(blink::WebTextDecorationTypeGrammar, |
55 offset + kGrammarErrors[i].location, | 55 offset + kGrammarErrors[i].location, |
56 kGrammarErrors[i].length)); | 56 kGrammarErrors[i].length)); |
57 offset += kGrammarErrors[i].length; | 57 offset += kGrammarErrors[i].length; |
58 } | 58 } |
59 } | 59 } |
60 return false; | 60 return false; |
61 } | 61 } |
62 | 62 |
63 } // namespace content | 63 } // namespace content |
OLD | NEW |