1 // Copyright 2014 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.
5 #ifndef COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_
6 #define COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_
8 #include "base/basictypes.h"
9 #include "components/test_runner/mock_spell_check.h"
10 #include "components/test_runner/web_task.h"
11 #include "third_party/WebKit/public/web/WebSpellCheckClient.h"
13 namespace test_runner
{
15 class WebTestDelegate
;
16 class WebTestProxyBase
;
18 class SpellCheckClient
: public blink::WebSpellCheckClient
{
20 explicit SpellCheckClient(WebTestProxyBase
* web_test_proxy
);
21 virtual ~SpellCheckClient();
23 void SetDelegate(WebTestDelegate
* delegate
);
25 WebTaskList
* mutable_task_list() { return &task_list_
; }
26 MockSpellCheck
* MockSpellCheckWord() { return &spell_check_
; }
28 // blink::WebSpellCheckClient implementation.
29 virtual void spellCheck(
30 const blink::WebString
& text
,
33 blink::WebVector
<blink::WebString
>* optional_suggestions
);
34 virtual void checkTextOfParagraph(
35 const blink::WebString
& text
,
36 blink::WebTextCheckingTypeMask mask
,
37 blink::WebVector
<blink::WebTextCheckingResult
>* web_results
);
38 virtual void requestCheckingOfText(
39 const blink::WebString
& text
,
40 const blink::WebVector
<uint32_t>& markers
,
41 const blink::WebVector
<unsigned>& marker_offsets
,
42 blink::WebTextCheckingCompletion
* completion
);
43 virtual blink::WebString
autoCorrectWord(const blink::WebString
& word
);
46 void FinishLastTextCheck();
48 // The mock spellchecker used in spellCheck().
49 MockSpellCheck spell_check_
;
51 blink::WebString last_requested_text_check_string_
;
52 blink::WebTextCheckingCompletion
* last_requested_text_checking_completion_
;
54 WebTaskList task_list_
;
56 WebTestDelegate
* delegate_
;
58 WebTestProxyBase
* web_test_proxy_
;
60 DISALLOW_COPY_AND_ASSIGN(SpellCheckClient
);
63 } // namespace test_runner
65 #endif // COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_