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

Unified Diff: Source/WebKit/chromium/tests/WebFrameTest.cpp

Issue 16190007: Avoid underlining misspellings when typing inside a word (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Clear the queue, too Created 7 years, 7 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 | « no previous file | Source/core/editing/SpellChecker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/tests/WebFrameTest.cpp
diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp
index f050dc98826cf3b8a37f2ea692cdc55525c22437..2de7e7a9ee7f73ac6660905c8e79fe129d970832 100644
--- a/Source/WebKit/chromium/tests/WebFrameTest.cpp
+++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp
@@ -3091,6 +3091,68 @@ TEST_F(WebFrameTest, MarkerHashIdentifiers) {
m_webView = 0;
}
+class StubbornSpellCheckClient : public WebSpellCheckClient {
+public:
+ StubbornSpellCheckClient() : m_completion(0) { }
+ virtual ~StubbornSpellCheckClient() { }
+
+ virtual void requestCheckingOfText(
+ const WebKit::WebString&,
+ const WebKit::WebVector<uint32_t>&,
+ const WebKit::WebVector<unsigned>&,
+ WebKit::WebTextCheckingCompletion* completion) OVERRIDE
+ {
+ m_completion = completion;
+ }
+
+ void kick()
+ {
+ if (!m_completion)
+ return;
+ Vector<WebTextCheckingResult> results;
+ const int misspellingStartOffset = 1;
+ const int misspellingLength = 8;
+ results.append(WebTextCheckingResult(WebTextCheckingTypeSpelling, misspellingStartOffset, misspellingLength));
+ m_completion->didFinishCheckingText(results);
+ m_completion = 0;
+ }
+
+private:
+ WebKit::WebTextCheckingCompletion* m_completion;
+};
+
+TEST_F(WebFrameTest, SlowSpellcheckMarkerPosition)
+{
+ registerMockedHttpURLLoad("spell.html");
+ m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html");
+
+ StubbornSpellCheckClient spellcheck;
+ m_webView->setSpellCheckClient(&spellcheck);
+
+ WebFrameImpl* frame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
+ WebInputElement webInputElement = frame->document().getElementById("data").to<WebInputElement>();
+ Document* document = frame->frame()->document();
+ Element* element = document->getElementById("data");
+
+ m_webView->settings()->setAsynchronousSpellCheckingEnabled(true);
+ m_webView->settings()->setUnifiedTextCheckerEnabled(true);
+ m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin);
+
+ element->focus();
+ document->execCommand("InsertText", false, "wellcome ");
+ webInputElement.setSelectionRange(0, 0);
+ document->execCommand("InsertText", false, "he");
+
+ spellcheck.kick();
+
+ WebVector<uint32_t> documentMarkers;
+ m_webView->spellingMarkers(&documentMarkers);
+ EXPECT_EQ(0U, documentMarkers.size());
+
+ m_webView->close();
+ m_webView = 0;
+}
+
class TestAccessInitialDocumentWebFrameClient : public WebFrameClient {
public:
TestAccessInitialDocumentWebFrameClient() : m_didAccessInitialDocument(false)
« no previous file with comments | « no previous file | Source/core/editing/SpellChecker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698