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

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

Issue 2872793002: Notify paint for each frame (Closed)
Patch Set: remove one comment 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7b1d3f21fd84e2b538c501a4164e57a6c9022653..6711ad15da7a65211c99ff837d61a37b846114b0 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp
@@ -2057,6 +2057,49 @@ TEST_F(PaintControllerTestBase,
}
}
+TEST_F(PaintControllerTestBase, BeginAndEndFrame) {
+ class FakeFrame {};
+
+ // PaintController should have one null frame in the stack since beginning.
+ GetPaintController().SetFirstPainted();
+ FrameFirstPaint result = GetPaintController().EndFrame(nullptr);
+ EXPECT_TRUE(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)
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698