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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "platform/graphics/paint/PaintController.h" 5 #include "platform/graphics/paint/PaintController.h"
6 6
7 #include "platform/RuntimeEnabledFeatures.h" 7 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/paint/ClipPathDisplayItem.h" 9 #include "platform/graphics/paint/ClipPathDisplayItem.h"
10 #include "platform/graphics/paint/ClipPathRecorder.h" 10 #include "platform/graphics/paint/ClipPathRecorder.h"
(...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 FloatRect(0, 0, 100, 100)); 2050 FloatRect(0, 0, 100, 100));
2051 for (int j = 0; j < 50; ++j) 2051 for (int j = 0; j < 50; ++j)
2052 GetPaintController().CreateAndAppend<EndClipPathDisplayItem>(client); 2052 GetPaintController().CreateAndAppend<EndClipPathDisplayItem>(client);
2053 GetPaintController().CommitNewDisplayItems(LayoutSize()); 2053 GetPaintController().CommitNewDisplayItems(LayoutSize());
2054 EXPECT_FALSE(GetPaintController() 2054 EXPECT_FALSE(GetPaintController()
2055 .GetPaintArtifact() 2055 .GetPaintArtifact()
2056 .IsSuitableForGpuRasterization()); 2056 .IsSuitableForGpuRasterization());
2057 } 2057 }
2058 } 2058 }
2059 2059
2060 TEST_F(PaintControllerTestBase, BeginAndEndFrame) {
2061 class FakeFrame {};
2062
2063 // PaintController should have one null frame in the stack since beginning.
2064 GetPaintController().SetFirstPainted();
2065 FrameFirstPaint result = GetPaintController().EndFrame(nullptr);
2066 EXPECT_TRUE(result.first_painted);
2067 EXPECT_FALSE(result.text_painted);
2068 EXPECT_FALSE(result.image_painted);
2069 // Readd the null frame.
2070 GetPaintController().BeginFrame(nullptr);
2071
2072 std::unique_ptr<FakeFrame> frame1(new FakeFrame);
2073 GetPaintController().BeginFrame(frame1.get());
2074 GetPaintController().SetFirstPainted();
2075 GetPaintController().SetTextPainted();
2076 GetPaintController().SetImagePainted();
2077
2078 result = GetPaintController().EndFrame(frame1.get());
2079 EXPECT_TRUE(result.first_painted);
2080 EXPECT_TRUE(result.text_painted);
2081 EXPECT_TRUE(result.image_painted);
2082
2083 std::unique_ptr<FakeFrame> frame2(new FakeFrame);
2084 GetPaintController().BeginFrame(frame2.get());
2085 GetPaintController().SetFirstPainted();
2086
2087 std::unique_ptr<FakeFrame> frame3(new FakeFrame);
2088 GetPaintController().BeginFrame(frame3.get());
2089 GetPaintController().SetTextPainted();
2090 GetPaintController().SetImagePainted();
2091
2092 result = GetPaintController().EndFrame(frame3.get());
2093 EXPECT_FALSE(result.first_painted);
2094 EXPECT_TRUE(result.text_painted);
2095 EXPECT_TRUE(result.image_painted);
2096
2097 result = GetPaintController().EndFrame(frame2.get());
2098 EXPECT_TRUE(result.first_painted);
2099 EXPECT_FALSE(result.text_painted);
2100 EXPECT_FALSE(result.image_painted);
2101 }
2102
2060 // Death tests don't work properly on Android. 2103 // Death tests don't work properly on Android.
2061 #if defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) 2104 #if defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID)
2062 2105
2063 class PaintControllerUnderInvalidationTest 2106 class PaintControllerUnderInvalidationTest
2064 : public PaintControllerTestBase, 2107 : public PaintControllerTestBase,
2065 private ScopedPaintUnderInvalidationCheckingForTest { 2108 private ScopedPaintUnderInvalidationCheckingForTest {
2066 public: 2109 public:
2067 PaintControllerUnderInvalidationTest() 2110 PaintControllerUnderInvalidationTest()
2068 : PaintControllerTestBase(), 2111 : PaintControllerTestBase(),
2069 ScopedPaintUnderInvalidationCheckingForTest(true) {} 2112 ScopedPaintUnderInvalidationCheckingForTest(true) {}
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) { 2362 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) {
2320 // We allow invalidated display item clients as long as they would produce the 2363 // We allow invalidated display item clients as long as they would produce the
2321 // same display items. The cases of changed display items are tested by other 2364 // same display items. The cases of changed display items are tested by other
2322 // test cases. 2365 // test cases.
2323 TestInvalidationInSubsequence(); 2366 TestInvalidationInSubsequence();
2324 } 2367 }
2325 2368
2326 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) 2369 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID)
2327 2370
2328 } // namespace blink 2371 } // namespace blink
OLDNEW
« 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