two_phase_testserver.py: Remove unnecessary method override.
[chromium-blink-merge.git] / chrome / renderer / spellchecker / spellcheck_provider_test.h
blobbda4fef13b304e8e04307e76b3d2936055fd6e16
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 WebKit::WebTextCheckingCompletion {
24 public:
25 FakeTextCheckingCompletion();
26 ~FakeTextCheckingCompletion();
28 virtual void didFinishCheckingText(
29 const WebKit::WebVector<WebKit::WebTextCheckingResult>& results) OVERRIDE;
30 virtual void didCancelCheckingText() OVERRIDE;
33 size_t completion_count_;
34 size_t cancellation_count_;
37 // Faked test target, which stores sent message for verification.
38 class TestingSpellCheckProvider : public SpellCheckProvider {
39 public:
40 TestingSpellCheckProvider();
42 virtual ~TestingSpellCheckProvider();
43 virtual bool Send(IPC::Message* message) OVERRIDE;
44 void OnCallSpellingService(int route_id,
45 int identifier,
46 const string16& text,
47 const std::vector<SpellCheckMarker>& markers);
48 void ResetResult();
50 string16 text_;
51 ScopedVector<IPC::Message> messages_;
52 size_t spelling_service_call_count_;
55 // SpellCheckProvider test fixture.
56 class SpellCheckProviderTest : public testing::Test {
57 public:
58 SpellCheckProviderTest();
59 virtual ~SpellCheckProviderTest();
61 protected:
62 TestingSpellCheckProvider provider_;
65 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_TEST_H_