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

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

Issue 2748483002: Making sure ClearHandleAfterTap's tap occurs inside of HTML document (Closed)
Patch Set: removed unnecessary div Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 361
362 LongPressEventBuilder longPressEvent(IntPoint(200, 200)); 362 LongPressEventBuilder longPressEvent(IntPoint(200, 200));
363 document().frame()->eventHandler().handleGestureEvent(longPressEvent); 363 document().frame()->eventHandler().handleGestureEvent(longPressEvent);
364 364
365 ASSERT_TRUE( 365 ASSERT_TRUE(
366 selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret()); 366 selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
367 ASSERT_TRUE(selection().isHandleVisible()); 367 ASSERT_TRUE(selection().isHandleVisible());
368 } 368 }
369 369
370 TEST_F(EventHandlerTest, ClearHandleAfterTap) { 370 TEST_F(EventHandlerTest, ClearHandleAfterTap) {
371 setHtmlInnerHTML("<textarea cols=50 rows=50>Enter text</textarea>"); 371 setHtmlInnerHTML("<textarea cols=50 rows=10>Enter text</textarea>");
372 372
373 // Show handle 373 // Show handle
374 LongPressEventBuilder longPressEvent(IntPoint(200, 200)); 374 LongPressEventBuilder longPressEvent(IntPoint(200, 10));
375 document().frame()->eventHandler().handleGestureEvent(longPressEvent); 375 document().frame()->eventHandler().handleGestureEvent(longPressEvent);
376 376
377 ASSERT_TRUE( 377 ASSERT_TRUE(
378 selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret()); 378 selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
379 ASSERT_TRUE(selection().isHandleVisible()); 379 ASSERT_TRUE(selection().isHandleVisible());
380 380
381 // Tap away from text area should clear handle 381 // Tap away from text area should clear handle
382 TapEventBuilder singleTapEvent(IntPoint(700, 700), 1); 382 TapEventBuilder singleTapEvent(IntPoint(200, 350), 1);
383 document().frame()->eventHandler().handleGestureEvent(singleTapEvent); 383 document().frame()->eventHandler().handleGestureEvent(singleTapEvent);
384 384
385 ASSERT_TRUE(
386 selection().computeVisibleSelectionInDOMTreeDeprecated().isNone());
387 ASSERT_FALSE(selection().isHandleVisible()); 385 ASSERT_FALSE(selection().isHandleVisible());
388 } 386 }
389 387
390 TEST_F(EventHandlerTest, HandleNotShownOnMouseEvents) { 388 TEST_F(EventHandlerTest, HandleNotShownOnMouseEvents) {
391 setHtmlInnerHTML("<textarea cols=50 rows=50>Enter text</textarea>"); 389 setHtmlInnerHTML("<textarea cols=50 rows=50>Enter text</textarea>");
392 390
393 MousePressEventBuilder leftMousePressEvent( 391 MousePressEventBuilder leftMousePressEvent(
394 IntPoint(200, 200), 1, WebPointerProperties::Button::Left); 392 IntPoint(200, 200), 1, WebPointerProperties::Button::Left);
395 document().frame()->eventHandler().handleMousePressEvent(leftMousePressEvent); 393 document().frame()->eventHandler().handleMousePressEvent(leftMousePressEvent);
396 394
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 WebInputEvent::MouseLeave, WebFloatPoint(0, 0), WebFloatPoint(0, 0), 514 WebInputEvent::MouseLeave, WebFloatPoint(0, 0), WebFloatPoint(0, 0),
517 WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, 515 WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers,
518 TimeTicks::Now().InSeconds()); 516 TimeTicks::Now().InSeconds());
519 mouseLeaveEvent.setFrameScale(1); 517 mouseLeaveEvent.setFrameScale(1);
520 document().frame()->eventHandler().handleMouseLeaveEvent(mouseLeaveEvent); 518 document().frame()->eventHandler().handleMouseLeaveEvent(mouseLeaveEvent);
521 519
522 EXPECT_EQ(WTF::String(), lastToolTip()); 520 EXPECT_EQ(WTF::String(), lastToolTip());
523 } 521 }
524 522
525 } // namespace blink 523 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698