OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 | 510 |
511 static const UChar* invalidUStrings[] = { invalid1, invalid2, invalid3 }; | 511 static const UChar* invalidUStrings[] = { invalid1, invalid2, invalid3 }; |
512 | 512 |
513 for (size_t i = 0; i < WTF_ARRAY_LENGTH(invalidUStrings); ++i) { | 513 for (size_t i = 0; i < WTF_ARRAY_LENGTH(invalidUStrings); ++i) { |
514 String invalidTarget(invalidUStrings[i]); | 514 String invalidTarget(invalidUStrings[i]); |
515 RefPtrWillBeRawPtr<Range> actualRange = findPlainText(range.get(), inval
idTarget, 0); | 515 RefPtrWillBeRawPtr<Range> actualRange = findPlainText(range.get(), inval
idTarget, 0); |
516 EXPECT_TRUE(areRangesEqual(expectedRange.get(), actualRange.get())); | 516 EXPECT_TRUE(areRangesEqual(expectedRange.get(), actualRange.get())); |
517 } | 517 } |
518 } | 518 } |
519 | 519 |
| 520 TEST_F(TextIteratorTest, EmitsReplacementCharForInput) |
| 521 { |
| 522 static const char* bodyContent = |
| 523 "<div contenteditable=\"true\">" |
| 524 "Before" |
| 525 "<img src=\"foo.png\">" |
| 526 "After" |
| 527 "</div>"; |
| 528 // "Before". |
| 529 static const UChar expectedRawString1[] = { 0x42, 0x65, 0x66, 0x6F, 0x72, 0x
65, 0 }; |
| 530 // Object replacement char. |
| 531 static const UChar expectedRawString2[] = { 0xFFFC, 0 }; |
| 532 // "After". |
| 533 static const UChar expectedRawString3[] = { 0x41, 0x66, 0x74, 0x65, 0x72, 0
}; |
| 534 static const UChar* expectedRawStrings[] = { expectedRawString1, expectedRaw
String2, expectedRawString3 }; |
| 535 Vector<String> expectedTextChunks; |
| 536 expectedTextChunks.append(expectedRawStrings, WTF_ARRAY_LENGTH(expectedRawSt
rings)); |
| 537 |
| 538 setBodyInnerHTML(bodyContent); |
| 539 EXPECT_EQ(expectedTextChunks, iterate(TextIteratorEmitsObjectReplacementChar
acter)); |
520 } | 540 } |
| 541 |
| 542 } |
OLD | NEW |