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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 2132633002: Tracking composition range on the browser side (Aura) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting Fixes Created 4 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
Index: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index 30defc8652ebd6e26f713df9a26c93555bf04233..a1c878788101f5107ed7e48ba00ebcf806a93130 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -4300,4 +4300,24 @@ TEST_F(InputMethodStateAuraTest, GetCaretBounds) {
}
}
+// This test activates child frames in a specific sequence and changes their
+// composition range. Then it verifies that the ui::TextInputClient returns the
+// correct character bound at the given indices.
+TEST_F(InputMethodStateAuraTest, GetCompositionCharacterBounds) {
+ gfx::Rect bound;
+ // Initially, there should be no bounds.
+ EXPECT_FALSE(text_input_client()->GetCompositionCharacterBounds(0, &bound));
+ for (auto index : active_view_sequence_) {
+ ActivateViewForTextInputManager(views_[index], ui::TEXT_INPUT_TYPE_TEXT);
+ // Simulate an IPC to set character bounds for the view.
+ views_[index]->ImeCompositionRangeChanged(gfx::Range(),
+ {gfx::Rect(1, 2, 3, 4 + index)});
+ // No bounds at index 1.
+ EXPECT_FALSE(text_input_client()->GetCompositionCharacterBounds(1, &bound));
+ // valid bound at index 0.
Charlie Reis 2016/07/08 18:55:24 nit: Valid
EhsanK 2016/07/11 18:07:21 Done.
+ EXPECT_TRUE(text_input_client()->GetCompositionCharacterBounds(0, &bound));
+ EXPECT_EQ(4 + (int) index, bound.height());
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698