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

Side by Side Diff: third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp

Issue 2397753006: scheduler: Detect load RAIL mode (Closed)
Patch Set: Rebased Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/FirstMeaningfulPaintDetector.h" 5 #include "core/paint/FirstMeaningfulPaintDetector.h"
6 6
7 #include "core/paint/PaintTiming.h" 7 #include "core/paint/PaintTiming.h"
8 #include "core/testing/DummyPageHolder.h" 8 #include "core/testing/DummyPageHolder.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 TEST_F(FirstMeaningfulPaintDetectorTest, TwoLayoutsSignificantFirst) { 82 TEST_F(FirstMeaningfulPaintDetectorTest, TwoLayoutsSignificantFirst) {
83 paintTiming().markFirstPaint(); 83 paintTiming().markFirstPaint();
84 simulateLayoutAndPaint(10); 84 simulateLayoutAndPaint(10);
85 double afterLayout1 = monotonicallyIncreasingTime(); 85 double afterLayout1 = monotonicallyIncreasingTime();
86 simulateLayoutAndPaint(1); 86 simulateLayoutAndPaint(1);
87 simulateNetworkStable(); 87 simulateNetworkStable();
88 EXPECT_GT(paintTiming().firstMeaningfulPaint(), paintTiming().firstPaint()); 88 EXPECT_GT(paintTiming().firstMeaningfulPaint(), paintTiming().firstPaint());
89 EXPECT_LT(paintTiming().firstMeaningfulPaint(), afterLayout1); 89 EXPECT_LT(paintTiming().firstMeaningfulPaint(), afterLayout1);
90 } 90 }
91 91
92 TEST_F(FirstMeaningfulPaintDetectorTest, FirstMeaningfulPaintCandidate) {
93 paintTiming().markFirstPaint();
94 EXPECT_EQ(paintTiming().firstMeaningfulPaintCandidate(), 0.0);
95 simulateLayoutAndPaint(1);
96 double afterPaint = monotonicallyIncreasingTime();
97 // The first candidate gets ignored.
98 EXPECT_EQ(paintTiming().firstMeaningfulPaintCandidate(), 0.0);
99 simulateLayoutAndPaint(10);
100 // The second candidate gets reported.
101 EXPECT_GT(paintTiming().firstMeaningfulPaintCandidate(), afterPaint);
102 double candidate = paintTiming().firstMeaningfulPaintCandidate();
103 // The third candidate gets ignored since we already saw the first candidate.
104 simulateLayoutAndPaint(10);
105 EXPECT_EQ(paintTiming().firstMeaningfulPaintCandidate(), candidate);
106 }
107
92 } // namespace blink 108 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698