Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp

Issue 2972753002: Make FrameSelection::MoveRangeSelection() not to set live granularity selection (Closed)
Patch Set: 2017-07-05T16:09:52 Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
index 9fc95a618e6d1a2b8541e53edad80acd5c90ba7b..809cd53bef6c8628e80540193e3457cd48087ba9 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
@@ -238,6 +238,24 @@ TEST_F(FrameSelectionTest, MoveRangeSelectionTest) {
EXPECT_EQ_SELECTED_TEXT("Foo Bar");
}
+TEST_F(FrameSelectionTest, MoveRangeSelectionNoLiveness) {
+ SetBodyContent("<span id=sample>xyz</span>");
+ Element* const sample = GetDocument().getElementById("sample");
+ // Select as: <span id=sample>^xyz|</span>
+ Selection().MoveRangeSelection(
+ CreateVisiblePosition(Position(sample->firstChild(), 1)),
+ CreateVisiblePosition(Position(sample->firstChild(), 1)),
+ kWordGranularity);
yoichio 2017/07/05 08:57:24 Could you expect_eq(SelectText(), 'xyz')?
yosin_UTC9 2017/07/05 09:15:49 Done.
+ sample->insertBefore(Text::Create(GetDocument(), "abc"),
+ sample->firstChild());
+ GetDocument().UpdateStyleAndLayout();
+ const VisibleSelection& selection =
+ Selection().ComputeVisibleSelectionInDOMTree();
+ // Inserting "abc" before "xyz" should not affect to selection.
+ EXPECT_EQ(Position(sample->lastChild(), 0), selection.Start());
+ EXPECT_EQ(Position(sample->lastChild(), 3), selection.End());
yoichio 2017/07/05 08:57:24 Could you expect_eq(SelectText(), 'xyz') and expe
yosin_UTC9 2017/07/05 09:15:49 Done.
+}
+
// For http://crbug.com/695317
TEST_F(FrameSelectionTest, SelectAllWithInputElement) {
SetBodyContent("<input>123");
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698