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

Side by Side Diff: Source/testing/runner/MockGrammarCheck.cpp

Issue 49613006: Refactoring inline_spelling_markers.html to use async path for spellcheck (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 1 month 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } grammarErrors[] = { 58 } grammarErrors[] = {
59 {"I have a issue.", 7, 1}, 59 {"I have a issue.", 7, 1},
60 {"I have an grape.", 7, 2}, 60 {"I have an grape.", 7, 2},
61 {"I have an kiwi.", 7, 2}, 61 {"I have an kiwi.", 7, 2},
62 {"I have an muscat.", 7, 2}, 62 {"I have an muscat.", 7, 2},
63 {"You has the right.", 4, 3}, 63 {"You has the right.", 4, 3},
64 {"apple orange zz.", 0, 16}, 64 {"apple orange zz.", 0, 16},
65 {"apple zz orange.", 0, 16}, 65 {"apple zz orange.", 0, 16},
66 {"apple,zz,orange.", 0, 16}, 66 {"apple,zz,orange.", 0, 16},
67 {"orange,zz,apple.", 0, 16}, 67 {"orange,zz,apple.", 0, 16},
68 {"the the adlj adaasj sdklj. there there", 0, 38}, 68 {"the the adlj adaasj sdklj. there there", 4, 3},
groby-ooo-7-16 2013/10/29 17:19:05 I'm not sure why we need a second test case. Both
grzegorz 2013/10/30 15:47:47 I think we should report grammar error where it ex
69 {"the the adlj adaasj sdklj. there there", 32, 5},
69 {"zz apple orange.", 0, 16}, 70 {"zz apple orange.", 0, 16},
70 }; 71 };
71 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(grammarErrors); ++i) { 72 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(grammarErrors); ++i) {
72 size_t offset = 0; 73 size_t offset = 0;
73 string16 error(grammarErrors[i].text, grammarErrors[i].text + strlen(gra mmarErrors[i].text)); 74 string16 error(grammarErrors[i].text, grammarErrors[i].text + strlen(gra mmarErrors[i].text));
74 while ((offset = stringText.find(error, offset)) != string16::npos) { 75 while ((offset = stringText.find(error, offset)) != string16::npos) {
75 results->push_back(WebTextCheckingResult(WebTextDecorationTypeGramma r, offset + grammarErrors[i].location, grammarErrors[i].length)); 76 results->push_back(WebTextCheckingResult(WebTextDecorationTypeGramma r, offset + grammarErrors[i].location, grammarErrors[i].length));
76 offset += grammarErrors[i].length; 77 offset += grammarErrors[i].length;
77 } 78 }
78 } 79 }
79 return false; 80 return false;
80 } 81 }
81 82
82 } 83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698