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

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

Issue 2508793002: Make exceptionState parameter of Document::createElement() to have default value (Closed)
Patch Set: 2016-11-16T15:26:06 Created 4 years, 1 month 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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 frame().editor().insertLineBreak(); 801 frame().editor().insertLineBreak();
802 EXPECT_STREQ("he\nllo", div->innerText().utf8().data()); 802 EXPECT_STREQ("he\nllo", div->innerText().utf8().data());
803 EXPECT_EQ(3u, controller().getSelectionOffsets().start()); 803 EXPECT_EQ(3u, controller().getSelectionOffsets().start());
804 EXPECT_EQ(3u, controller().getSelectionOffsets().end()); 804 EXPECT_EQ(3u, controller().getSelectionOffsets().end());
805 } 805 }
806 806
807 TEST_F(InputMethodControllerTest, CompositionInputEventIsComposing) { 807 TEST_F(InputMethodControllerTest, CompositionInputEventIsComposing) {
808 document().settings()->setScriptEnabled(true); 808 document().settings()->setScriptEnabled(true);
809 Element* editable = insertHTMLElement( 809 Element* editable = insertHTMLElement(
810 "<div id='sample' contentEditable='true'></div>", "sample"); 810 "<div id='sample' contentEditable='true'></div>", "sample");
811 Element* script = document().createElement("script", ASSERT_NO_EXCEPTION); 811 Element* script = document().createElement("script");
812 script->setInnerHTML( 812 script->setInnerHTML(
813 "document.getElementById('sample').addEventListener('beforeinput', " 813 "document.getElementById('sample').addEventListener('beforeinput', "
814 "function(event) {" 814 "function(event) {"
815 " document.title = `beforeinput.isComposing:${event.isComposing};`;" 815 " document.title = `beforeinput.isComposing:${event.isComposing};`;"
816 "});" 816 "});"
817 "document.getElementById('sample').addEventListener('input', " 817 "document.getElementById('sample').addEventListener('input', "
818 "function(event) {" 818 "function(event) {"
819 " document.title += `input.isComposing:${event.isComposing};`;" 819 " document.title += `input.isComposing:${event.isComposing};`;"
820 "});", 820 "});",
821 ASSERT_NO_EXCEPTION); 821 ASSERT_NO_EXCEPTION);
(...skipping 14 matching lines...) Expand all
836 controller().finishComposingText(InputMethodController::KeepSelection); 836 controller().finishComposingText(InputMethodController::KeepSelection);
837 // Last pair of InputEvent should also be inside composition scope. 837 // Last pair of InputEvent should also be inside composition scope.
838 EXPECT_STREQ("beforeinput.isComposing:true;input.isComposing:true;", 838 EXPECT_STREQ("beforeinput.isComposing:true;input.isComposing:true;",
839 document().title().utf8().data()); 839 document().title().utf8().data());
840 } 840 }
841 841
842 TEST_F(InputMethodControllerTest, CompositionInputEventData) { 842 TEST_F(InputMethodControllerTest, CompositionInputEventData) {
843 document().settings()->setScriptEnabled(true); 843 document().settings()->setScriptEnabled(true);
844 Element* editable = insertHTMLElement( 844 Element* editable = insertHTMLElement(
845 "<div id='sample' contentEditable='true'></div>", "sample"); 845 "<div id='sample' contentEditable='true'></div>", "sample");
846 Element* script = document().createElement("script", ASSERT_NO_EXCEPTION); 846 Element* script = document().createElement("script");
847 script->setInnerHTML( 847 script->setInnerHTML(
848 "document.getElementById('sample').addEventListener('beforeinput', " 848 "document.getElementById('sample').addEventListener('beforeinput', "
849 "function(event) {" 849 "function(event) {"
850 " document.title = `beforeinput.data:${event.data};`;" 850 " document.title = `beforeinput.data:${event.data};`;"
851 "});" 851 "});"
852 "document.getElementById('sample').addEventListener('input', " 852 "document.getElementById('sample').addEventListener('input', "
853 "function(event) {" 853 "function(event) {"
854 " document.title += `input.data:${event.data};`;" 854 " document.title += `input.data:${event.data};`;"
855 "});", 855 "});",
856 ASSERT_NO_EXCEPTION); 856 ASSERT_NO_EXCEPTION);
(...skipping 15 matching lines...) Expand all
872 EXPECT_STREQ("beforeinput.data:i;input.data:i;", 872 EXPECT_STREQ("beforeinput.data:i;input.data:i;",
873 document().title().utf8().data()); 873 document().title().utf8().data());
874 874
875 document().setTitle(emptyString()); 875 document().setTitle(emptyString());
876 controller().finishComposingText(InputMethodController::KeepSelection); 876 controller().finishComposingText(InputMethodController::KeepSelection);
877 EXPECT_STREQ("beforeinput.data:ni;input.data:ni;", 877 EXPECT_STREQ("beforeinput.data:ni;input.data:ni;",
878 document().title().utf8().data()); 878 document().title().utf8().data());
879 } 879 }
880 880
881 } // namespace blink 881 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698