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 #include "wtf/text/StringBuilder.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 class FirstMeaningfulPaintDetectorTest : public testing::Test { | 14 class FirstMeaningfulPaintDetectorTest : public testing::Test { |
14 protected: | 15 protected: |
15 void SetUp() override { | 16 void SetUp() override { |
16 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 17 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
17 s_timeElapsed = 0.0; | 18 s_timeElapsed = 0.0; |
18 m_originalTimeFunction = setTimeFunctionsForTesting(returnMockTime); | 19 m_originalTimeFunction = setTimeFunctionsForTesting(returnMockTime); |
19 } | 20 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 FirstMeaningfulPaintShouldNotBeBeforeFirstContentfulPaint) { | 121 FirstMeaningfulPaintShouldNotBeBeforeFirstContentfulPaint) { |
121 paintTiming().markFirstPaint(); | 122 paintTiming().markFirstPaint(); |
122 simulateLayoutAndPaint(10); | 123 simulateLayoutAndPaint(10); |
123 paintTiming().markFirstContentfulPaint(); | 124 paintTiming().markFirstContentfulPaint(); |
124 simulateNetworkStable(); | 125 simulateNetworkStable(); |
125 EXPECT_GE(paintTiming().firstMeaningfulPaint(), | 126 EXPECT_GE(paintTiming().firstMeaningfulPaint(), |
126 paintTiming().firstContentfulPaint()); | 127 paintTiming().firstContentfulPaint()); |
127 } | 128 } |
128 | 129 |
129 } // namespace blink | 130 } // namespace blink |
OLD | NEW |