blob: 40af2d26df8f103635f067e6724b5b3f2f77ab90 [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
avi5dd91f82015-12-25 22:30:468#include <stdint.h>
9
10#include "base/macros.h"
jochen73e711c2015-06-03 10:01:4611#include "components/test_runner/mock_spell_check.h"
12#include "components/test_runner/web_task.h"
[email protected]b38c8f312014-08-01 23:21:3713#include "third_party/WebKit/public/web/WebSpellCheckClient.h"
14
jochenf5f31752015-06-03 12:06:3415namespace test_runner {
[email protected]b38c8f312014-08-01 23:21:3716
17class WebTestDelegate;
18class WebTestProxyBase;
19
20class SpellCheckClient : public blink::WebSpellCheckClient {
21 public:
22 explicit SpellCheckClient(WebTestProxyBase* web_test_proxy);
23 virtual ~SpellCheckClient();
24
25 void SetDelegate(WebTestDelegate* delegate);
26
27 WebTaskList* mutable_task_list() { return &task_list_; }
28 MockSpellCheck* MockSpellCheckWord() { return &spell_check_; }
29
30 // blink::WebSpellCheckClient implementation.
avi0e2235662015-09-28 19:02:4831 void spellCheck(
[email protected]b38c8f312014-08-01 23:21:3732 const blink::WebString& text,
33 int& offset,
34 int& length,
avi0e2235662015-09-28 19:02:4835 blink::WebVector<blink::WebString>* optional_suggestions) override;
36 void checkTextOfParagraph(
[email protected]b38c8f312014-08-01 23:21:3737 const blink::WebString& text,
38 blink::WebTextCheckingTypeMask mask,
avi0e2235662015-09-28 19:02:4839 blink::WebVector<blink::WebTextCheckingResult>* web_results) override;
40 void requestCheckingOfText(
[email protected]b38c8f312014-08-01 23:21:3741 const blink::WebString& text,
42 const blink::WebVector<uint32_t>& markers,
43 const blink::WebVector<unsigned>& marker_offsets,
avi0e2235662015-09-28 19:02:4844 blink::WebTextCheckingCompletion* completion) override;
[email protected]b38c8f312014-08-01 23:21:3745
46 private:
47 void FinishLastTextCheck();
48
49 // The mock spellchecker used in spellCheck().
50 MockSpellCheck spell_check_;
51
52 blink::WebString last_requested_text_check_string_;
53 blink::WebTextCheckingCompletion* last_requested_text_checking_completion_;
54
55 WebTaskList task_list_;
56
57 WebTestDelegate* delegate_;
58
59 WebTestProxyBase* web_test_proxy_;
60
61 DISALLOW_COPY_AND_ASSIGN(SpellCheckClient);
62};
63
jochenf5f31752015-06-03 12:06:3464} // namespace test_runner
[email protected]b38c8f312014-08-01 23:21:3765
jochen73e711c2015-06-03 10:01:4666#endif // COMPONENTS_TEST_RUNNER_SPELL_CHECK_CLIENT_H_