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/editing/FrameSelection.h" | 6 #include "core/editing/FrameSelection.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
11 #include "core/dom/Text.h" | 11 #include "core/dom/Text.h" |
12 #include "core/frame/FrameView.h" | 12 #include "core/frame/FrameView.h" |
13 #include "core/html/HTMLBodyElement.h" | 13 #include "core/html/HTMLBodyElement.h" |
14 #include "core/html/HTMLDocument.h" | 14 #include "core/html/HTMLDocument.h" |
15 #include "core/testing/DummyPageHolder.h" | 15 #include "core/testing/DummyPageHolder.h" |
16 #include "wtf/OwnPtr.h" | 16 #include "wtf/OwnPtr.h" |
17 #include "wtf/PassRefPtr.h" | 17 #include "wtf/PassRefPtr.h" |
18 #include "wtf/RefPtr.h" | 18 #include "wtf/RefPtr.h" |
19 #include "wtf/StdLibExtras.h" | 19 #include "wtf/StdLibExtras.h" |
20 #include "wtf/testing/WTFTestHelpers.h" | 20 #include "wtf/testing/WTFTestHelpers.h" |
21 #include <gtest/gtest.h> | 21 #include <gtest/gtest.h> |
22 | 22 |
23 using namespace blink; | 23 using namespace blink; |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 class FrameSelectionTest : public ::testing::Test { | 27 class FrameSelectionTest : public ::testing::Test { |
28 protected: | 28 protected: |
29 virtual void SetUp() OVERRIDE; | 29 virtual void SetUp() override; |
30 | 30 |
31 DummyPageHolder& dummyPageHolder() const { return *m_dummyPageHolder; } | 31 DummyPageHolder& dummyPageHolder() const { return *m_dummyPageHolder; } |
32 HTMLDocument& document() const; | 32 HTMLDocument& document() const; |
33 void setSelection(const VisibleSelection&); | 33 void setSelection(const VisibleSelection&); |
34 FrameSelection& selection() const; | 34 FrameSelection& selection() const; |
35 Text* textNode() { return m_textNode.get(); } | 35 Text* textNode() { return m_textNode.get(); } |
36 int layoutCount() const { return m_dummyPageHolder->frameView().layoutCount(
); } | 36 int layoutCount() const { return m_dummyPageHolder->frameView().layoutCount(
); } |
37 | 37 |
38 private: | 38 private: |
39 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 39 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 IntRect frameRect = frameView.frameRect(); | 132 IntRect frameRect = frameView.frameRect(); |
133 frameRect.setWidth(frameRect.width() + 1); | 133 frameRect.setWidth(frameRect.width() + 1); |
134 frameRect.setHeight(frameRect.height() + 1); | 134 frameRect.setHeight(frameRect.height() + 1); |
135 dummyPageHolder().frameView().setFrameRect(frameRect); | 135 dummyPageHolder().frameView().setFrameRect(frameRect); |
136 } | 136 } |
137 selection().paintCaret(nullptr, LayoutPoint(), LayoutRect()); | 137 selection().paintCaret(nullptr, LayoutPoint(), LayoutRect()); |
138 EXPECT_EQ(startCount, layoutCount()); | 138 EXPECT_EQ(startCount, layoutCount()); |
139 } | 139 } |
140 | 140 |
141 } | 141 } |
OLD | NEW |