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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp

Issue 2872793002: Notify paint for each frame (Closed)
Patch Set: review fix Created 3 years, 7 months 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 side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698