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

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

Issue 614553002: Make sure the IME composition is canceled before forwarding the mouse pressed event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added an unit test. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a7359517455cc4d348c459212248c321a3781960..e692621f1e0005c5f96cb6d504875ab9ffa87544 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
@@ -843,6 +843,49 @@ TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) {
EXPECT_FALSE(view_->has_composition_text_);
}
+// Checks that sequence of IME-composition-event and mouse-event when mouse
+// clicking to cancel the composition.
+TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) {
+ view_->InitAsChild(NULL);
+ view_->Show();
+
+ ui::CompositionText composition_text;
+ composition_text.text = base::ASCIIToUTF16("|a|b");
+
+ // Focused segment
+ composition_text.underlines.push_back(
+ ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412));
+
+ // Non-focused segment, with different background color.
+ composition_text.underlines.push_back(
+ ui::CompositionUnderline(3, 4, 0xff000000, false, 0xefcdab90));
+
+ // Caret is at the end. (This emulates Japanese MSIME 2007 and later)
+ composition_text.selection = gfx::Range(4);
+
+ view_->SetCompositionText(composition_text);
+ EXPECT_TRUE(view_->has_composition_text_);
+ sink_->ClearMessages();
+
+ // Simulates the mouse press.
+ ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED,
+ gfx::Point(), gfx::Point(),
+ ui::EF_LEFT_MOUSE_BUTTON, 0);
+ view_->OnMouseEvent(&mouse_event);
+
+ EXPECT_FALSE(view_->has_composition_text_);
+
+ EXPECT_EQ(2U, sink_->message_count());
+
+ if (sink_->message_count() == 2) {
+ // Verify mouse event happens after the confirm-composition event.
+ EXPECT_EQ(InputMsg_ImeConfirmComposition::ID,
+ sink_->GetMessageAt(0)->type());
+ EXPECT_EQ(InputMsg_HandleInputEvent::ID,
+ sink_->GetMessageAt(1)->type());
+ }
+}
+
// Checks that touch-event state is maintained correctly.
TEST_F(RenderWidgetHostViewAuraTest, TouchEventState) {
view_->InitAsChild(NULL);
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698