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 12 matching lines...) Expand all Loading... |
23 #include "core/testing/UnitTestHelpers.h" | 23 #include "core/testing/UnitTestHelpers.h" |
24 #include "wtf/OwnPtr.h" | 24 #include "wtf/OwnPtr.h" |
25 #include <gtest/gtest.h> | 25 #include <gtest/gtest.h> |
26 | 26 |
27 using namespace blink; | 27 using namespace blink; |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 class HTMLTextFormControlElementTest : public ::testing::Test { | 31 class HTMLTextFormControlElementTest : public ::testing::Test { |
32 protected: | 32 protected: |
33 virtual void SetUp() OVERRIDE; | 33 virtual void SetUp() override; |
34 | 34 |
35 DummyPageHolder& page() const { return *m_dummyPageHolder; } | 35 DummyPageHolder& page() const { return *m_dummyPageHolder; } |
36 HTMLDocument& document() const { return *m_document; } | 36 HTMLDocument& document() const { return *m_document; } |
37 HTMLTextFormControlElement& textControl() const { return *m_textControl; } | 37 HTMLTextFormControlElement& textControl() const { return *m_textControl; } |
38 HTMLInputElement& input() const { return *m_input; } | 38 HTMLInputElement& input() const { return *m_input; } |
39 | 39 |
40 int layoutCount() const { return page().frameView().layoutCount(); } | 40 int layoutCount() const { return page().frameView().layoutCount(); } |
41 void forceLayoutFlag(); | 41 void forceLayoutFlag(); |
42 | 42 |
43 private: | 43 private: |
44 OwnPtr<SpellCheckerClient> m_spellCheckerClient; | 44 OwnPtr<SpellCheckerClient> m_spellCheckerClient; |
45 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 45 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
46 | 46 |
47 RefPtrWillBePersistent<HTMLDocument> m_document; | 47 RefPtrWillBePersistent<HTMLDocument> m_document; |
48 RefPtrWillBePersistent<HTMLTextFormControlElement> m_textControl; | 48 RefPtrWillBePersistent<HTMLTextFormControlElement> m_textControl; |
49 RefPtrWillBePersistent<HTMLInputElement> m_input; | 49 RefPtrWillBePersistent<HTMLInputElement> m_input; |
50 }; | 50 }; |
51 | 51 |
52 class DummyTextCheckerClient : public EmptyTextCheckerClient { | 52 class DummyTextCheckerClient : public EmptyTextCheckerClient { |
53 public: | 53 public: |
54 ~DummyTextCheckerClient() { } | 54 ~DummyTextCheckerClient() { } |
55 | 55 |
56 virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const
OVERRIDE { return false; } | 56 virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const
override { return false; } |
57 }; | 57 }; |
58 | 58 |
59 class DummySpellCheckerClient : public EmptySpellCheckerClient { | 59 class DummySpellCheckerClient : public EmptySpellCheckerClient { |
60 public: | 60 public: |
61 virtual ~DummySpellCheckerClient() { } | 61 virtual ~DummySpellCheckerClient() { } |
62 | 62 |
63 virtual bool isContinuousSpellCheckingEnabled() OVERRIDE { return true; } | 63 virtual bool isContinuousSpellCheckingEnabled() override { return true; } |
64 virtual bool isGrammarCheckingEnabled() OVERRIDE { return true; } | 64 virtual bool isGrammarCheckingEnabled() override { return true; } |
65 | 65 |
66 virtual TextCheckerClient& textChecker() OVERRIDE { return m_dummyTextChecke
rClient; } | 66 virtual TextCheckerClient& textChecker() override { return m_dummyTextChecke
rClient; } |
67 | 67 |
68 private: | 68 private: |
69 DummyTextCheckerClient m_dummyTextCheckerClient; | 69 DummyTextCheckerClient m_dummyTextCheckerClient; |
70 }; | 70 }; |
71 | 71 |
72 void HTMLTextFormControlElementTest::SetUp() | 72 void HTMLTextFormControlElementTest::SetUp() |
73 { | 73 { |
74 Page::PageClients pageClients; | 74 Page::PageClients pageClients; |
75 fillWithEmptyClients(pageClients); | 75 fillWithEmptyClients(pageClients); |
76 m_spellCheckerClient = adoptPtr(new DummySpellCheckerClient); | 76 m_spellCheckerClient = adoptPtr(new DummySpellCheckerClient); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 ASSERT_EQ(3, input->selectionStart()); | 219 ASSERT_EQ(3, input->selectionStart()); |
220 | 220 |
221 OwnPtrWillBePersistent<SpellChecker> spellChecker(SpellChecker::create(page(
).frame())); | 221 OwnPtrWillBePersistent<SpellChecker> spellChecker(SpellChecker::create(page(
).frame())); |
222 forceLayoutFlag(); | 222 forceLayoutFlag(); |
223 int startCount = layoutCount(); | 223 int startCount = layoutCount(); |
224 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); | 224 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); |
225 EXPECT_EQ(startCount, layoutCount()); | 225 EXPECT_EQ(startCount, layoutCount()); |
226 } | 226 } |
227 | 227 |
228 } | 228 } |
OLD | NEW |