Index: third_party/WebKit/Source/web/tests/TextFinderTest.cpp |
diff --git a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp |
index 9ee5ae53837790c19dc798d543af7912055d87e7..9c8895228d060394e319d4687034b2b7d3ed70d5 100644 |
--- a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp |
+++ b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp |
@@ -10,6 +10,7 @@ |
#include "core/dom/Range.h" |
#include "core/dom/shadow/ShadowRoot.h" |
#include "core/frame/FrameHost.h" |
+#include "core/frame/FrameView.h" |
#include "core/frame/VisualViewport.h" |
#include "core/html/HTMLElement.h" |
#include "core/layout/TextAutosizer.h" |
@@ -69,6 +70,7 @@ WebFloatRect TextFinderTest::findInPageRect(Node* startContainer, int startOffse |
TEST_F(TextFinderTest, FindTextSimple) |
{ |
document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ", ASSERT_NO_EXCEPTION); |
+ document().view()->updateAllLifecyclePhases(); |
Node* textNode = document().body()->firstChild(); |
int identifier = 0; |
@@ -138,6 +140,7 @@ TEST_F(TextFinderTest, FindTextSimple) |
TEST_F(TextFinderTest, FindTextAutosizing) |
{ |
document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ", ASSERT_NO_EXCEPTION); |
+ document().view()->updateAllLifecyclePhases(); |
int identifier = 0; |
WebString searchText(String("FindMe")); |
@@ -153,6 +156,7 @@ TEST_F(TextFinderTest, FindTextAutosizing) |
document().settings()->setTextAutosizingEnabled(true); |
document().settings()->setTextAutosizingWindowSizeOverride(IntSize(20, 20)); |
document().textAutosizer()->updatePageInfo(); |
+ document().view()->updateAllLifecyclePhases(); |
// In case of autosizing, scale _should_ change |
ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithinFrame, selectionRect)); |
@@ -163,6 +167,7 @@ TEST_F(TextFinderTest, FindTextAutosizing) |
visualViewport.setScale(20); |
document().settings()->setTextAutosizingEnabled(false); |
document().textAutosizer()->updatePageInfo(); |
+ document().view()->updateAllLifecyclePhases(); |
ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithinFrame, selectionRect)); |
ASSERT_TRUE(textFinder().activeMatch()); |
@@ -172,6 +177,7 @@ TEST_F(TextFinderTest, FindTextAutosizing) |
TEST_F(TextFinderTest, FindTextNotFound) |
{ |
document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ", ASSERT_NO_EXCEPTION); |
+ document().view()->updateAllLifecyclePhases(); |
int identifier = 0; |
WebString searchText(String("Boo")); |
@@ -191,6 +197,7 @@ TEST_F(TextFinderTest, FindTextInShadowDOM) |
Node* textInBElement = document().body()->firstChild()->firstChild(); |
Node* textInIElement = document().body()->lastChild()->firstChild(); |
Node* textInUElement = shadowRoot->childNodes()->item(1)->firstChild(); |
+ document().view()->updateAllLifecyclePhases(); |
int identifier = 0; |
WebString searchText(String("foo")); |
@@ -278,6 +285,8 @@ TEST_F(TextFinderTest, FindTextInShadowDOM) |
TEST_F(TextFinderTest, ScopeTextMatchesSimple) |
{ |
document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ", ASSERT_NO_EXCEPTION); |
+ document().view()->updateAllLifecyclePhases(); |
+ |
Node* textNode = document().body()->firstChild(); |
int identifier = 0; |
@@ -305,6 +314,7 @@ TEST_F(TextFinderTest, ScopeTextMatchesWithShadowDOM) |
Node* textInBElement = document().body()->firstChild()->firstChild(); |
Node* textInIElement = document().body()->lastChild()->firstChild(); |
Node* textInUElement = shadowRoot->childNodes()->item(1)->firstChild(); |
+ document().view()->updateAllLifecyclePhases(); |
int identifier = 0; |
WebString searchText(String("fOO")); |
@@ -330,6 +340,8 @@ TEST_F(TextFinderTest, ScopeTextMatchesWithShadowDOM) |
TEST_F(TextFinderTest, ScopeRepeatPatternTextMatches) |
{ |
document().body()->setInnerHTML("ab ab ab ab ab", ASSERT_NO_EXCEPTION); |
+ document().view()->updateAllLifecyclePhases(); |
+ |
Node* textNode = document().body()->firstChild(); |
int identifier = 0; |
@@ -352,6 +364,8 @@ TEST_F(TextFinderTest, ScopeRepeatPatternTextMatches) |
TEST_F(TextFinderTest, OverlappingMatches) |
{ |
document().body()->setInnerHTML("aababaa", ASSERT_NO_EXCEPTION); |
+ document().view()->updateAllLifecyclePhases(); |
esprehn
2016/07/22 05:57:10
I bet almost all of these only need updateLayout()
dglazkov
2016/07/22 16:40:50
Yeah, you're right. Let me replace.
|
+ |
Node* textNode = document().body()->firstChild(); |
int identifier = 0; |
@@ -374,6 +388,8 @@ TEST_F(TextFinderTest, OverlappingMatches) |
TEST_F(TextFinderTest, SequentialMatches) |
{ |
document().body()->setInnerHTML("ababab", ASSERT_NO_EXCEPTION); |
+ document().view()->updateAllLifecyclePhases(); |
+ |
Node* textNode = document().body()->firstChild(); |
int identifier = 0; |
@@ -397,6 +413,7 @@ TEST_F(TextFinderTest, SequentialMatches) |
TEST_F(TextFinderTest, FindTextJavaScriptUpdatesDOM) |
{ |
document().body()->setInnerHTML("<b>XXXXFindMeYYYY</b><i></i>", ASSERT_NO_EXCEPTION); |
+ document().view()->updateAllLifecyclePhases(); |
int identifier = 0; |
WebString searchText(String("FindMe")); |
@@ -420,6 +437,7 @@ TEST_F(TextFinderTest, FindTextJavaScriptUpdatesDOM) |
Element* iElement = toElement(document().body()->lastChild()); |
ASSERT_TRUE(iElement); |
iElement->setInnerHTML("ZZFindMe", ASSERT_NO_EXCEPTION); |
+ document().view()->updateAllLifecyclePhases(); |
ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithinFrame, selectionRect, &activeNow)); |
Range* activeMatch = textFinder().activeMatch(); |
@@ -485,6 +503,7 @@ TEST_F(TextFinderFakeTimerTest, ScopeWithTimeouts) |
text.insert(searchPattern, 90); |
document().body()->setInnerHTML(text, ASSERT_NO_EXCEPTION); |
+ document().view()->updateAllLifecyclePhases(); |
int identifier = 0; |
WebFindOptions findOptions; // Default. |