Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / renderer / spellchecker / spellcheck_provider_test.h
blob56ab49d517a2993dc8e3ef19af2a03a346ff0f49
1 // Copyright (c) 2012 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 CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_TEST_H_
6 #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_TEST_H_
8 #include <vector>
10 #include "base/memory/scoped_vector.h"
11 #include "base/strings/string16.h"
12 #include "chrome/renderer/spellchecker/spellcheck_provider.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/WebKit/public/platform/WebVector.h"
15 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h"
16 #include "third_party/WebKit/public/web/WebTextCheckingResult.h"
18 namespace IPC {
19 class Message;
22 // A fake completion object for verification.
23 class FakeTextCheckingCompletion : public blink::WebTextCheckingCompletion {
24 public:
25 FakeTextCheckingCompletion();
26 ~FakeTextCheckingCompletion();
28 void didFinishCheckingText(
29 const blink::WebVector<blink::WebTextCheckingResult>& results) override;
30 void didCancelCheckingText() override;
32 size_t completion_count_;
33 size_t cancellation_count_;
36 // Faked test target, which stores sent message for verification.
37 class TestingSpellCheckProvider : public SpellCheckProvider {
38 public:
39 TestingSpellCheckProvider();
41 ~TestingSpellCheckProvider() override;
42 bool Send(IPC::Message* message) override;
43 void OnCallSpellingService(int route_id,
44 int identifier,
45 const base::string16& text,
46 const std::vector<SpellCheckMarker>& markers);
47 void ResetResult();
49 base::string16 text_;
50 ScopedVector<IPC::Message> messages_;
51 size_t spelling_service_call_count_;
54 // SpellCheckProvider test fixture.
55 class SpellCheckProviderTest : public testing::Test {
56 public:
57 SpellCheckProviderTest();
58 ~SpellCheckProviderTest() override;
60 protected:
61 TestingSpellCheckProvider provider_;
64 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_TEST_H_