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 "platform/testing/TestingPlatformSupport.h" | 9 #include "platform/testing/TestingPlatformSupport.h" |
10 #include "platform/wtf/text/StringBuilder.h" | 10 #include "platform/wtf/text/StringBuilder.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class FirstMeaningfulPaintDetectorTest : public testing::Test { | 15 class FirstMeaningfulPaintDetectorTest : public ::testing::Test { |
16 protected: | 16 protected: |
17 void SetUp() override { | 17 void SetUp() override { |
18 platform_->AdvanceClockSeconds(1); | 18 platform_->AdvanceClockSeconds(1); |
19 dummy_page_holder_ = DummyPageHolder::Create(IntSize(800, 600)); | 19 dummy_page_holder_ = DummyPageHolder::Create(IntSize(800, 600)); |
20 } | 20 } |
21 | 21 |
22 double AdvanceClockAndGetTime() { | 22 double AdvanceClockAndGetTime() { |
23 platform_->AdvanceClockSeconds(1); | 23 platform_->AdvanceClockSeconds(1); |
24 return MonotonicallyIncreasingTime(); | 24 return MonotonicallyIncreasingTime(); |
25 } | 25 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
263 TEST_F(FirstMeaningfulPaintDetectorTest, UserInteractionBeforeFirstPaint) { | 263 TEST_F(FirstMeaningfulPaintDetectorTest, UserInteractionBeforeFirstPaint) { |
264 SimulateUserInput(); | 264 SimulateUserInput(); |
265 GetPaintTiming().MarkFirstContentfulPaint(); | 265 GetPaintTiming().MarkFirstContentfulPaint(); |
266 SimulateLayoutAndPaint(10); | 266 SimulateLayoutAndPaint(10); |
267 SimulateNetworkStable(); | 267 SimulateNetworkStable(); |
268 EXPECT_NE(GetPaintTiming().FirstMeaningfulPaint(), 0.0); | 268 EXPECT_NE(GetPaintTiming().FirstMeaningfulPaint(), 0.0); |
269 } | 269 } |
270 | 270 |
271 } // namespace blink | 271 } // namespace blink |
OLD | NEW |