| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "platform/graphics/paint/DisplayItemList.h" | 6 #include "platform/graphics/paint/DisplayItemList.h" |
| 7 | 7 |
| 8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
| 9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
| 10 #include "platform/graphics/paint/ClipRecorder.h" | 10 #include "platform/graphics/paint/ClipRecorder.h" |
| 11 #include "platform/graphics/paint/DrawingDisplayItem.h" | 11 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 12 #include "platform/graphics/paint/DrawingRecorder.h" | 12 #include "platform/graphics/paint/DrawingRecorder.h" |
| 13 #include <gtest/gtest.h> | 13 #include <gtest/gtest.h> |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class DisplayItemListTest : public ::testing::Test { | 17 class DisplayItemListTest : public ::testing::Test { |
| 18 public: |
| 19 DisplayItemListTest() |
| 20 : m_originalSlimmingPaintEnabled(RuntimeEnabledFeatures::slimmingPaintEn
abled()) { } |
| 21 |
| 18 protected: | 22 protected: |
| 19 DisplayItemList& displayItemList() { return m_displayItemList; } | 23 DisplayItemList& displayItemList() { return m_displayItemList; } |
| 20 const DisplayItems& newPaintListBeforeUpdate() { return displayItemList().m_
newDisplayItems; } | 24 const DisplayItems& newPaintListBeforeUpdate() { return displayItemList().m_
newDisplayItems; } |
| 21 | 25 |
| 22 private: | 26 private: |
| 23 virtual void SetUp() override | 27 virtual void SetUp() override |
| 24 { | 28 { |
| 25 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true); | 29 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true); |
| 26 } | 30 } |
| 27 virtual void TearDown() override | 31 virtual void TearDown() override |
| 28 { | 32 { |
| 29 RuntimeEnabledFeatures::setSlimmingPaintEnabled(false); | 33 RuntimeEnabledFeatures::setSlimmingPaintEnabled(m_originalSlimmingPaintE
nabled); |
| 30 } | 34 } |
| 31 | 35 |
| 32 DisplayItemList m_displayItemList; | 36 DisplayItemList m_displayItemList; |
| 37 bool m_originalSlimmingPaintEnabled; |
| 33 }; | 38 }; |
| 34 | 39 |
| 35 const DisplayItem::Type foregroundDrawingType = static_cast<DisplayItem::Type>(D
isplayItem::DrawingPaintPhaseFirst + 4); | 40 const DisplayItem::Type foregroundDrawingType = static_cast<DisplayItem::Type>(D
isplayItem::DrawingPaintPhaseFirst + 4); |
| 36 const DisplayItem::Type backgroundDrawingType = DisplayItem::BoxDecorationBackgr
ound; | 41 const DisplayItem::Type backgroundDrawingType = DisplayItem::BoxDecorationBackgr
ound; |
| 37 const DisplayItem::Type clipType = DisplayItem::ClipFirst; | 42 const DisplayItem::Type clipType = DisplayItem::ClipFirst; |
| 38 | 43 |
| 39 class TestDisplayItemClient { | 44 class TestDisplayItemClient { |
| 40 public: | 45 public: |
| 41 TestDisplayItemClient(const String& name) | 46 TestDisplayItemClient(const String& name) |
| 42 : m_name(name) | 47 : m_name(name) |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, | 640 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, |
| 636 TestDisplayItem(multicol, backgroundDrawingType), | 641 TestDisplayItem(multicol, backgroundDrawingType), |
| 637 TestDisplayItem(content, foregroundDrawingType), | 642 TestDisplayItem(content, foregroundDrawingType), |
| 638 TestDisplayItem(content, foregroundDrawingType), | 643 TestDisplayItem(content, foregroundDrawingType), |
| 639 TestDisplayItem(content, foregroundDrawingType)); | 644 TestDisplayItem(content, foregroundDrawingType)); |
| 640 EXPECT_NE(picture1, displayItemList().displayItems()[1].picture()); | 645 EXPECT_NE(picture1, displayItemList().displayItems()[1].picture()); |
| 641 EXPECT_NE(picture2, displayItemList().displayItems()[2].picture()); | 646 EXPECT_NE(picture2, displayItemList().displayItems()[2].picture()); |
| 642 } | 647 } |
| 643 | 648 |
| 644 } // namespace blink | 649 } // namespace blink |
| OLD | NEW |