OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 | 6 |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/test/render_view_test.h" | 10 #include "chrome/test/render_view_test.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 render_thread_.sink().ClearMessages(); | 162 render_thread_.sink().ClearMessages(); |
163 | 163 |
164 // Update the IME status and verify if our IME backend sends an IPC message | 164 // Update the IME status and verify if our IME backend sends an IPC message |
165 // to activate IMEs. | 165 // to activate IMEs. |
166 view_->UpdateInputMethod(); | 166 view_->UpdateInputMethod(); |
167 const IPC::Message* msg = render_thread_.sink().GetMessageAt(0); | 167 const IPC::Message* msg = render_thread_.sink().GetMessageAt(0); |
168 EXPECT_TRUE(msg != NULL); | 168 EXPECT_TRUE(msg != NULL); |
169 EXPECT_EQ(ViewHostMsg_ImeUpdateTextInputState::ID, msg->type()); | 169 EXPECT_EQ(ViewHostMsg_ImeUpdateTextInputState::ID, msg->type()); |
170 ViewHostMsg_ImeUpdateTextInputState::Param params; | 170 ViewHostMsg_ImeUpdateTextInputState::Param params; |
171 ViewHostMsg_ImeUpdateTextInputState::Read(msg, ¶ms); | 171 ViewHostMsg_ImeUpdateTextInputState::Read(msg, ¶ms); |
172 EXPECT_EQ(params.a, WebKit::WebTextInputTypeText); | 172 EXPECT_EQ(params.a, ui::TEXT_INPUT_TYPE_TEXT); |
173 EXPECT_TRUE(params.b.x() > 0 && params.b.y() > 0); | 173 EXPECT_EQ(params.b, true); |
| 174 EXPECT_TRUE(params.c.x() > 0 && params.c.y() > 0); |
174 | 175 |
175 // Move the input focus to the second <input> element, where we should | 176 // Move the input focus to the second <input> element, where we should |
176 // de-activate IMEs. | 177 // de-activate IMEs. |
177 ExecuteJavaScript("document.getElementById('test2').focus();"); | 178 ExecuteJavaScript("document.getElementById('test2').focus();"); |
178 ProcessPendingMessages(); | 179 ProcessPendingMessages(); |
179 render_thread_.sink().ClearMessages(); | 180 render_thread_.sink().ClearMessages(); |
180 | 181 |
181 // Update the IME status and verify if our IME backend sends an IPC message | 182 // Update the IME status and verify if our IME backend sends an IPC message |
182 // to de-activate IMEs. | 183 // to de-activate IMEs. |
183 view_->UpdateInputMethod(); | 184 view_->UpdateInputMethod(); |
184 msg = render_thread_.sink().GetMessageAt(0); | 185 msg = render_thread_.sink().GetMessageAt(0); |
185 EXPECT_TRUE(msg != NULL); | 186 EXPECT_TRUE(msg != NULL); |
186 EXPECT_EQ(ViewHostMsg_ImeUpdateTextInputState::ID, msg->type()); | 187 EXPECT_EQ(ViewHostMsg_ImeUpdateTextInputState::ID, msg->type()); |
187 ViewHostMsg_ImeUpdateTextInputState::Read(msg, ¶ms); | 188 ViewHostMsg_ImeUpdateTextInputState::Read(msg, ¶ms); |
188 EXPECT_EQ(params.a, WebKit::WebTextInputTypePassword); | 189 EXPECT_EQ(params.a, ui::TEXT_INPUT_TYPE_PASSWORD); |
189 } | 190 } |
190 } | 191 } |
191 | 192 |
192 // Test that our IME backend can compose CJK words. | 193 // Test that our IME backend can compose CJK words. |
193 // Our IME front-end sends many platform-independent messages to the IME backend | 194 // Our IME front-end sends many platform-independent messages to the IME backend |
194 // while it composes CJK words. This test sends the minimal messages captured | 195 // while it composes CJK words. This test sends the minimal messages captured |
195 // on my local environment directly to the IME backend to verify if the backend | 196 // on my local environment directly to the IME backend to verify if the backend |
196 // can compose CJK words without any problems. | 197 // can compose CJK words without any problems. |
197 // This test uses an array of command sets because an IME composotion does not | 198 // This test uses an array of command sets because an IME composotion does not |
198 // only depends on IME events, but also depends on window events, e.g. moving | 199 // only depends on IME events, but also depends on window events, e.g. moving |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 // Frame should stay in view-source mode. | 770 // Frame should stay in view-source mode. |
770 EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); | 771 EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); |
771 } | 772 } |
772 | 773 |
773 // Regression test for http://crbug.com/41562 | 774 // Regression test for http://crbug.com/41562 |
774 TEST_F(RenderViewTest, UpdateTargetURLWithInvalidURL) { | 775 TEST_F(RenderViewTest, UpdateTargetURLWithInvalidURL) { |
775 const GURL invalid_gurl("http://"); | 776 const GURL invalid_gurl("http://"); |
776 view_->setMouseOverURL(WebKit::WebURL(invalid_gurl)); | 777 view_->setMouseOverURL(WebKit::WebURL(invalid_gurl)); |
777 EXPECT_EQ(invalid_gurl, view_->target_url_); | 778 EXPECT_EQ(invalid_gurl, view_->target_url_); |
778 } | 779 } |
OLD | NEW |