| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/editing/InputMethodController.h" | 5 #include "core/editing/InputMethodController.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
| 9 #include "core/dom/Range.h" | 9 #include "core/dom/Range.h" |
| 10 #include "core/editing/Editor.h" | 10 #include "core/editing/Editor.h" |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 underlines.push_back(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0)); | 983 underlines.push_back(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0)); |
| 984 | 984 |
| 985 document().setTitle(emptyString()); | 985 document().setTitle(emptyString()); |
| 986 controller().setComposition("hello", underlines, 5, 5); | 986 controller().setComposition("hello", underlines, 5, 5); |
| 987 EXPECT_STREQ("beforeinput.data:hello;input.data:hello;", | 987 EXPECT_STREQ("beforeinput.data:hello;input.data:hello;", |
| 988 document().title().utf8().data()); | 988 document().title().utf8().data()); |
| 989 | 989 |
| 990 // Delete the existing composition. | 990 // Delete the existing composition. |
| 991 document().setTitle(emptyString()); | 991 document().setTitle(emptyString()); |
| 992 controller().setComposition("", underlines, 0, 0); | 992 controller().setComposition("", underlines, 0, 0); |
| 993 EXPECT_STREQ("beforeinput.data:;compositionend.data:;", | 993 EXPECT_STREQ("beforeinput.data:null;input.data:null;compositionend.data:;", |
| 994 document().title().utf8().data()); | 994 document().title().utf8().data()); |
| 995 } | 995 } |
| 996 | 996 |
| 997 TEST_F(InputMethodControllerTest, CompositionInputEventForInsert) { | 997 TEST_F(InputMethodControllerTest, CompositionInputEventForInsert) { |
| 998 createHTMLWithCompositionInputEventListeners(); | 998 createHTMLWithCompositionInputEventListeners(); |
| 999 | 999 |
| 1000 // Simulate composition in the |contentEditable|. | 1000 // Simulate composition in the |contentEditable|. |
| 1001 Vector<CompositionUnderline> underlines; | 1001 Vector<CompositionUnderline> underlines; |
| 1002 underlines.push_back(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0)); | 1002 underlines.push_back(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0)); |
| 1003 | 1003 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 EXPECT_EQ(WebTextInputTypeNone, controller().textInputType()); | 1140 EXPECT_EQ(WebTextInputTypeNone, controller().textInputType()); |
| 1141 | 1141 |
| 1142 document().getElementById("b")->focus(); | 1142 document().getElementById("b")->focus(); |
| 1143 EXPECT_EQ(WebTextInputTypeTelephone, controller().textInputType()); | 1143 EXPECT_EQ(WebTextInputTypeTelephone, controller().textInputType()); |
| 1144 | 1144 |
| 1145 controller().finishComposingText(InputMethodController::KeepSelection); | 1145 controller().finishComposingText(InputMethodController::KeepSelection); |
| 1146 EXPECT_EQ(WebTextInputTypeTelephone, controller().textInputType()); | 1146 EXPECT_EQ(WebTextInputTypeTelephone, controller().textInputType()); |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 } // namespace blink | 1149 } // namespace blink |
| OLD | NEW |