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

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

Issue 2692093003: Rewrite DocumentMarkerController to use SynchronousMutationObserver (Closed)
Patch Set: Fx tests to match current behavior of master Created 3 years, 10 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 6731759d750b7ba294c126fbbf9f2573e0cf8a90..f272b4dce1d1cb2213051ff7e89cdadac6dfbb2d 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
@@ -1485,15 +1485,12 @@ TEST_F(InputMethodControllerTest, WhitespaceFixupAroundMarker2) {
ASSERT_STREQ(" text ", div->innerHTML().utf8().data());
- // Check that the marker was split when the space at the beginning was
- // converted to an nbsp
- EXPECT_EQ(2u, document().markers().markers().size());
+ // Check that the marker is still attached to " text" and includes the space
+ // before "text" but not the space after
+ EXPECT_EQ(1u, document().markers().markers().size());
ASSERT_STREQ(
- "\xC2\xA0", // UTF-8 for an nbsp
+ "\xC2\xA0text",
getMarkedText(document().markers(), div->firstChild(), 0).utf8().data());
- ASSERT_STREQ(
- "text",
- getMarkedText(document().markers(), div->firstChild(), 1).utf8().data());
}
TEST_F(InputMethodControllerTest, WhitespaceFixupAroundMarker3) {
@@ -1517,15 +1514,12 @@ TEST_F(InputMethodControllerTest, WhitespaceFixupAroundMarker3) {
ASSERT_STREQ(" text ", div->innerHTML().utf8().data());
- // Check that the marker was split when the space at the end was
- // converted to an nbsp
- EXPECT_EQ(2u, document().markers().markers().size());
+ // Check that the marker is still attached to "text " and includes the space
+ // after "text" but not the space before
+ EXPECT_EQ(1u, document().markers().markers().size());
ASSERT_STREQ(
- "text",
+ "text\xC2\xA0",
getMarkedText(document().markers(), div->firstChild(), 0).utf8().data());
- ASSERT_STREQ(
- "\xC2\xA0", // UTF-8 for an nbsp
- getMarkedText(document().markers(), div->firstChild(), 1).utf8().data());
}
TEST_F(InputMethodControllerTest, WhitespaceFixupAroundMarker4) {
@@ -1550,18 +1544,12 @@ TEST_F(InputMethodControllerTest, WhitespaceFixupAroundMarker4) {
ASSERT_STREQ(" text ", div->innerHTML().utf8().data());
- // Check that the marker was split into three pieces when the two spaces were
- // converted to nbsps
- EXPECT_EQ(3u, document().markers().markers().size());
+ // Check that the marker is still attached to " text " and includes both the
+ // space before "text" and the space after
+ EXPECT_EQ(1u, document().markers().markers().size());
ASSERT_STREQ(
- "\xC2\xA0", // UTF-8 for an nbsp
+ "\xC2\xA0text\xC2\xA0",
getMarkedText(document().markers(), div->firstChild(), 0).utf8().data());
- ASSERT_STREQ(
- "text",
- getMarkedText(document().markers(), div->firstChild(), 1).utf8().data());
- ASSERT_STREQ(
- "\xC2\xA0", // UTF-8 for an nbsp
- getMarkedText(document().markers(), div->firstChild(), 2).utf8().data());
}
TEST_F(InputMethodControllerTest, ReplaceStartOfMarker) {
@@ -1581,11 +1569,10 @@ TEST_F(InputMethodControllerTest, ReplaceStartOfMarker) {
ASSERT_STREQ("Original text", div->innerHTML().utf8().data());
- // Verify marker is under "al text"
- // ("Initial" and "Original" have "al" as a common suffix)
+ // Verify marker is under "Original text"
EXPECT_EQ(1u, document().markers().markers().size());
ASSERT_STREQ(
- "al text",
+ "Original text",
getMarkedText(document().markers(), div->firstChild(), 0).utf8().data());
}
@@ -1631,10 +1618,10 @@ TEST_F(InputMethodControllerTest, ReplaceEndOfMarker) {
ASSERT_STREQ("Initial string", div->innerHTML().utf8().data());
- // Verify marker is under "Initial "
+ // Verify marker is under "Initial string"
EXPECT_EQ(1u, document().markers().markers().size());
ASSERT_STREQ(
- "Initial ",
+ "Initial string",
getMarkedText(document().markers(), div->firstChild(), 0).utf8().data());
}
@@ -1680,8 +1667,11 @@ TEST_F(InputMethodControllerTest, ReplaceEntireMarker) {
ASSERT_STREQ("Initial string", div->innerHTML().utf8().data());
- // Verify marker was removed
- EXPECT_EQ(0u, document().markers().markers().size());
+ // Verify marker is under "string"
+ EXPECT_EQ(1u, document().markers().markers().size());
+ ASSERT_STREQ(
+ "string",
+ getMarkedText(document().markers(), div->firstChild(), 0).utf8().data());
}
TEST_F(InputMethodControllerTest, ReplaceTextWithMarkerAtBeginning) {

Powered by Google App Engine
This is Rietveld 408576698