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

Side by Side Diff: Source/core/editing/iterators/TextIteratorTest.cpp

Issue 1214293002: Get rid of findPlainText() with Range parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-06-30T15:11:38 Get rid of unused function collapsedToBoundary() Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « Source/core/editing/iterators/TextIterator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 }; 383 };
384 // A trailing surrogate followed by a lead surrogate (U+DC03 U+D901). 384 // A trailing surrogate followed by a lead surrogate (U+DC03 U+D901).
385 static const UChar invalid3[] = { 385 static const UChar invalid3[] = {
386 0xd800u, 0xdc00u, 0x0061u, 0xdc03u, 0xd901u, 0xccadu, 0 386 0xd800u, 0xdc00u, 0x0061u, 0xdc03u, 0xd901u, 0xccadu, 0
387 }; 387 };
388 388
389 static const UChar* invalidUStrings[] = { invalid1, invalid2, invalid3 }; 389 static const UChar* invalidUStrings[] = { invalid1, invalid2, invalid3 };
390 390
391 for (size_t i = 0; i < WTF_ARRAY_LENGTH(invalidUStrings); ++i) { 391 for (size_t i = 0; i < WTF_ARRAY_LENGTH(invalidUStrings); ++i) {
392 String invalidTarget(invalidUStrings[i]); 392 String invalidTarget(invalidUStrings[i]);
393 RefPtrWillBeRawPtr<Range> actualRange = findPlainText(range.get(), inval idTarget, 0); 393 Position foundStart;
394 Position foundEnd;
395 findPlainText(range->startPosition(), range->endPosition(), invalidTarge t, 0, foundStart, foundEnd);
396 RefPtrWillBeRawPtr<Range> actualRange = Range::create(document(), foundS tart, foundEnd);
394 EXPECT_TRUE(areRangesEqual(expectedRange.get(), actualRange.get())); 397 EXPECT_TRUE(areRangesEqual(expectedRange.get(), actualRange.get()));
395 } 398 }
396 } 399 }
397 400
398 TEST_F(TextIteratorTest, EmitsReplacementCharForInput) 401 TEST_F(TextIteratorTest, EmitsReplacementCharForInput)
399 { 402 {
400 static const char* bodyContent = 403 static const char* bodyContent =
401 "<div contenteditable='true'>" 404 "<div contenteditable='true'>"
402 "Before" 405 "Before"
403 "<img src='foo.png'>" 406 "<img src='foo.png'>"
(...skipping 26 matching lines...) Expand all
430 433
431 Node* divNode = document().getElementById("div"); 434 Node* divNode = document().getElementById("div");
432 RefPtrWillBeRawPtr<Range> entireRange = Range::create(document(), divNode, 0 , divNode, 3); 435 RefPtrWillBeRawPtr<Range> entireRange = Range::create(document(), divNode, 0 , divNode, 3);
433 436
434 RefPtrWillBeRawPtr<Range> subrange = TextIterator::subrange(entireRange.get( ), 2, 3); 437 RefPtrWillBeRawPtr<Range> subrange = TextIterator::subrange(entireRange.get( ), 2, 3);
435 EXPECT_EQ(0, subrange->startOffset()); 438 EXPECT_EQ(0, subrange->startOffset());
436 EXPECT_EQ(3, subrange->endOffset()); 439 EXPECT_EQ(3, subrange->endOffset());
437 } 440 }
438 441
439 } // namespace blink 442 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/iterators/TextIterator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698