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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java

Issue 2210533004: Revert of Do not calculate composition bounds until IME requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
Index: content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java
index 2d488aa7c24271661e7d356c714232f9ffb6da48..768b6bbf91d2aded5ac6101e705e16983d39a7b4 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java
@@ -13,6 +13,7 @@
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.CursorAnchorInfo;
+import android.view.inputmethod.InputConnection;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.MinAndroidSdkLevel;
@@ -140,11 +141,10 @@
assertFalse(
"IC#onRequestCursorUpdates() must be rejected if the focused node is not editable.",
- controller.onRequestCursorUpdates(
- false /* immediate request */, true /* monitor request */, view));
+ controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_MONITOR, view));
// Make sure that the focused node is considered to be non-editable by default.
- controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
+ controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f});
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
@@ -155,7 +155,7 @@
// Make sure that the controller does not crash even if it is called while the focused node
// is not editable.
- controller.setCompositionCharacterBounds(new float[] {30.0f, 1.0f, 32.0f, 3.0f}, view);
+ controller.setCompositionCharacterBounds(new float[] {30.0f, 1.0f, 32.0f, 3.0f});
composingTextDelegate.updateTextAndSelection(controller, "1", 0, 1, 0, 1);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 100.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
@@ -179,9 +179,9 @@
// Make sure that #updateCursorAnchorInfo() is not be called until the matrix info becomes
// available with #onUpdateFrameInfo().
- assertTrue(controller.onRequestCursorUpdates(
- true /* immediate request */, false /* monitor request */, view));
- controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
+ assertTrue(controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_IMMEDIATE,
+ view));
+ controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f});
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
@@ -205,8 +205,8 @@
// Make sure that #onUpdateFrameInfo() is immediately called because the matrix info is
// already available.
- assertTrue(controller.onRequestCursorUpdates(
- true /* immediate request */, false /* monitor request */, view));
+ assertTrue(controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_IMMEDIATE,
+ view));
assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(2.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f, 0.0f, 3.0f,
@@ -222,7 +222,8 @@
// Make sure that CURSOR_UPDATE_IMMEDIATE and CURSOR_UPDATE_MONITOR can be specified at
// the same time.
assertTrue(controller.onRequestCursorUpdates(
- true /* immediate request*/, true /* monitor request */, view));
+ InputConnection.CURSOR_UPDATE_IMMEDIATE | InputConnection.CURSOR_UPDATE_MONITOR,
+ view));
assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(2.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
@@ -245,8 +246,8 @@
controller.focusedNodeChanged(false);
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
- true /* immediate request */, false /* monitor request */, view));
+ assertTrue(controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_IMMEDIATE,
+ view));
controller.focusedNodeChanged(false);
composingTextDelegate.clearTextAndSelection(controller);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 100.0f),
@@ -256,8 +257,8 @@
// Make sure that CURSOR_UPDATE_IMMEDIATE can be enabled again.
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
- true /* immediate request */, false /* monitor request */, view));
+ assertTrue(controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_IMMEDIATE,
+ view));
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
@@ -288,9 +289,8 @@
// Make sure that #updateCursorAnchorInfo() is not be called until the matrix info becomes
// available with #onUpdateFrameInfo().
- assertTrue(controller.onRequestCursorUpdates(
- false /* immediate request */, true /* monitor request */, view));
- controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
+ assertTrue(controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_MONITOR, view));
+ controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f});
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
@@ -309,14 +309,14 @@
// Make sure that #updateCursorAnchorInfo() is not be called if any coordinate parameter is
// changed for better performance.
- controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
+ controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f});
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
// Make sure that #updateCursorAnchorInfo() is called if #setCompositionCharacterBounds()
// is called with a different parameter.
- controller.setCompositionCharacterBounds(new float[] {30.0f, 1.0f, 32.0f, 3.0f}, view);
+ controller.setCompositionCharacterBounds(new float[] {30.0f, 1.0f, 32.0f, 3.0f});
assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
@@ -388,11 +388,10 @@
controller.focusedNodeChanged(false);
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
- false /* immediate request */, true /* monitor request */, view));
+ assertTrue(controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_MONITOR, view));
controller.focusedNodeChanged(false);
composingTextDelegate.clearTextAndSelection(controller);
- controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
+ controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f});
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
@@ -401,9 +400,8 @@
// Make sure that CURSOR_UPDATE_MONITOR can be enabled again.
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
- false /* immediate request */, true /* monitor request */, view));
- controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
+ assertTrue(controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_MONITOR, view));
+ controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f});
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
viewDelegate.locationX = 0;
@@ -438,12 +436,11 @@
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
- false /* immediate request */, true /* monitor request */, view));
+ assertTrue(controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_MONITOR, view));
composingTextDelegate.updateTextAndSelection(controller, "01234", 1, 3, 1, 1);
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f,
- 4.0f, 1.1f, 6.0f, 2.9f}, view);
+ 4.0f, 1.1f, 6.0f, 2.9f});
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
false, false, Float.NaN, Float.NaN, Float.NaN, view);
assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
@@ -478,8 +475,7 @@
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
- false /* immediate request */, true /* monitor request */, view));
+ assertTrue(controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_MONITOR, view));
composingTextDelegate.updateTextAndSelection(controller, "01234", 3, 3, 1, 1);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
@@ -511,8 +507,7 @@
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
- false /* immediate request */, true /* monitor request */, view));
+ assertTrue(controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_MONITOR, view));
// Test no insertion marker.
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
@@ -550,8 +545,7 @@
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
- false /* immediate request */, true /* monitor request */, view));
+ assertTrue(controller.onRequestCursorUpdates(InputConnection.CURSOR_UPDATE_MONITOR, view));
// Test no transformation
viewDelegate.locationX = 0;

Powered by Google App Engine
This is Rietveld 408576698