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

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: Addressing creis@'s comments and changing a test method 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..47c1db5f4a55e164a75c0487716188188a3d6531 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,26 @@ 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.
+ 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