Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp b/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp |
| index acb6dfce1e28e4d368833cf0285fb1618bbfaf80..2fe38bfe7bfe7d1d01e06cb488de5f2b789e6898 100644 |
| --- a/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp |
| +++ b/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp |
| @@ -4,15 +4,16 @@ |
| #include "core/editing/SurroundingText.h" |
| +#include <memory> |
|
yosin_UTC9
2017/06/07 01:00:00
Thanks for reorder to follow coding standard.
Tima Vaisburd
2017/06/07 04:52:50
Thank you, but can't take the credit: this was "gi
|
| #include "core/dom/Document.h" |
| #include "core/dom/Range.h" |
| #include "core/dom/Text.h" |
| #include "core/editing/Position.h" |
| #include "core/editing/VisibleSelection.h" |
| #include "core/html/HTMLElement.h" |
| +#include "core/html/TextControlElement.h" |
| #include "core/testing/DummyPageHolder.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| -#include <memory> |
| namespace blink { |
| @@ -276,4 +277,24 @@ TEST_F(SurroundingTextTest, TreeRangeSelection) { |
| } |
| } |
| +TEST_F(SurroundingTextTest, TextAreaSelection) { |
| + SetHTML( |
| + String("<p>First paragraph</p>" |
| + "<textarea id='selection'>abc def ghi</textarea>" |
| + "<p>Second paragraph</p>")); |
| + |
| + TextControlElement* text_ctrl = |
| + (TextControlElement*)GetDocument().getElementById("selection"); |
| + |
| + text_ctrl->SetSelectionRange(4, 7); |
| + VisibleSelection selection = CreateVisibleSelection(text_ctrl->Selection()); |
| + |
| + SurroundingText surrounding_text( |
| + *CreateRange(FirstEphemeralRangeOf(selection)), 20); |
| + |
| + EXPECT_EQ("abc def ghi", surrounding_text.Content().SimplifyWhiteSpace()); |
| + EXPECT_EQ(4u, surrounding_text.StartOffsetInContent()); |
| + EXPECT_EQ(7u, surrounding_text.EndOffsetInContent()); |
| +} |
| + |
| } // namespace blink |