| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/editing/spellcheck/SpellChecker.h" | 5 #include "core/editing/spellcheck/SpellChecker.h" |
| 6 | 6 |
| 7 #include "core/editing/EditingTestBase.h" | |
| 8 #include "core/editing/Editor.h" | 7 #include "core/editing/Editor.h" |
| 8 #include "core/editing/spellcheck/SpellCheckTestBase.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 11 #include "core/frame/Settings.h" | 11 #include "core/frame/Settings.h" |
| 12 #include "core/html/HTMLInputElement.h" | 12 #include "core/html/HTMLInputElement.h" |
| 13 #include "core/testing/DummyPageHolder.h" | |
| 14 | 13 |
| 15 namespace blink { | 14 namespace blink { |
| 16 | 15 |
| 17 class SpellCheckerTest : public EditingTestBase { | 16 class SpellCheckerTest : public SpellCheckTestBase { |
| 18 protected: | 17 protected: |
| 19 int layoutCount() const { return page().frameView().layoutCount(); } | 18 int layoutCount() const { return page().frameView().layoutCount(); } |
| 20 DummyPageHolder& page() const { return dummyPageHolder(); } | 19 DummyPageHolder& page() const { return dummyPageHolder(); } |
| 21 | 20 |
| 22 void forceLayout(); | 21 void forceLayout(); |
| 23 }; | 22 }; |
| 24 | 23 |
| 25 void SpellCheckerTest::forceLayout() { | 24 void SpellCheckerTest::forceLayout() { |
| 26 FrameView& frameView = page().frameView(); | 25 FrameView& frameView = page().frameView(); |
| 27 IntRect frameRect = frameView.frameRect(); | 26 IntRect frameRect = frameView.frameRect(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 52 document() | 51 document() |
| 53 .frame() | 52 .frame() |
| 54 ->selection() | 53 ->selection() |
| 55 .computeVisibleSelectionInDOMTreeDeprecated(); | 54 .computeVisibleSelectionInDOMTreeDeprecated(); |
| 56 | 55 |
| 57 Position newPosition(input->innerEditorElement()->firstChild(), 3); | 56 Position newPosition(input->innerEditorElement()->firstChild(), 3); |
| 58 document().frame()->selection().setSelection( | 57 document().frame()->selection().setSelection( |
| 59 SelectionInDOMTree::Builder().collapse(newPosition).build()); | 58 SelectionInDOMTree::Builder().collapse(newPosition).build()); |
| 60 ASSERT_EQ(3u, input->selectionStart()); | 59 ASSERT_EQ(3u, input->selectionStart()); |
| 61 | 60 |
| 62 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame())); | 61 EXPECT_TRUE(frame().spellChecker().isSpellCheckingEnabled()); |
| 63 forceLayout(); | 62 forceLayout(); |
| 64 int startCount = layoutCount(); | 63 int startCount = layoutCount(); |
| 65 spellChecker->respondToChangedSelection( | 64 frame().spellChecker().respondToChangedSelection( |
| 66 oldSelection.start(), | 65 oldSelection.start(), |
| 67 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); | 66 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); |
| 68 EXPECT_EQ(startCount, layoutCount()); | 67 EXPECT_EQ(startCount, layoutCount()); |
| 69 } | 68 } |
| 70 | 69 |
| 71 } // namespace blink | 70 } // namespace blink |
| OLD | NEW |