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

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/browser/input/SelectionHandleTest.java

Issue 24449007: [Android] Allow text handles to observe position of "parent" view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/input/SelectionHandleController.java ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 package org.chromium.content.browser.input; 5 package org.chromium.content.browser.input;
6 6
7 import android.graphics.Point; 7 import android.graphics.Point;
8 import android.graphics.Rect; 8 import android.graphics.Rect;
9 import android.os.SystemClock; 9 import android.os.SystemClock;
10 import android.test.suitebuilder.annotation.MediumTest; 10 import android.test.suitebuilder.annotation.MediumTest;
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 389
390 private void clickNodeToShowSelectionHandles(String nodeId) throws Throwable { 390 private void clickNodeToShowSelectionHandles(String nodeId) throws Throwable {
391 Rect nodeWindowBounds = getNodeBoundsPix(nodeId); 391 Rect nodeWindowBounds = getNodeBoundsPix(nodeId);
392 392
393 TouchCommon touchCommon = new TouchCommon(this); 393 TouchCommon touchCommon = new TouchCommon(this);
394 int centerX = nodeWindowBounds.centerX(); 394 int centerX = nodeWindowBounds.centerX();
395 int centerY = nodeWindowBounds.centerY(); 395 int centerY = nodeWindowBounds.centerY();
396 touchCommon.longPressView(getContentView(), centerX, centerY); 396 touchCommon.longPressView(getContentView(), centerX, centerY);
397 397
398 assertWaitForHandlesShowingEquals(true); 398 assertWaitForHandlesShowingEquals(true);
399 assertWaitForHandleViewStopped(getStartHandle());
399 400
400 // No words wrap in the sample text so handles should be at the same y 401 // No words wrap in the sample text so handles should be at the same y
401 // position. 402 // position.
402 assertEquals(getStartHandle().getPositionY(), getEndHandle().getPosition Y()); 403 assertEquals(getStartHandle().getPositionY(), getEndHandle().getPosition Y());
403
404 // In ContentShell, the handles are initially misplaced when they first appear. This is
405 // fixed after the first time they are dragged (or the page is scrolled) .
406 // TODO(cjhopman): Fix this problem in ContentShell: http://crbug.com/24 3836
407 dragHandleTo(getStartHandle(), centerX - 40, centerY - 40, 1);
408 assertWaitForHandleViewStopped(getStartHandle());
409 } 404 }
410 405
411 private void clickToDismissHandles() throws Throwable { 406 private void clickToDismissHandles() throws Throwable {
412 TestTouchUtils.sleepForDoubleTapTimeout(getInstrumentation()); 407 TestTouchUtils.sleepForDoubleTapTimeout(getInstrumentation());
413 new TouchCommon(this).singleClickView(getContentView(), 0, 0); 408 new TouchCommon(this).singleClickView(getContentView(), 0, 0);
414 assertWaitForHandlesShowingEquals(false); 409 assertWaitForHandlesShowingEquals(false);
415 } 410 }
416 411
417 private void assertWaitForSelectActionBarShowingEquals(final boolean shouldB eShowing) 412 private void assertWaitForSelectActionBarShowingEquals(final boolean shouldB eShowing)
418 throws InterruptedException { 413 throws InterruptedException {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 private HandleView getStartHandle() { 454 private HandleView getStartHandle() {
460 SelectionHandleController shc = getContentViewCore().getSelectionHandleC ontrollerForTest(); 455 SelectionHandleController shc = getContentViewCore().getSelectionHandleC ontrollerForTest();
461 return shc.getStartHandleViewForTest(); 456 return shc.getStartHandleViewForTest();
462 } 457 }
463 458
464 private HandleView getEndHandle() { 459 private HandleView getEndHandle() {
465 SelectionHandleController shc = getContentViewCore().getSelectionHandleC ontrollerForTest(); 460 SelectionHandleController shc = getContentViewCore().getSelectionHandleC ontrollerForTest();
466 return shc.getEndHandleViewForTest(); 461 return shc.getEndHandleViewForTest();
467 } 462 }
468 } 463 }
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/input/SelectionHandleController.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698