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

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp

Issue 1604783002: ALL-IN-ONE: Optimization to previousBoundary() and nextBoundary() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@progressive_accumulator
Patch Set: Created 4 years, 11 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/iterators/TextIteratorTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
index 7dc224ac57b6aeac6229f93129714f9311aaf28a..4e632d0e75c8c95ea20da45bce96fa6c7207d857 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
@@ -407,42 +407,42 @@ TEST_F(TextIteratorTest, copyTextTo)
EphemeralRangeTemplate<EditingStrategy> range1(EphemeralRangeTemplate<EditingStrategy>::rangeOfContents(*host));
TextIteratorAlgorithm<EditingStrategy> iter1(range1.startPosition(), range1.endPosition());
- Vector<UChar> output1;
+ ForwardsTextBuffer output1;
iter1.copyTextTo(output1, 0, 2);
- EXPECT_EQ("on", String(output1)) << String::format(message, 1, "on").utf8().data();
+ EXPECT_EQ("on", String(output1.data(), output1.size())) << String::format(message, 1, "on").utf8().data();
iter1.copyTextTo(output1, 2, 1);
- EXPECT_EQ("one", String(output1)) << String::format(message, 1, "one").utf8().data();
+ EXPECT_EQ("one", String(output1.data(), output1.size())) << String::format(message, 1, "one").utf8().data();
iter1.advance();
iter1.copyTextTo(output1, 0, 1);
- EXPECT_EQ("onet", String(output1)) << String::format(message, 1, "onet").utf8().data();
+ EXPECT_EQ("onet", String(output1.data(), output1.size())) << String::format(message, 1, "onet").utf8().data();
iter1.copyTextTo(output1, 1, 2);
- EXPECT_EQ("onetwo", String(output1)) << String::format(message, 1, "onetwo").utf8().data();
+ EXPECT_EQ("onetwo", String(output1.data(), output1.size())) << String::format(message, 1, "onetwo").utf8().data();
EphemeralRangeTemplate<EditingInComposedTreeStrategy> range2(EphemeralRangeTemplate<EditingInComposedTreeStrategy>::rangeOfContents(*host));
TextIteratorAlgorithm<EditingInComposedTreeStrategy> iter2(range2.startPosition(), range2.endPosition());
- Vector<UChar> output2;
+ ForwardsTextBuffer output2;
iter2.copyTextTo(output2, 0, 3);
- EXPECT_EQ("thr", String(output2)) << String::format(message, 2, "thr").utf8().data();
+ EXPECT_EQ("thr", String(output2.data(), output2.size())) << String::format(message, 2, "thr").utf8().data();
iter2.copyTextTo(output2, 3, 3);
- EXPECT_EQ("three ", String(output2)) << String::format(message, 2, "three ").utf8().data();
+ EXPECT_EQ("three ", String(output2.data(), output2.size())) << String::format(message, 2, "three ").utf8().data();
iter2.advance();
iter2.copyTextTo(output2, 0, 2);
- EXPECT_EQ("three tw", String(output2)) << String::format(message, 2, "three tw").utf8().data();
+ EXPECT_EQ("three tw", String(output2.data(), output2.size())) << String::format(message, 2, "three tw").utf8().data();
iter2.copyTextTo(output2, 2, 1);
- EXPECT_EQ("three two", String(output2)) << String::format(message, 2, "three two").utf8().data();
+ EXPECT_EQ("three two", String(output2.data(), output2.size())) << String::format(message, 2, "three two").utf8().data();
iter2.advance();
iter2.copyTextTo(output2, 0, 1);
- EXPECT_EQ("three two ", String(output2)) << String::format(message, 2, "three two ").utf8().data();
+ EXPECT_EQ("three two ", String(output2.data(), output2.size())) << String::format(message, 2, "three two ").utf8().data();
iter2.advance();
iter2.copyTextTo(output2, 0, 1);
- EXPECT_EQ("three two o", String(output2)) << String::format(message, 2, "three two o").utf8().data();
+ EXPECT_EQ("three two o", String(output2.data(), output2.size())) << String::format(message, 2, "three two o").utf8().data();
iter2.copyTextTo(output2, 1, 2);
- EXPECT_EQ("three two one", String(output2)) << String::format(message, 2, "three two one").utf8().data();
+ EXPECT_EQ("three two one", String(output2.data(), output2.size())) << String::format(message, 2, "three two one").utf8().data();
iter2.advance();
iter2.copyTextTo(output2, 0, 2);
- EXPECT_EQ("three two one z", String(output2)) << String::format(message, 2, "three two one z").utf8().data();
+ EXPECT_EQ("three two one z", String(output2.data(), output2.size())) << String::format(message, 2, "three two one z").utf8().data();
iter2.copyTextTo(output2, 2, 3);
- EXPECT_EQ("three two one zero", String(output2)) << String::format(message, 2, "three two one zero").utf8().data();
+ EXPECT_EQ("three two one zero", String(output2.data(), output2.size())) << String::format(message, 2, "three two one zero").utf8().data();
}
TEST_F(TextIteratorTest, characterAt)
@@ -503,7 +503,7 @@ TEST_F(TextIteratorTest, CopyWholeCodePoints)
EphemeralRange range(EphemeralRange::rangeOfContents(document()));
TextIterator iter(range.startPosition(), range.endPosition());
- Vector<UChar> buffer;
+ ForwardsTextBuffer buffer;
EXPECT_EQ(2, iter.copyTextTo(buffer, 0, 1)) << "Should emit 2 UChars for 'U+13000'.";
EXPECT_EQ(4, iter.copyTextTo(buffer, 2, 3)) << "Should emit 4 UChars for 'U+13001U+13002'.";
EXPECT_EQ(3, iter.copyTextTo(buffer, 6, 2)) << "Should emit 3 UChars for ' U+13140'.";

Powered by Google App Engine
This is Rietveld 408576698