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

Side by Side Diff: content/shell/renderer/test_runner/mock_grammar_check.cc

Issue 436133002: Migrate TestCommon to Chromium c++ style and remove un-used header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated for layout test Created 6 years, 4 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 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/TestCommon.h" 10 #include "content/shell/renderer/test_runner/test_common.h"
11 #include "third_party/WebKit/public/platform/WebCString.h" 11 #include "third_party/WebKit/public/platform/WebCString.h"
12 #include "third_party/WebKit/public/platform/WebString.h" 12 #include "third_party/WebKit/public/platform/WebString.h"
13 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" 13 #include "third_party/WebKit/public/web/WebTextCheckingResult.h"
14 14
15 namespace content { 15 namespace content {
16 16
17 bool MockGrammarCheck::CheckGrammarOfString( 17 bool MockGrammarCheck::CheckGrammarOfString(
18 const blink::WebString& text, 18 const blink::WebString& text,
19 std::vector<blink::WebTextCheckingResult>* results) { 19 std::vector<blink::WebTextCheckingResult>* results) {
20 DCHECK(results); 20 DCHECK(results);
21 base::string16 string_text = text; 21 base::string16 string_text = text;
22 if (std::find_if(string_text.begin(), string_text.end(), isASCIIAlpha) == 22 if (std::find_if(string_text.begin(), string_text.end(), IsASCIIAlpha) ==
23 string_text.end()) 23 string_text.end())
24 return true; 24 return true;
25 25
26 // Find matching grammatical errors from known ones. This function has to 26 // Find matching grammatical errors from known ones. This function has to
27 // check all errors because the given text may consist of two or more 27 // check all errors because the given text may consist of two or more
28 // sentences that have grammatical errors. 28 // sentences that have grammatical errors.
29 static const struct { 29 static const struct {
30 const char* text; 30 const char* text;
31 int location; 31 int location;
32 int length; 32 int length;
(...skipping 21 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/mock_color_chooser.h ('k') | content/shell/renderer/test_runner/mock_spell_check.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698