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

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 1959183002: Multi-Process Find-in-Page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index 4399af7596acba4aa2a75b17d6a4e19202f39a70..ac3cbe416babff9303d177552c77944510caf0c8 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -3744,21 +3744,22 @@ private:
TEST_P(ParameterizedWebFrameTest, FindInPageMatchRects)
{
- registerMockedHttpURLLoad("find_in_page.html");
registerMockedHttpURLLoad("find_in_page_frame.html");
FindUpdateWebFrameClient client;
FrameTestHelpers::WebViewHelper webViewHelper(this);
- webViewHelper.initializeAndLoad(m_baseURL + "find_in_page.html", true, &client);
+ webViewHelper.initializeAndLoad(m_baseURL + "find_in_page_frame.html", true, &client);
webViewHelper.resize(WebSize(640, 480));
webViewHelper.webView()->setMaximumLegibleScale(1.f);
webViewHelper.webView()->updateAllLifecyclePhases();
runPendingTasks();
- // Note that the 'result 19' in the <select> element is not expected to produce a match.
+ // Note that the 'result 19' in the <select> element is not expected to
+ // produce a match. Also, results 00 and 01 are in a different frame that is
+ // not included in this test.
const char kFindString[] = "result";
const int kFindIdentifier = 12345;
- const int kNumResults = 19;
+ const int kNumResults = 17;
WebFindOptions options;
WebString searchText = WebString::fromUTF8(kFindString);
@@ -3775,7 +3776,7 @@ TEST_P(ParameterizedWebFrameTest, FindInPageMatchRects)
WebVector<WebFloatRect> webMatchRects;
mainFrame->findMatchRects(webMatchRects);
- ASSERT_EQ(webMatchRects.size(), static_cast<size_t>(kNumResults));
+ ASSERT_EQ(static_cast<size_t>(kNumResults), webMatchRects.size());
int rectsVersion = mainFrame->findMatchMarkersVersion();
for (int resultIndex = 0; resultIndex < kNumResults; ++resultIndex) {
@@ -3785,10 +3786,10 @@ TEST_P(ParameterizedWebFrameTest, FindInPageMatchRects)
EXPECT_EQ(mainFrame->selectNearestFindMatch(resultRect.center(), 0), resultIndex + 1);
// Check that the find result ordering matches with our expectations.
- Range* result = mainFrame->textFinder()->activeMatchFrame()->textFinder()->activeMatch();
+ Range* result = mainFrame->textFinder()->activeMatch();
ASSERT_TRUE(result);
result->setEnd(result->endContainer(), result->endOffset() + 3);
- EXPECT_EQ(result->text(), String::format("%s %02d", kFindString, resultIndex));
+ EXPECT_EQ(result->text(), String::format("%s %02d", kFindString, resultIndex + 2));
// Verify that the expected match rect also matches the currently active match.
// Compare the enclosing rects to prevent precision issues caused by CSS transforms.
@@ -3799,63 +3800,6 @@ TEST_P(ParameterizedWebFrameTest, FindInPageMatchRects)
EXPECT_EQ(mainFrame->findMatchMarkersVersion(), rectsVersion);
}
lfg 2016/05/13 20:15:40 Any reason we can't assert that the rects are in s
paulmeyer 2016/05/16 15:25:11 We could still assert the positions of the rects i
lfg 2016/05/16 16:03:29 Acknowledged.
- // All results after the first two ones should be below between them in find-in-page coordinates.
- // This is because results 2 to 9 are inside an iframe located between results 0 and 1. This applies to the fixed div too.
- EXPECT_TRUE(webMatchRects[0].y < webMatchRects[1].y);
- for (int resultIndex = 2; resultIndex < kNumResults; ++resultIndex) {
- EXPECT_TRUE(webMatchRects[0].y < webMatchRects[resultIndex].y);
- EXPECT_TRUE(webMatchRects[1].y > webMatchRects[resultIndex].y);
- }
-
- // Result 3 should be below both 2 and 4. This is caused by the CSS transform in the containing div.
- // If the transform doesn't work then 3 will be between 2 and 4.
- EXPECT_TRUE(webMatchRects[3].y > webMatchRects[2].y);
- EXPECT_TRUE(webMatchRects[3].y > webMatchRects[4].y);
-
- // Results 6, 7, 8 and 9 should be one below the other in that same order.
- // If overflow:scroll is not properly handled then result 8 would be below result 9 or
- // result 7 above result 6 depending on the scroll.
- EXPECT_TRUE(webMatchRects[6].y < webMatchRects[7].y);
- EXPECT_TRUE(webMatchRects[7].y < webMatchRects[8].y);
- EXPECT_TRUE(webMatchRects[8].y < webMatchRects[9].y);
-
- // Results 11, 12, 13 and 14 should be between results 10 and 15, as they are inside the table.
- EXPECT_TRUE(webMatchRects[11].y > webMatchRects[10].y);
- EXPECT_TRUE(webMatchRects[12].y > webMatchRects[10].y);
- EXPECT_TRUE(webMatchRects[13].y > webMatchRects[10].y);
- EXPECT_TRUE(webMatchRects[14].y > webMatchRects[10].y);
- EXPECT_TRUE(webMatchRects[11].y < webMatchRects[15].y);
- EXPECT_TRUE(webMatchRects[12].y < webMatchRects[15].y);
- EXPECT_TRUE(webMatchRects[13].y < webMatchRects[15].y);
- EXPECT_TRUE(webMatchRects[14].y < webMatchRects[15].y);
-
- // Result 11 should be above 12, 13 and 14 as it's in the table header.
- EXPECT_TRUE(webMatchRects[11].y < webMatchRects[12].y);
- EXPECT_TRUE(webMatchRects[11].y < webMatchRects[13].y);
- EXPECT_TRUE(webMatchRects[11].y < webMatchRects[14].y);
-
- // Result 11 should also be right to 12, 13 and 14 because of the colspan.
- EXPECT_TRUE(webMatchRects[11].x > webMatchRects[12].x);
- EXPECT_TRUE(webMatchRects[11].x > webMatchRects[13].x);
- EXPECT_TRUE(webMatchRects[11].x > webMatchRects[14].x);
-
- // Result 12 should be left to results 11, 13 and 14 in the table layout.
- EXPECT_TRUE(webMatchRects[12].x < webMatchRects[11].x);
- EXPECT_TRUE(webMatchRects[12].x < webMatchRects[13].x);
- EXPECT_TRUE(webMatchRects[12].x < webMatchRects[14].x);
-
- // Results 13, 12 and 14 should be one above the other in that order because of the rowspan
- // and vertical-align: middle by default.
- EXPECT_TRUE(webMatchRects[13].y < webMatchRects[12].y);
- EXPECT_TRUE(webMatchRects[12].y < webMatchRects[14].y);
-
- // Result 16 should be below result 15.
- EXPECT_TRUE(webMatchRects[15].y > webMatchRects[14].y);
-
- // Result 18 should be normalized with respect to the position:relative div, and not it's
- // immediate containing div. Consequently, result 18 should be above result 17.
- EXPECT_TRUE(webMatchRects[17].y > webMatchRects[18].y);
-
// Resizing should update the rects version.
webViewHelper.resize(WebSize(800, 600));
runPendingTasks();
@@ -3910,35 +3854,6 @@ TEST_F(WebFrameTest, FindInPageActiveIndex)
EXPECT_EQ(kActiveIndex, client.activeIndex());
}
lfg 2016/05/13 20:15:40 Can we remove find_in_hidden_frame.html from Sourc
paulmeyer 2016/05/16 15:25:12 Yes. Done.
-TEST_P(ParameterizedWebFrameTest, FindInPageSkipsHiddenFrames)
-{
- registerMockedHttpURLLoad("find_in_hidden_frame.html");
-
- FindUpdateWebFrameClient client;
- FrameTestHelpers::WebViewHelper webViewHelper(this);
- webViewHelper.initializeAndLoad(m_baseURL + "find_in_hidden_frame.html", true, &client);
- webViewHelper.resize(WebSize(640, 480));
- runPendingTasks();
-
- const char kFindString[] = "hello";
- const int kFindIdentifier = 12345;
- const int kNumResults = 1;
-
- WebFindOptions options;
- WebString searchText = WebString::fromUTF8(kFindString);
- WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame());
- EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0));
-
- mainFrame->resetMatchCount();
-
- for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
- frame->toWebLocalFrame()->scopeStringMatches(kFindIdentifier, searchText, options, true);
-
- runPendingTasks();
- EXPECT_TRUE(client.findResultsAreReady());
- EXPECT_EQ(kNumResults, client.count());
-}
-
TEST_P(ParameterizedWebFrameTest, FindOnDetachedFrame)
{
registerMockedHttpURLLoad("find_in_page.html");

Powered by Google App Engine
This is Rietveld 408576698