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

Unified Diff: third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp

Issue 2857173003: Remove DocumentMarkerController::MarkersInRange() (Closed)
Patch Set: Remove MarkersInRange() Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
index 3857308030c399a5366c91b2d15f82efec4b6eef..b9affba0a7dd1e38e424451762005b56dfa0dda4 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
@@ -32,6 +32,7 @@ class InputMethodControllerTest : public ::testing::Test {
Element* InsertHTMLElement(const char* element_code, const char* element_id);
void CreateHTMLWithCompositionInputEventListeners();
void CreateHTMLWithCompositionEndEventListener(const SelectionType);
+ int NumMarkersInRange(const EphemeralRange&, DocumentMarker::MarkerTypes);
private:
void SetUp() override;
@@ -117,6 +118,17 @@ void InputMethodControllerTest::CreateHTMLWithCompositionEndEventListener(
editable->focus();
}
+int InputMethodControllerTest::NumMarkersInRange(
+ const EphemeralRange& range,
+ DocumentMarker::MarkerTypes marker_types) {
+ int node_count = 0;
+ for (Node& node : range.Nodes()) {
+ node_count +=
+ GetDocument().Markers().MarkersFor(&node, marker_types).size();
+ }
+ return node_count;
+}
+
TEST_F(InputMethodControllerTest, BackspaceFromEndOfInput) {
HTMLInputElement* input =
toHTMLInputElement(InsertHTMLElement("<input id='sample'>", "sample"));
@@ -1408,16 +1420,10 @@ TEST_F(InputMethodControllerTest,
ASSERT_EQ(1u, GetDocument().Markers().Markers().size());
// Verify composition underline shows up on the second line, not the first
- ASSERT_EQ(0u, GetDocument()
- .Markers()
- .MarkersInRange(PlainTextRange(0, 5).CreateRange(*div),
- DocumentMarker::AllMarkers())
- .size());
- ASSERT_EQ(1u, GetDocument()
- .Markers()
- .MarkersInRange(PlainTextRange(6, 11).CreateRange(*div),
- DocumentMarker::AllMarkers())
- .size());
+ ASSERT_EQ(0, NumMarkersInRange(PlainTextRange(0, 5).CreateRange(*div),
+ DocumentMarker::AllMarkers()));
+ ASSERT_EQ(1, NumMarkersInRange(PlainTextRange(6, 11).CreateRange(*div),
+ DocumentMarker::AllMarkers()));
// Verify marker has correct start/end offsets (measured from the beginning
// of the node, which is the beginning of the line)

Powered by Google App Engine
This is Rietveld 408576698