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

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

Issue 1483013003: Find In Page doesn't work properly when " " is searched (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing the patch 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/iterators/TextIteratorFlags.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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 "<div id='div' contenteditable='true'>1<img src='foo.png'>3</div>"; 379 "<div id='div' contenteditable='true'>1<img src='foo.png'>3</div>";
380 setBodyContent(bodyContent); 380 setBodyContent(bodyContent);
381 document().view()->updateAllLifecyclePhases(); 381 document().view()->updateAllLifecyclePhases();
382 382
383 Node* divNode = document().getElementById("div"); 383 Node* divNode = document().getElementById("div");
384 RefPtrWillBeRawPtr<Range> range = Range::create(document(), divNode, 0, divN ode, 3); 384 RefPtrWillBeRawPtr<Range> range = Range::create(document(), divNode, 0, divN ode, 3);
385 385
386 EXPECT_EQ(3, TextIterator::rangeLength(range->startPosition(), range->endPos ition())); 386 EXPECT_EQ(3, TextIterator::rangeLength(range->startPosition(), range->endPos ition()));
387 } 387 }
388 388
389 TEST_F(TextIteratorTest, WhitespaceCollapseForReplacedElements)
390 {
391 static const char* bodyContent = "<span>Some text </span> <input type='butto n' value='Button text'/><span>Some more text</span>";
392 setBodyContent(bodyContent);
393 EXPECT_EQ("[Some text ][][Some more text]", iterate<DOMTree>(TextIteratorCol lapseTrailingSpace));
394 EXPECT_EQ("[Some text ][][Button text][Some more text]", iterate<ComposedTre e>(TextIteratorCollapseTrailingSpace));
395 }
396
389 TEST_F(TextIteratorTest, copyTextTo) 397 TEST_F(TextIteratorTest, copyTextTo)
390 { 398 {
391 const char* bodyContent = "<a id=host><b id=one>one</b> not appeared <b id=t wo>two</b></a>"; 399 const char* bodyContent = "<a id=host><b id=one>one</b> not appeared <b id=t wo>two</b></a>";
392 const char* shadowContent = "three <content select=#two></content> <content select=#one></content> zero"; 400 const char* shadowContent = "three <content select=#two></content> <content select=#one></content> zero";
393 setBodyContent(bodyContent); 401 setBodyContent(bodyContent);
394 setShadowContent(shadowContent, "host"); 402 setShadowContent(shadowContent, "host");
395 updateLayoutAndStyleForPainting(); 403 updateLayoutAndStyleForPainting();
396 404
397 Element* host = document().getElementById("host"); 405 Element* host = document().getElementById("host");
398 const char* message = "|iter%d| should have emitted '%s'."; 406 const char* message = "|iter%d| should have emitted '%s'.";
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 EXPECT_EQ('e', iter2.characterAt(2)) << message2; 487 EXPECT_EQ('e', iter2.characterAt(2)) << message2;
480 iter2.advance(); 488 iter2.advance();
481 EXPECT_EQ(' ', iter2.characterAt(0)) << message2; 489 EXPECT_EQ(' ', iter2.characterAt(0)) << message2;
482 EXPECT_EQ('z', iter2.characterAt(1)) << message2; 490 EXPECT_EQ('z', iter2.characterAt(1)) << message2;
483 EXPECT_EQ('e', iter2.characterAt(2)) << message2; 491 EXPECT_EQ('e', iter2.characterAt(2)) << message2;
484 EXPECT_EQ('r', iter2.characterAt(3)) << message2; 492 EXPECT_EQ('r', iter2.characterAt(3)) << message2;
485 EXPECT_EQ('o', iter2.characterAt(4)) << message2; 493 EXPECT_EQ('o', iter2.characterAt(4)) << message2;
486 } 494 }
487 495
488 } // namespace blink 496 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/iterators/TextIteratorFlags.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698