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 a4e45f4da1d2d3a29eaa6282c02c4c29d5507b6e..382433bdc65d1a5df0acb92e64899cc1cac8d15f 100644 |
--- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp |
+++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp |
@@ -1508,15 +1508,12 @@ TEST_F(InputMethodControllerTest, |
controller().setCompositionFromExistingText(emptyUnderlines, 6, 10); |
controller().commitText(String(""), emptyUnderlines, 0); |
- // Check that the marker was split when the space at the beginning was |
- // converted to an nbsp |
- EXPECT_EQ(2u, document().markers().markers().size()); |
- EXPECT_STREQ( |
- "\xC2\xA0", // UTF-8 for an nbsp |
+ // 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\xA0text", |
getMarkedText(document().markers(), div->firstChild(), 0).utf8().data()); |
- EXPECT_STREQ( |
- "text", |
- getMarkedText(document().markers(), div->firstChild(), 1).utf8().data()); |
} |
TEST_F(InputMethodControllerTest, |
@@ -1539,15 +1536,12 @@ TEST_F(InputMethodControllerTest, |
controller().setCompositionFromExistingText(emptyUnderlines, 6, 10); |
controller().commitText(String(""), emptyUnderlines, 0); |
- // Check that the marker was split when the space at the end was |
- // converted to an nbsp |
- EXPECT_EQ(2u, document().markers().markers().size()); |
- EXPECT_STREQ( |
- "text", |
+ // 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\xC2\xA0", |
getMarkedText(document().markers(), div->firstChild(), 0).utf8().data()); |
- EXPECT_STREQ( |
- "\xC2\xA0", // UTF-8 for an nbsp |
- getMarkedText(document().markers(), div->firstChild(), 1).utf8().data()); |
} |
TEST_F(InputMethodControllerTest, |
@@ -1571,18 +1565,12 @@ TEST_F(InputMethodControllerTest, |
controller().setCompositionFromExistingText(emptyUnderlines, 6, 10); |
controller().commitText(String(""), emptyUnderlines, 0); |
- // Check that the marker was split into three pieces when the two spaces were |
- // converted to nbsps |
- EXPECT_EQ(3u, document().markers().markers().size()); |
- EXPECT_STREQ( |
- "\xC2\xA0", // UTF-8 for an nbsp |
+ // 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\xA0text\xC2\xA0", |
getMarkedText(document().markers(), div->firstChild(), 0).utf8().data()); |
- EXPECT_STREQ( |
- "text", |
- getMarkedText(document().markers(), div->firstChild(), 1).utf8().data()); |
- EXPECT_STREQ( |
- "\xC2\xA0", // UTF-8 for an nbsp |
- getMarkedText(document().markers(), div->firstChild(), 2).utf8().data()); |
} |
TEST_F(InputMethodControllerTest, Marker_ReplaceStartOfMarker) { |
@@ -1600,11 +1588,10 @@ TEST_F(InputMethodControllerTest, Marker_ReplaceStartOfMarker) { |
controller().setCompositionFromExistingText(emptyUnderlines, 0, 7); |
controller().commitText(String("Original"), emptyUnderlines, 0); |
- // 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()); |
- EXPECT_STREQ( |
- "al text", |
+ ASSERT_STREQ( |
+ "Original text", |
getMarkedText(document().markers(), div->firstChild(), 0).utf8().data()); |
} |
@@ -1646,10 +1633,10 @@ TEST_F(InputMethodControllerTest, Marker_ReplaceEndOfMarker) { |
controller().setCompositionFromExistingText(emptyUnderlines, 8, 12); |
controller().commitText(String("string"), emptyUnderlines, 0); |
- // Verify marker is under "Initial " |
+ // Verify marker is under "Initial string" |
EXPECT_EQ(1u, document().markers().markers().size()); |
- EXPECT_STREQ( |
- "Initial ", |
+ ASSERT_STREQ( |
+ "Initial string", |
getMarkedText(document().markers(), div->firstChild(), 0).utf8().data()); |
} |
@@ -1693,8 +1680,11 @@ TEST_F(InputMethodControllerTest, Marker_ReplaceEntireMarker) { |
controller().setCompositionFromExistingText(emptyUnderlines, 8, 12); |
controller().commitText(String("string"), emptyUnderlines, 0); |
- // 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, Marker_ReplaceTextWithMarkerAtBeginning) { |