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

Unified Diff: third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp

Issue 1977703002: Lightening fix for UMA metric test failure locally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
index f9ea388c832e26c50230271ef999cc75bee14c7a..35fa09cb367b7c32830ea711081cdaa83824ca2e 100644
--- a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
+++ b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
@@ -60,6 +60,33 @@ protected:
}
};
+// TODO(ymalik): Currently, this should be the first test in the file to avoid
+// failure when running with other tests. Dig into this more and fix.
+TEST_F(ScrollAnchorTest, UMAMetricUpdated)
+{
+ HistogramTester histogramTester;
+ setBodyInnerHTML(
+ "<style> body { height: 1000px } div { height: 100px } </style>"
+ "<div id='block1'>abc</div>"
+ "<div id='block2'>def</div>");
+
+ ScrollableArea* viewport = layoutViewport();
+
+ // Scroll position not adjusted, metric not updated.
+ scrollLayoutViewport(DoubleSize(0, 150));
+ histogramTester.expectTotalCount(
+ "Layout.ScrollAnchor.AdjustedScrollOffset", 0);
+
+ // Height changed, verify metric updated once.
+ setHeight(document().getElementById("block1"), 200);
+ histogramTester.expectUniqueSample(
+ "Layout.ScrollAnchor.AdjustedScrollOffset", 1, 1);
+
+ EXPECT_EQ(250, viewport->scrollPosition().y());
+ EXPECT_EQ(document().getElementById("block2")->layoutObject(),
+ scrollAnchor(viewport).anchorObject());
+}
+
TEST_F(ScrollAnchorTest, Basic)
{
setBodyInnerHTML(
@@ -101,31 +128,6 @@ TEST_F(ScrollAnchorTest, FractionalOffsetsAreRoundedBeforeComparing)
EXPECT_EQ(101, viewport->scrollPosition().y());
}
-TEST_F(ScrollAnchorTest, UMAMetricUpdated)
-{
- HistogramTester histogramTester;
- setBodyInnerHTML(
- "<style> body { height: 1000px } div { height: 100px } </style>"
- "<div id='block1'>abc</div>"
- "<div id='block2'>def</div>");
-
- ScrollableArea* viewport = layoutViewport();
-
- // Scroll position not adjusted, metric not updated.
- scrollLayoutViewport(DoubleSize(0, 150));
- histogramTester.expectTotalCount(
- "Layout.ScrollAnchor.AdjustedScrollOffset", 0);
-
- // Height changed, verify metric updated once.
- setHeight(document().getElementById("block1"), 200);
- histogramTester.expectUniqueSample(
- "Layout.ScrollAnchor.AdjustedScrollOffset", 1, 1);
-
- EXPECT_EQ(250, viewport->scrollPosition().y());
- EXPECT_EQ(document().getElementById("block2")->layoutObject(),
- scrollAnchor(viewport).anchorObject());
-}
-
TEST_F(ScrollAnchorTest, AnchorWithLayerInScrollingDiv)
{
setBodyInnerHTML(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698