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/VisibleSelection.h" | 6 #include "core/editing/VisibleSelection.h" |
7 | 7 |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/Range.h" | 9 #include "core/dom/Range.h" |
10 #include "core/dom/Text.h" | 10 #include "core/dom/Text.h" |
11 #include "core/html/HTMLElement.h" | 11 #include "core/html/HTMLElement.h" |
12 #include "core/testing/DummyPageHolder.h" | 12 #include "core/testing/DummyPageHolder.h" |
13 #include <gtest/gtest.h> | 13 #include <gtest/gtest.h> |
14 | 14 |
15 #define LOREM_IPSUM \ | 15 #define LOREM_IPSUM \ |
16 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod te
mpor " \ | 16 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod te
mpor " \ |
17 "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud " \ | 17 "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud " \ |
18 "exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis
aute irure " \ | 18 "exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis
aute irure " \ |
19 "dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat null
a pariatur." \ | 19 "dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat null
a pariatur." \ |
20 "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia d
eserunt " \ | 20 "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia d
eserunt " \ |
21 "mollit anim id est laborum." | 21 "mollit anim id est laborum." |
22 | 22 |
23 namespace blink { | 23 namespace blink { |
24 | 24 |
25 class VisibleSelectionTest : public ::testing::Test { | 25 class VisibleSelectionTest : public ::testing::Test { |
26 protected: | 26 protected: |
27 virtual void SetUp() OVERRIDE; | 27 virtual void SetUp() override; |
28 | 28 |
29 // Oilpan: wrapper object needed to be able to trace VisibleSelection. | 29 // Oilpan: wrapper object needed to be able to trace VisibleSelection. |
30 class VisibleSelectionWrapper : public NoBaseWillBeGarbageCollectedFinalized
<VisibleSelectionWrapper> { | 30 class VisibleSelectionWrapper : public NoBaseWillBeGarbageCollectedFinalized
<VisibleSelectionWrapper> { |
31 public: | 31 public: |
32 void trace(Visitor* visitor) | 32 void trace(Visitor* visitor) |
33 { | 33 { |
34 visitor->trace(m_selection); | 34 visitor->trace(m_selection); |
35 } | 35 } |
36 | 36 |
37 VisibleSelection m_selection; | 37 VisibleSelection m_selection; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 selection().expandUsingGranularity(WordGranularity); | 162 selection().expandUsingGranularity(WordGranularity); |
163 | 163 |
164 RefPtrWillBeRawPtr<Range> range = selection().firstRange(); | 164 RefPtrWillBeRawPtr<Range> range = selection().firstRange(); |
165 EXPECT_EQ(0, range->startOffset()); | 165 EXPECT_EQ(0, range->startOffset()); |
166 EXPECT_EQ(11, range->endOffset()); | 166 EXPECT_EQ(11, range->endOffset()); |
167 EXPECT_EQ("Lorem ipsum", range->text()); | 167 EXPECT_EQ("Lorem ipsum", range->text()); |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 } // namespace blink | 171 } // namespace blink |
OLD | NEW |