OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/html/HTMLTextFormControlElement.h" | 6 #include "core/html/HTMLTextFormControlElement.h" |
7 | 7 |
8 #include "core/dom/Position.h" | 8 #include "core/dom/Position.h" |
9 #include "core/dom/Text.h" | 9 #include "core/dom/Text.h" |
10 #include "core/editing/FrameSelection.h" | 10 #include "core/editing/FrameSelection.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 RefPtrWillBePersistent<HTMLDocument> m_document; | 45 RefPtrWillBePersistent<HTMLDocument> m_document; |
46 RefPtrWillBePersistent<HTMLTextFormControlElement> m_textControl; | 46 RefPtrWillBePersistent<HTMLTextFormControlElement> m_textControl; |
47 RefPtrWillBePersistent<HTMLInputElement> m_input; | 47 RefPtrWillBePersistent<HTMLInputElement> m_input; |
48 }; | 48 }; |
49 | 49 |
50 class DummyTextCheckerClient : public EmptyTextCheckerClient { | 50 class DummyTextCheckerClient : public EmptyTextCheckerClient { |
51 public: | 51 public: |
52 ~DummyTextCheckerClient() { } | 52 ~DummyTextCheckerClient() { } |
53 | 53 |
54 virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const
override { return false; } | 54 bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const override
{ return false; } |
55 }; | 55 }; |
56 | 56 |
57 class DummySpellCheckerClient : public EmptySpellCheckerClient { | 57 class DummySpellCheckerClient : public EmptySpellCheckerClient { |
58 public: | 58 public: |
59 virtual ~DummySpellCheckerClient() { } | 59 virtual ~DummySpellCheckerClient() { } |
60 | 60 |
61 virtual bool isContinuousSpellCheckingEnabled() override { return true; } | 61 bool isContinuousSpellCheckingEnabled() override { return true; } |
62 virtual bool isGrammarCheckingEnabled() override { return true; } | 62 bool isGrammarCheckingEnabled() override { return true; } |
63 | 63 |
64 virtual TextCheckerClient& textChecker() override { return m_dummyTextChecke
rClient; } | 64 TextCheckerClient& textChecker() override { return m_dummyTextCheckerClient;
} |
65 | 65 |
66 private: | 66 private: |
67 DummyTextCheckerClient m_dummyTextCheckerClient; | 67 DummyTextCheckerClient m_dummyTextCheckerClient; |
68 }; | 68 }; |
69 | 69 |
70 void HTMLTextFormControlElementTest::SetUp() | 70 void HTMLTextFormControlElementTest::SetUp() |
71 { | 71 { |
72 Page::PageClients pageClients; | 72 Page::PageClients pageClients; |
73 fillWithEmptyClients(pageClients); | 73 fillWithEmptyClients(pageClients); |
74 m_spellCheckerClient = adoptPtr(new DummySpellCheckerClient); | 74 m_spellCheckerClient = adoptPtr(new DummySpellCheckerClient); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 ASSERT_EQ(3, input->selectionStart()); | 217 ASSERT_EQ(3, input->selectionStart()); |
218 | 218 |
219 OwnPtrWillBePersistent<SpellChecker> spellChecker(SpellChecker::create(page(
).frame())); | 219 OwnPtrWillBePersistent<SpellChecker> spellChecker(SpellChecker::create(page(
).frame())); |
220 forceLayoutFlag(); | 220 forceLayoutFlag(); |
221 int startCount = layoutCount(); | 221 int startCount = layoutCount(); |
222 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); | 222 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); |
223 EXPECT_EQ(startCount, layoutCount()); | 223 EXPECT_EQ(startCount, layoutCount()); |
224 } | 224 } |
225 | 225 |
226 } // namespace blink | 226 } // namespace blink |
OLD | NEW |