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

Unified Diff: components/test_runner/spell_check_client.cc

Issue 2270293003: Add a switch to TestRunner to enable/disable mock spell checker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use in-class initialization Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/test_runner/spell_check_client.h ('k') | components/test_runner/test_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/spell_check_client.cc
diff --git a/components/test_runner/spell_check_client.cc b/components/test_runner/spell_check_client.cc
index 94ad604a01948630b226bcf95b09818695f16dcd..b7a929fd140bc47b0d7739f610c9efef28df9f51 100644
--- a/components/test_runner/spell_check_client.cc
+++ b/components/test_runner/spell_check_client.cc
@@ -33,12 +33,22 @@ void SpellCheckClient::SetDelegate(WebTestDelegate* delegate) {
delegate_ = delegate;
}
+void SpellCheckClient::SetEnabled(bool enabled) {
+ enabled_ = enabled;
+}
+
// blink::WebSpellCheckClient
void SpellCheckClient::spellCheck(
const blink::WebString& text,
int& misspelled_offset,
int& misspelled_length,
blink::WebVector<blink::WebString>* optional_suggestions) {
+ if (!enabled_) {
+ misspelled_offset = 0;
+ misspelled_length = 0;
+ return;
+ }
+
// Check the spelling of the given text.
spell_check_.SpellCheckWord(text, &misspelled_offset, &misspelled_length);
}
@@ -48,7 +58,7 @@ void SpellCheckClient::requestCheckingOfText(
const blink::WebVector<uint32_t>& markers,
const blink::WebVector<unsigned>& marker_offsets,
blink::WebTextCheckingCompletion* completion) {
- if (text.isEmpty()) {
+ if (!enabled_ || text.isEmpty()) {
if (completion)
completion->didCancelCheckingText();
return;
« no previous file with comments | « components/test_runner/spell_check_client.h ('k') | components/test_runner/test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698