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

Side by Side Diff: content/renderer/render_view_browsertest.cc

Issue 2596193002: Clean up names and remove unnecessary parameter (Closed)
Patch Set: change show_ime to show_virtual_keyboard in the renderer Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <tuple> 7 #include <tuple>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 const int kRepeatCount = 10; 1081 const int kRepeatCount = 10;
1082 for (int i = 0; i < kRepeatCount; i++) { 1082 for (int i = 0; i < kRepeatCount; i++) {
1083 // Move the input focus to the first <input> element, where we should 1083 // Move the input focus to the first <input> element, where we should
1084 // activate IMEs. 1084 // activate IMEs.
1085 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); 1085 ExecuteJavaScriptForTests("document.getElementById('test1').focus();");
1086 ProcessPendingMessages(); 1086 ProcessPendingMessages();
1087 render_thread_->sink().ClearMessages(); 1087 render_thread_->sink().ClearMessages();
1088 1088
1089 // Update the IME status and verify if our IME backend sends an IPC message 1089 // Update the IME status and verify if our IME backend sends an IPC message
1090 // to activate IMEs. 1090 // to activate IMEs.
1091 view()->UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_NON_IME); 1091 view()->UpdateTextInputState();
1092 const IPC::Message* msg = render_thread_->sink().GetMessageAt(0); 1092 const IPC::Message* msg = render_thread_->sink().GetMessageAt(0);
1093 EXPECT_TRUE(msg != NULL); 1093 EXPECT_TRUE(msg != NULL);
1094 EXPECT_EQ(ViewHostMsg_TextInputStateChanged::ID, msg->type()); 1094 EXPECT_EQ(ViewHostMsg_TextInputStateChanged::ID, msg->type());
1095 ViewHostMsg_TextInputStateChanged::Param params; 1095 ViewHostMsg_TextInputStateChanged::Param params;
1096 ViewHostMsg_TextInputStateChanged::Read(msg, &params); 1096 ViewHostMsg_TextInputStateChanged::Read(msg, &params);
1097 TextInputState p = std::get<0>(params); 1097 TextInputState p = std::get<0>(params);
1098 ui::TextInputType type = p.type; 1098 ui::TextInputType type = p.type;
1099 ui::TextInputMode input_mode = p.mode; 1099 ui::TextInputMode input_mode = p.mode;
1100 bool can_compose_inline = p.can_compose_inline; 1100 bool can_compose_inline = p.can_compose_inline;
1101 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, type); 1101 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, type);
1102 EXPECT_EQ(true, can_compose_inline); 1102 EXPECT_EQ(true, can_compose_inline);
1103 1103
1104 // Move the input focus to the second <input> element, where we should 1104 // Move the input focus to the second <input> element, where we should
1105 // de-activate IMEs. 1105 // de-activate IMEs.
1106 ExecuteJavaScriptForTests("document.getElementById('test2').focus();"); 1106 ExecuteJavaScriptForTests("document.getElementById('test2').focus();");
1107 ProcessPendingMessages(); 1107 ProcessPendingMessages();
1108 render_thread_->sink().ClearMessages(); 1108 render_thread_->sink().ClearMessages();
1109 1109
1110 // Update the IME status and verify if our IME backend sends an IPC message 1110 // Update the IME status and verify if our IME backend sends an IPC message
1111 // to de-activate IMEs. 1111 // to de-activate IMEs.
1112 view()->UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_NON_IME); 1112 view()->UpdateTextInputState();
1113 msg = render_thread_->sink().GetMessageAt(0); 1113 msg = render_thread_->sink().GetMessageAt(0);
1114 EXPECT_TRUE(msg != NULL); 1114 EXPECT_TRUE(msg != NULL);
1115 EXPECT_EQ(ViewHostMsg_TextInputStateChanged::ID, msg->type()); 1115 EXPECT_EQ(ViewHostMsg_TextInputStateChanged::ID, msg->type());
1116 ViewHostMsg_TextInputStateChanged::Read(msg, &params); 1116 ViewHostMsg_TextInputStateChanged::Read(msg, &params);
1117 p = std::get<0>(params); 1117 p = std::get<0>(params);
1118 type = p.type; 1118 type = p.type;
1119 input_mode = p.mode; 1119 input_mode = p.mode;
1120 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, type); 1120 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, type);
1121 1121
1122 for (size_t i = 0; i < arraysize(kInputModeTestCases); i++) { 1122 for (size_t i = 0; i < arraysize(kInputModeTestCases); i++) {
1123 const InputModeTestCase* test_case = &kInputModeTestCases[i]; 1123 const InputModeTestCase* test_case = &kInputModeTestCases[i];
1124 std::string javascript = 1124 std::string javascript =
1125 base::StringPrintf("document.getElementById('%s').focus();", 1125 base::StringPrintf("document.getElementById('%s').focus();",
1126 test_case->input_id); 1126 test_case->input_id);
1127 // Move the input focus to the target <input> element, where we should 1127 // Move the input focus to the target <input> element, where we should
1128 // activate IMEs. 1128 // activate IMEs.
1129 ExecuteJavaScriptAndReturnIntValue(base::ASCIIToUTF16(javascript), NULL); 1129 ExecuteJavaScriptAndReturnIntValue(base::ASCIIToUTF16(javascript), NULL);
1130 ProcessPendingMessages(); 1130 ProcessPendingMessages();
1131 render_thread_->sink().ClearMessages(); 1131 render_thread_->sink().ClearMessages();
1132 1132
1133 // Update the IME status and verify if our IME backend sends an IPC 1133 // Update the IME status and verify if our IME backend sends an IPC
1134 // message to activate IMEs. 1134 // message to activate IMEs.
1135 view()->UpdateTextInputState(ShowIme::HIDE_IME, 1135 view()->UpdateTextInputState();
1136 ChangeSource::FROM_NON_IME);
1137 ProcessPendingMessages(); 1136 ProcessPendingMessages();
1138 const IPC::Message* msg = render_thread_->sink().GetMessageAt(0); 1137 const IPC::Message* msg = render_thread_->sink().GetMessageAt(0);
1139 EXPECT_TRUE(msg != NULL); 1138 EXPECT_TRUE(msg != NULL);
1140 EXPECT_EQ(ViewHostMsg_TextInputStateChanged::ID, msg->type()); 1139 EXPECT_EQ(ViewHostMsg_TextInputStateChanged::ID, msg->type());
1141 ViewHostMsg_TextInputStateChanged::Read(msg, &params); 1140 ViewHostMsg_TextInputStateChanged::Read(msg, &params);
1142 p = std::get<0>(params); 1141 p = std::get<0>(params);
1143 type = p.type; 1142 type = p.type;
1144 input_mode = p.mode; 1143 input_mode = p.mode;
1145 EXPECT_EQ(test_case->expected_mode, input_mode); 1144 EXPECT_EQ(test_case->expected_mode, input_mode);
1146 } 1145 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 view()->OnImeSetComposition( 1264 view()->OnImeSetComposition(
1266 base::string16(), 1265 base::string16(),
1267 std::vector<blink::WebCompositionUnderline>(), 1266 std::vector<blink::WebCompositionUnderline>(),
1268 gfx::Range::InvalidRange(), 1267 gfx::Range::InvalidRange(),
1269 0, 0); 1268 0, 0);
1270 break; 1269 break;
1271 } 1270 }
1272 1271
1273 // Update the status of our IME back-end. 1272 // Update the status of our IME back-end.
1274 // TODO(hbono): we should verify messages to be sent from the back-end. 1273 // TODO(hbono): we should verify messages to be sent from the back-end.
1275 view()->UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_NON_IME); 1274 view()->UpdateTextInputState();
1276 ProcessPendingMessages(); 1275 ProcessPendingMessages();
1277 render_thread_->sink().ClearMessages(); 1276 render_thread_->sink().ClearMessages();
1278 1277
1279 if (ime_message->result) { 1278 if (ime_message->result) {
1280 // Retrieve the content of this page and compare it with the expected 1279 // Retrieve the content of this page and compare it with the expected
1281 // result. 1280 // result.
1282 const int kMaxOutputCharacters = 128; 1281 const int kMaxOutputCharacters = 128;
1283 base::string16 output = WebFrameContentDumper::dumpWebViewAsText( 1282 base::string16 output = WebFrameContentDumper::dumpWebViewAsText(
1284 view()->GetWebView(), kMaxOutputCharacters); 1283 view()->GetWebView(), kMaxOutputCharacters);
1285 EXPECT_EQ(base::WideToUTF16(ime_message->result), output); 1284 EXPECT_EQ(base::WideToUTF16(ime_message->result), output);
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 ExpectPauseAndResume(3); 2555 ExpectPauseAndResume(3);
2557 blink::WebScriptSource source2( 2556 blink::WebScriptSource source2(
2558 WebString::fromUTF8("function func2() { func1(); }; func2();")); 2557 WebString::fromUTF8("function func2() { func1(); }; func2();"));
2559 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); 2558 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1);
2560 2559
2561 EXPECT_FALSE(IsPaused()); 2560 EXPECT_FALSE(IsPaused());
2562 Detach(); 2561 Detach();
2563 } 2562 }
2564 2563
2565 } // namespace content 2564 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698