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

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

Issue 2161043002: Route Text Layout Change IPCs to the Active RenderWidgetHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« 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 2c164fbe461c2c257bb6dfabfebfec45d1398d82..b6e7cec90ff80219d6fce9f352e6e90dde2d40e8 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
@@ -4323,9 +4323,7 @@ class InputMethodResultAuraTest : public InputMethodAuraTestBase {
DISALLOW_COPY_AND_ASSIGN(InputMethodResultAuraTest);
};
-// This test verifies that ui::TextInputClient::SetCompositionText call leads to
-// IPC message InputMsg_ImeSetComposition being sent to the right renderer
-// process.
+// This test verifies ui::TextInputClient::SetCompositionText.
EhsanK 2016/07/19 16:01:58 The comment on top of the test class explains what
TEST_F(InputMethodResultAuraTest, SetCompositionText) {
base::Closure ime_call =
base::Bind(&ui::TextInputClient::SetCompositionText,
@@ -4337,9 +4335,7 @@ TEST_F(InputMethodResultAuraTest, SetCompositionText) {
}
}
-// This test verifies that ui::TextInputClient::ConfirmCompositionText call
-// leads to IPC message InputMsg_ImeConfirmComposition being sent to the right
-// renderer process.
+// This test is for ui::TextInputClient::ConfirmCompositionText.
TEST_F(InputMethodResultAuraTest, ConfirmCompositionText) {
base::Closure ime_call =
base::Bind(&ui::TextInputClient::ConfirmCompositionText,
@@ -4352,9 +4348,7 @@ TEST_F(InputMethodResultAuraTest, ConfirmCompositionText) {
}
}
-// This test verifies that ui::TextInputClient::ConfirmCompositionText call
-// leads to IPC message InputMsg_ImeSetComposition being sent to the right
-// renderer process.
+// This test is for ui::TextInputClient::ConfirmCompositionText.
TEST_F(InputMethodResultAuraTest, ClearCompositionText) {
base::Closure ime_call =
base::Bind(&ui::TextInputClient::ClearCompositionText,
@@ -4367,8 +4361,7 @@ TEST_F(InputMethodResultAuraTest, ClearCompositionText) {
}
}
-// This test verifies that ui::TextInputClient::InsertText call leads to IPC
-// message InputMsg_ImeSetComposition being sent to the right renderer process.
+// This test is for that ui::TextInputClient::InsertText.
TEST_F(InputMethodResultAuraTest, InsertText) {
base::Closure ime_call =
base::Bind(&ui::TextInputClient::InsertText,
@@ -4380,10 +4373,8 @@ TEST_F(InputMethodResultAuraTest, InsertText) {
}
}
-// This test makes a specific view active and then forces the tab's view end the
-// current IME composition session by sending out an IME IPC to confirm
-// composition. The test then verifies that the message is sent
-// to the active widget's process.
+// This test is for RenderWidgetHostViewAura::FinishImeCompositionSession which
+// is in response to a mouse click during an ongoing composition.
TEST_F(InputMethodResultAuraTest, FinishImeCompositionSession) {
base::Closure ime_finish_session_call =
base::Bind(&RenderWidgetHostViewAura::FinishImeCompositionSession,
@@ -4397,8 +4388,26 @@ TEST_F(InputMethodResultAuraTest, FinishImeCompositionSession) {
}
}
+// This test is for ui::TextInputClient::ChangeTextDirectionAndLayoutAlignment.
+TEST_F(InputMethodResultAuraTest, ChangeTextDirectionAndLayoutAlignment) {
+ base::Closure ime_finish_session_call = base::Bind(
+ base::IgnoreResult(
+ &RenderWidgetHostViewAura::ChangeTextDirectionAndLayoutAlignment),
+ base::Unretained(tab_view()), base::i18n::LEFT_TO_RIGHT);
+ for (auto index : active_view_sequence_) {
+ ActivateViewForTextInputManager(views_[index], ui::TEXT_INPUT_TYPE_TEXT);
+ EXPECT_TRUE(!!RunAndReturnIPCSent(ime_finish_session_call,
+ processes_[index],
+ ViewMsg_SetTextDirection::ID));
+ }
+}
+
// A class of tests which verify the correctness of some tracked IME related
-// state at the browser side, e.g., caret bounds.
+// state at the browser side. Each test verifies the correctness tracking for
+// one specific state. To do so, the views are activated in a predetermined
+// sequence and each time, the IPC call for the corresponding state is simulated
+// through calling the method on the view. Then the test verifies that the value
+// returned by the view or ui::TextInputClient is the expected value from IPC.
class InputMethodStateAuraTest : public InputMethodAuraTestBase {
public:
InputMethodStateAuraTest() {}
@@ -4421,10 +4430,8 @@ class InputMethodStateAuraTest : public InputMethodAuraTestBase {
DISALLOW_COPY_AND_ASSIGN(InputMethodStateAuraTest);
};
-// This test activates the views on the tab according to a predefined order and
-// for each tab, simulates a selection bounds changed call. Then it verifies
-// that the caret bounds reported by the TextInputClient match those reported
-// for the active view.
+// This test is for caret bounds which are calculated based on the tracked value
+// for selection bounds.
TEST_F(InputMethodStateAuraTest, GetCaretBounds) {
ViewHostMsg_SelectionBounds_Params params;
params.is_anchor_first = true;
@@ -4450,9 +4457,7 @@ 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.
+// This test is for composition character bounds.
TEST_F(InputMethodStateAuraTest, GetCompositionCharacterBounds) {
gfx::Rect bound;
// Initially, there should be no bounds.
« 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