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

Side by Side Diff: third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp

Issue 2558643003: [InputEvent] Move 'beforeinput' logic into |CompositeEditCommand::willApplyEditing()| (3/3) (Closed)
Patch Set: yosin's review, fix nits Created 4 years 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 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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 underlines.append(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0)); 946 underlines.append(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0));
947 947
948 document().setTitle(emptyString()); 948 document().setTitle(emptyString());
949 controller().setComposition("hello", underlines, 5, 5); 949 controller().setComposition("hello", underlines, 5, 5);
950 EXPECT_STREQ("beforeinput.data:hello;input.data:hello;", 950 EXPECT_STREQ("beforeinput.data:hello;input.data:hello;",
951 document().title().utf8().data()); 951 document().title().utf8().data());
952 952
953 // Delete the existing composition. 953 // Delete the existing composition.
954 document().setTitle(emptyString()); 954 document().setTitle(emptyString());
955 controller().setComposition("", underlines, 0, 0); 955 controller().setComposition("", underlines, 0, 0);
956 EXPECT_STREQ("beforeinput.data:;compositionend.data:;", 956 EXPECT_STREQ("beforeinput.data:null;input.data:null;compositionend.data:;",
957 document().title().utf8().data()); 957 document().title().utf8().data());
958 } 958 }
959 959
960 TEST_F(InputMethodControllerTest, CompositionInputEventForInsert) { 960 TEST_F(InputMethodControllerTest, CompositionInputEventForInsert) {
961 createHTMLWithCompositionInputEventListeners(); 961 createHTMLWithCompositionInputEventListeners();
962 962
963 // Simulate composition in the |contentEditable|. 963 // Simulate composition in the |contentEditable|.
964 Vector<CompositionUnderline> underlines; 964 Vector<CompositionUnderline> underlines;
965 underlines.append(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0)); 965 underlines.append(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0));
966 966
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 EXPECT_EQ(WebTextInputTypeNone, controller().textInputType()); 1077 EXPECT_EQ(WebTextInputTypeNone, controller().textInputType());
1078 1078
1079 document().getElementById("b")->focus(); 1079 document().getElementById("b")->focus();
1080 EXPECT_EQ(WebTextInputTypeTelephone, controller().textInputType()); 1080 EXPECT_EQ(WebTextInputTypeTelephone, controller().textInputType());
1081 1081
1082 controller().finishComposingText(InputMethodController::KeepSelection); 1082 controller().finishComposingText(InputMethodController::KeepSelection);
1083 EXPECT_EQ(WebTextInputTypeTelephone, controller().textInputType()); 1083 EXPECT_EQ(WebTextInputTypeTelephone, controller().textInputType());
1084 } 1084 }
1085 1085
1086 } // namespace blink 1086 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698