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

Unified Diff: third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp

Issue 2883273003: Move the user interaction policy for FirstMeaningfulPaint UMA into renderer (Closed)
Patch Set: rebase Created 3 years, 6 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/core/paint/FirstMeaningfulPaintDetectorTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp b/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp
index 1eedaf29c68fd9c46c27f40fb557d90bca7c62d4..4b598e93ce145a4b81e84dc6626cfba394e0fbc4 100644
--- a/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp
+++ b/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp
@@ -56,6 +56,8 @@ class FirstMeaningfulPaintDetectorTest : public testing::Test {
Detector().Network2QuietTimerFired(nullptr);
}
+ void SimulateUserInput() { Detector().NotifyInputEvent(); }
+
void SetActiveConnections(int connections) {
Detector().SetNetworkQuietTimers(connections);
}
@@ -249,4 +251,21 @@ TEST_F(FirstMeaningfulPaintDetectorTest, Network2QuietTimer) {
EXPECT_TRUE(HadNetwork2Quiet());
}
+TEST_F(FirstMeaningfulPaintDetectorTest,
+ FirstMeaningfulPaintAfterUserInteraction) {
+ GetPaintTiming().MarkFirstContentfulPaint();
+ SimulateUserInput();
+ SimulateLayoutAndPaint(10);
+ SimulateNetworkStable();
+ EXPECT_EQ(GetPaintTiming().FirstMeaningfulPaint(), 0.0);
+}
+
+TEST_F(FirstMeaningfulPaintDetectorTest, UserInteractionBeforeFirstPaint) {
+ SimulateUserInput();
+ GetPaintTiming().MarkFirstContentfulPaint();
+ SimulateLayoutAndPaint(10);
+ SimulateNetworkStable();
+ EXPECT_NE(GetPaintTiming().FirstMeaningfulPaint(), 0.0);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698