| OLD | NEW |
| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 NetworkStableBeforeFirstContentfulPaint) { | 109 NetworkStableBeforeFirstContentfulPaint) { |
| 110 paintTiming().markFirstPaint(); | 110 paintTiming().markFirstPaint(); |
| 111 simulateLayoutAndPaint(1); | 111 simulateLayoutAndPaint(1); |
| 112 simulateNetworkStable(); | 112 simulateNetworkStable(); |
| 113 EXPECT_EQ(paintTiming().firstMeaningfulPaint(), 0.0); | 113 EXPECT_EQ(paintTiming().firstMeaningfulPaint(), 0.0); |
| 114 paintTiming().markFirstContentfulPaint(); | 114 paintTiming().markFirstContentfulPaint(); |
| 115 simulateNetworkStable(); | 115 simulateNetworkStable(); |
| 116 EXPECT_NE(paintTiming().firstMeaningfulPaint(), 0.0); | 116 EXPECT_NE(paintTiming().firstMeaningfulPaint(), 0.0); |
| 117 } | 117 } |
| 118 | 118 |
| 119 TEST_F(FirstMeaningfulPaintDetectorTest, |
| 120 FirstMeaningfulPaintShouldNotBeBeforeFirstContentfulPaint) { |
| 121 paintTiming().markFirstPaint(); |
| 122 simulateLayoutAndPaint(10); |
| 123 paintTiming().markFirstContentfulPaint(); |
| 124 simulateNetworkStable(); |
| 125 EXPECT_GE(paintTiming().firstMeaningfulPaint(), |
| 126 paintTiming().firstContentfulPaint()); |
| 127 } |
| 128 |
| 119 } // namespace blink | 129 } // namespace blink |
| OLD | NEW |