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 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_SPELLCHECKCLIENT_H_ 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_SPELLCHECKCLIENT_H_ 7 8 #include "base/basictypes.h" 9 #include "content/shell/renderer/test_runner/MockSpellCheck.h" 10 #include "content/shell/renderer/test_runner/WebTask.h" 11 #include "third_party/WebKit/public/web/WebSpellCheckClient.h" 12 13 namespace content { 14 15 class WebTestDelegate; 16 class WebTestProxyBase; 17 18 class SpellCheckClient : public blink::WebSpellCheckClient { 19 public: 20 explicit SpellCheckClient(WebTestProxyBase*); 21 virtual ~SpellCheckClient(); 22 23 void setDelegate(WebTestDelegate*); 24 mutable_task_list()25 WebTaskList* mutable_task_list() { return &m_taskList; } mockSpellCheck()26 MockSpellCheck* mockSpellCheck() { return &m_spellcheck; } 27 28 // blink::WebSpellCheckClient implementation. 29 virtual void spellCheck(const blink::WebString&, int& offset, int& length, blink::WebVector<blink::WebString>* optionalSuggestions); 30 virtual void checkTextOfParagraph(const blink::WebString&, blink::WebTextCheckingTypeMask, blink::WebVector<blink::WebTextCheckingResult>*); 31 virtual void requestCheckingOfText(const blink::WebString&, 32 const blink::WebVector<uint32_t>&, 33 const blink::WebVector<unsigned>&, 34 blink::WebTextCheckingCompletion*); 35 virtual blink::WebString autoCorrectWord(const blink::WebString&); 36 37 private: 38 void finishLastTextCheck(); 39 40 // The mock spellchecker used in spellCheck(). 41 MockSpellCheck m_spellcheck; 42 43 blink::WebString m_lastRequestedTextCheckString; 44 blink::WebTextCheckingCompletion* m_lastRequestedTextCheckingCompletion; 45 46 WebTaskList m_taskList; 47 48 WebTestDelegate* m_delegate; 49 50 WebTestProxyBase* m_webTestProxy; 51 52 DISALLOW_COPY_AND_ASSIGN(SpellCheckClient); 53 }; 54 55 } // namespace content 56 57 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_SPELLCHECKCLIENT_H_ 58