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

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandlerTest.cpp

Issue 2920733002: Rename VisibleSelection::end() to End() (Closed)
Patch Set: 2017-06-01T18:31:38 Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/input/EventHandler.h" 5 #include "core/input/EventHandler.h"
6 6
7 #include <memory> 7 #include <memory>
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/editing/Editor.h" 10 #include "core/editing/Editor.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 double_tap_event); 185 double_tap_event);
186 ASSERT_TRUE( 186 ASSERT_TRUE(
187 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsRange()); 187 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsRange());
188 EXPECT_EQ(Position(line, 0), 188 EXPECT_EQ(Position(line, 0),
189 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().Start()); 189 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().Start());
190 if (GetDocument() 190 if (GetDocument()
191 .GetFrame() 191 .GetFrame()
192 ->GetEditor() 192 ->GetEditor()
193 .IsSelectTrailingWhitespaceEnabled()) { 193 .IsSelectTrailingWhitespaceEnabled()) {
194 EXPECT_EQ(Position(line, 4), 194 EXPECT_EQ(Position(line, 4),
195 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().end()); 195 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().End());
196 EXPECT_EQ("One ", WebString(Selection().SelectedText()).Utf8()); 196 EXPECT_EQ("One ", WebString(Selection().SelectedText()).Utf8());
197 } else { 197 } else {
198 EXPECT_EQ(Position(line, 3), 198 EXPECT_EQ(Position(line, 3),
199 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().end()); 199 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().End());
200 EXPECT_EQ("One", WebString(Selection().SelectedText()).Utf8()); 200 EXPECT_EQ("One", WebString(Selection().SelectedText()).Utf8());
201 } 201 }
202 202
203 TapEventBuilder triple_tap_event(IntPoint(0, 0), 3); 203 TapEventBuilder triple_tap_event(IntPoint(0, 0), 3);
204 GetDocument().GetFrame()->GetEventHandler().HandleGestureEvent( 204 GetDocument().GetFrame()->GetEventHandler().HandleGestureEvent(
205 triple_tap_event); 205 triple_tap_event);
206 ASSERT_TRUE( 206 ASSERT_TRUE(
207 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsRange()); 207 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsRange());
208 EXPECT_EQ(Position(line, 0), 208 EXPECT_EQ(Position(line, 0),
209 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().Start()); 209 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().Start());
210 EXPECT_EQ(Position(line, 13), 210 EXPECT_EQ(Position(line, 13),
211 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().end()); 211 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().End());
212 EXPECT_EQ("One Two Three", WebString(Selection().SelectedText()).Utf8()); 212 EXPECT_EQ("One Two Three", WebString(Selection().SelectedText()).Utf8());
213 } 213 }
214 214
215 TEST_F(EventHandlerTest, multiClickSelectionFromTapDisabledIfNotEditable) { 215 TEST_F(EventHandlerTest, multiClickSelectionFromTapDisabledIfNotEditable) {
216 SetHtmlInnerHTML( 216 SetHtmlInnerHTML(
217 "<style> body { margin: 0px; } .line { display: block; width: 300px; " 217 "<style> body { margin: 0px; } .line { display: block; width: 300px; "
218 "height: 30px; } </style>" 218 "height: 30px; } </style>"
219 "<span class='line' id='line'>One Two Three</span>"); 219 "<span class='line' id='line'>One Two Three</span>");
220 220
221 Node* line = GetDocument().getElementById("line")->firstChild(); 221 Node* line = GetDocument().getElementById("line")->firstChild();
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, 580 WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers,
581 TimeTicks::Now().InSeconds()); 581 TimeTicks::Now().InSeconds());
582 mouse_leave_event.SetFrameScale(1); 582 mouse_leave_event.SetFrameScale(1);
583 GetDocument().GetFrame()->GetEventHandler().HandleMouseLeaveEvent( 583 GetDocument().GetFrame()->GetEventHandler().HandleMouseLeaveEvent(
584 mouse_leave_event); 584 mouse_leave_event);
585 585
586 EXPECT_EQ(WTF::String(), LastToolTip()); 586 EXPECT_EQ(WTF::String(), LastToolTip());
587 } 587 }
588 588
589 } // namespace blink 589 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698