blob: d96afce4d3e2dd607a24dc7c80265972df18f346 [file] [log] [blame]
[email protected]b38c8f312014-08-01 23:21:371// 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.
4
jochen73e711c2015-06-03 10:01:465#ifndef COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_
6#define COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_
[email protected]b38c8f312014-08-01 23:21:377
8#include "base/basictypes.h"
jochen73e711c2015-06-03 10:01:469#include "components/test_runner/mock_spell_check.h"
10#include "components/test_runner/web_task.h"
[email protected]b38c8f312014-08-01 23:21:3711#include "third_party/WebKit/public/web/WebSpellCheckClient.h"
12
jochenf5f31752015-06-03 12:06:3413namespace test_runner {
[email protected]b38c8f312014-08-01 23:21:3714
15class WebTestDelegate;
16class WebTestProxyBase;
17
18class SpellCheckClient : public blink::WebSpellCheckClient {
19 public:
20 explicit SpellCheckClient(WebTestProxyBase* web_test_proxy);
21 virtual ~SpellCheckClient();
22
23 void SetDelegate(WebTestDelegate* delegate);
24
25 WebTaskList* mutable_task_list() { return &task_list_; }
26 MockSpellCheck* MockSpellCheckWord() { return &spell_check_; }
27
28 // blink::WebSpellCheckClient implementation.
29 virtual void spellCheck(
30 const blink::WebString& text,
31 int& offset,
32 int& length,
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);
44
45 private:
46 void FinishLastTextCheck();
47
48 // The mock spellchecker used in spellCheck().
49 MockSpellCheck spell_check_;
50
51 blink::WebString last_requested_text_check_string_;
52 blink::WebTextCheckingCompletion* last_requested_text_checking_completion_;
53
54 WebTaskList task_list_;
55
56 WebTestDelegate* delegate_;
57
58 WebTestProxyBase* web_test_proxy_;
59
60 DISALLOW_COPY_AND_ASSIGN(SpellCheckClient);
61};
62
jochenf5f31752015-06-03 12:06:3463} // namespace test_runner
[email protected]b38c8f312014-08-01 23:21:3764
jochen73e711c2015-06-03 10:01:4665#endif // COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_