Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: chrome/renderer/spellchecker/spellcheck_provider_test.h

Issue 2198143002: Componentize spellcheck [3]: move renderer/ files to component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_TEST_H_
6 #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_TEST_H_
7
8 #include <stddef.h>
9
10 #include <vector>
11
12 #include "base/memory/scoped_vector.h"
13 #include "base/strings/string16.h"
14 #include "chrome/renderer/spellchecker/spellcheck_provider.h"
15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "third_party/WebKit/public/platform/WebVector.h"
17 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h"
18 #include "third_party/WebKit/public/web/WebTextCheckingResult.h"
19
20 namespace IPC {
21 class Message;
22 }
23
24 // A fake completion object for verification.
25 class FakeTextCheckingCompletion : public blink::WebTextCheckingCompletion {
26 public:
27 FakeTextCheckingCompletion();
28 ~FakeTextCheckingCompletion();
29
30 void didFinishCheckingText(
31 const blink::WebVector<blink::WebTextCheckingResult>& results) override;
32 void didCancelCheckingText() override;
33
34 size_t completion_count_;
35 size_t cancellation_count_;
36 };
37
38 // Faked test target, which stores sent message for verification.
39 class TestingSpellCheckProvider : public SpellCheckProvider {
40 public:
41 TestingSpellCheckProvider();
42 // Takes ownership of |spellcheck|.
43 explicit TestingSpellCheckProvider(SpellCheck* spellcheck);
44
45 ~TestingSpellCheckProvider() override;
46 bool Send(IPC::Message* message) override;
47 void OnCallSpellingService(int route_id,
48 int identifier,
49 const base::string16& text,
50 const std::vector<SpellCheckMarker>& markers);
51 void ResetResult();
52
53 base::string16 text_;
54 ScopedVector<IPC::Message> messages_;
55 size_t spelling_service_call_count_;
56 };
57
58 // SpellCheckProvider test fixture.
59 class SpellCheckProviderTest : public testing::Test {
60 public:
61 SpellCheckProviderTest();
62 ~SpellCheckProviderTest() override;
63
64 protected:
65 TestingSpellCheckProvider provider_;
66 };
67
68 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698