| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/paint/PaintPropertyTreePrinter.h" |
| 6 |
| 7 #include "core/layout/LayoutTestHelper.h" |
| 8 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 9 #include "testing/gmock/include/gmock/gmock-matchers.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 |
| 12 #ifndef NDEBUG |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 typedef bool TestParamRootLayerScrolling; |
| 17 class PaintPropertyTreePrinterTest |
| 18 : public ::testing::WithParamInterface<TestParamRootLayerScrolling> |
| 19 , private ScopedSlimmingPaintV2ForTest |
| 20 , private ScopedRootLayerScrollingForTest |
| 21 , public RenderingTest { |
| 22 public: |
| 23 PaintPropertyTreePrinterTest() |
| 24 : ScopedSlimmingPaintV2ForTest(true) |
| 25 , ScopedRootLayerScrollingForTest(GetParam()) |
| 26 , RenderingTest(SingleChildFrameLoaderClient::create()) { } |
| 27 |
| 28 private: |
| 29 void SetUp() override |
| 30 { |
| 31 Settings::setMockScrollbarsEnabled(true); |
| 32 |
| 33 RenderingTest::SetUp(); |
| 34 enableCompositing(); |
| 35 } |
| 36 |
| 37 void TearDown() override |
| 38 { |
| 39 RenderingTest::TearDown(); |
| 40 |
| 41 Settings::setMockScrollbarsEnabled(false); |
| 42 } |
| 43 }; |
| 44 |
| 45 INSTANTIATE_TEST_CASE_P(All, PaintPropertyTreePrinterTest, ::testing::Bool()); |
| 46 |
| 47 TEST_P(PaintPropertyTreePrinterTest, SimpleTransformTree) |
| 48 { |
| 49 setBodyInnerHTML("hello world"); |
| 50 String transformTreeAsString = transformPropertyTreeAsString(*document().vie
w()); |
| 51 EXPECT_THAT(transformTreeAsString.ascii().data(), |
| 52 testing::MatchesRegex("root .*" |
| 53 " .*Translation \\(.*\\) .*")); |
| 54 } |
| 55 |
| 56 TEST_P(PaintPropertyTreePrinterTest, SimpleClipTree) |
| 57 { |
| 58 setBodyInnerHTML("hello world"); |
| 59 String clipTreeAsString = clipPropertyTreeAsString(*document().view()); |
| 60 EXPECT_THAT(clipTreeAsString.ascii().data(), |
| 61 testing::MatchesRegex("root .*" |
| 62 " .*Clip \\(.*\\) .*")); |
| 63 } |
| 64 |
| 65 TEST_P(PaintPropertyTreePrinterTest, SimpleEffectTree) |
| 66 { |
| 67 setBodyInnerHTML("<div style='opacity: 0.9;'>hello world</div>"); |
| 68 String effectTreeAsString = effectPropertyTreeAsString(*document().view()); |
| 69 EXPECT_THAT(effectTreeAsString.ascii().data(), |
| 70 testing::MatchesRegex("root .*" |
| 71 " Effect \\(LayoutBlockFlow DIV\\) .*")); |
| 72 } |
| 73 |
| 74 TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTree) |
| 75 { |
| 76 setBodyInnerHTML("<div style='height: 4000px;'>hello world</div>"); |
| 77 String scrollTreeAsString = scrollPropertyTreeAsString(*document().view()); |
| 78 EXPECT_THAT(scrollTreeAsString.ascii().data(), |
| 79 testing::MatchesRegex("root .*" |
| 80 " Scroll \\(.*\\) .*")); |
| 81 } |
| 82 |
| 83 } // namespace blink |
| 84 |
| 85 #endif |
| OLD | NEW |