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

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

Issue 2738813003: Ensure the scheduler always changes from UseCase LOADING to NONE. (Closed)
Patch Set: Create a test that verifies that network stable creates a FMP candidate. Created 3 years, 9 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 b5ee403534cec10fc0bbb2e4f38c184cdfc8bab9..c46186643984f90df6ab0cd44d4dfd50b6a2fd85 100644
--- a/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp
+++ b/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp
@@ -107,6 +107,24 @@ TEST_F(FirstMeaningfulPaintDetectorTest, FirstMeaningfulPaintCandidate) {
}
TEST_F(FirstMeaningfulPaintDetectorTest,
+ OnlyOneFirstMeaningfulPaintCandidateBeforeNetworkStable) {
+ paintTiming().markFirstContentfulPaint();
+ EXPECT_EQ(paintTiming().firstMeaningfulPaintCandidate(), 0.0);
+ simulateLayoutAndPaint(1);
+ // The first candidate gets ignored.
+ EXPECT_EQ(paintTiming().firstMeaningfulPaintCandidate(), 0.0);
+ double afterPaint = monotonicallyIncreasingTime();
+ simulateNetworkStable();
+ // The networkStable even creates a FMP candidate.
+ EXPECT_GT(paintTiming().firstMeaningfulPaintCandidate(), afterPaint);
+ double candidate = paintTiming().firstMeaningfulPaintCandidate();
+ // The second candidate gets ignored since "networkStable" created the second
+ // candidate.
+ simulateLayoutAndPaint(10);
+ EXPECT_EQ(paintTiming().firstMeaningfulPaintCandidate(), candidate);
+}
+
+TEST_F(FirstMeaningfulPaintDetectorTest,
NetworkStableBeforeFirstContentfulPaint) {
paintTiming().markFirstPaint();
simulateLayoutAndPaint(1);

Powered by Google App Engine
This is Rietveld 408576698