Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp |
| index 9904efebe90c1d1137e7c3922762ffbd90d109f1..0317fcc62ebd4de71f2472e5ea540bd4a7877759 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp |
| @@ -2056,6 +2056,48 @@ TEST_F(PaintControllerTestBase, |
| } |
| } |
| +TEST_F(PaintControllerTestBase, BeginAndEndFrame) { |
| + class FakeFrame {}; |
| + |
| + // PaintController should have one null frame in the stack since beginning. |
| + FrameFirstPaint result = GetPaintController().EndFrame(nullptr); |
|
Xianzhu
2017/05/09 23:13:08
Add a SetXXXPainted() before this line to ensure i
Zhen Wang
2017/05/09 23:26:24
Done.
|
| + EXPECT_FALSE(result.first_painted); |
| + EXPECT_FALSE(result.text_painted); |
| + EXPECT_FALSE(result.image_painted); |
| + // Readd the null frame. |
| + GetPaintController().BeginFrame(nullptr); |
| + |
| + std::unique_ptr<FakeFrame> frame1(new FakeFrame); |
| + GetPaintController().BeginFrame(frame1.get()); |
| + GetPaintController().SetFirstPainted(); |
| + GetPaintController().SetTextPainted(); |
| + GetPaintController().SetImagePainted(); |
| + |
| + result = GetPaintController().EndFrame(frame1.get()); |
| + EXPECT_TRUE(result.first_painted); |
| + EXPECT_TRUE(result.text_painted); |
| + EXPECT_TRUE(result.image_painted); |
| + |
| + std::unique_ptr<FakeFrame> frame2(new FakeFrame); |
| + GetPaintController().BeginFrame(frame2.get()); |
| + GetPaintController().SetFirstPainted(); |
| + |
| + std::unique_ptr<FakeFrame> frame3(new FakeFrame); |
| + GetPaintController().BeginFrame(frame3.get()); |
| + GetPaintController().SetTextPainted(); |
| + GetPaintController().SetImagePainted(); |
| + |
| + result = GetPaintController().EndFrame(frame3.get()); |
| + EXPECT_FALSE(result.first_painted); |
| + EXPECT_TRUE(result.text_painted); |
| + EXPECT_TRUE(result.image_painted); |
| + |
| + result = GetPaintController().EndFrame(frame2.get()); |
| + EXPECT_TRUE(result.first_painted); |
| + EXPECT_FALSE(result.text_painted); |
| + EXPECT_FALSE(result.image_painted); |
| +} |
| + |
| // Death tests don't work properly on Android. |
| #if defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |