| 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/DisplayItems.h" |
| 11 #include "platform/graphics/paint/DrawingDisplayItem.h" | 12 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 12 #include "platform/graphics/paint/DrawingRecorder.h" | 13 #include "platform/graphics/paint/DrawingRecorder.h" |
| 13 #include <gtest/gtest.h> | 14 #include <gtest/gtest.h> |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class DisplayItemListTest : public ::testing::Test { | 18 class DisplayItemListTest : public ::testing::Test { |
| 18 public: | 19 public: |
| 19 DisplayItemListTest() | 20 DisplayItemListTest() |
| 20 : m_originalSlimmingPaintEnabled(RuntimeEnabledFeatures::slimmingPaintEn
abled()) { } | 21 : m_originalSlimmingPaintEnabled(RuntimeEnabledFeatures::slimmingPaintEn
abled()) { } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 private: | 54 private: |
| 54 String m_name; | 55 String m_name; |
| 55 }; | 56 }; |
| 56 | 57 |
| 57 class TestDisplayItem : public DisplayItem { | 58 class TestDisplayItem : public DisplayItem { |
| 58 public: | 59 public: |
| 59 TestDisplayItem(const DisplayItemClientWrapper& client, Type type) : Display
Item(client, type) { } | 60 TestDisplayItem(const DisplayItemClientWrapper& client, Type type) : Display
Item(client, type) { } |
| 60 | 61 |
| 61 virtual void replay(GraphicsContext&) override final { ASSERT_NOT_REACHED();
} | 62 virtual void replay(GraphicsContext&) override final { ASSERT_NOT_REACHED();
} |
| 62 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override
final { ASSERT_NOT_REACHED(); } | 63 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override
final { ASSERT_NOT_REACHED(); } |
| 64 |
| 65 void appendByMoving(DisplayItems& destination) override |
| 66 { |
| 67 destination.emplaceBack<TestDisplayItem>( |
| 68 DisplayItemClientWrapperHelper(*this), type()); |
| 69 } |
| 63 }; | 70 }; |
| 64 | 71 |
| 65 #ifndef NDEBUG | 72 #ifndef NDEBUG |
| 66 #define TRACE_DISPLAY_ITEMS(i, expected, actual) \ | 73 #define TRACE_DISPLAY_ITEMS(i, expected, actual) \ |
| 67 String trace = String::format("%d: ", (int)i) + "Expected: " + (expected).as
DebugString() + " Actual: " + (actual).asDebugString(); \ | 74 String trace = String::format("%d: ", (int)i) + "Expected: " + (expected).as
DebugString() + " Actual: " + (actual).asDebugString(); \ |
| 68 SCOPED_TRACE(trace.utf8().data()); | 75 SCOPED_TRACE(trace.utf8().data()); |
| 69 #else | 76 #else |
| 70 #define TRACE_DISPLAY_ITEMS(i, expected, actual) | 77 #define TRACE_DISPLAY_ITEMS(i, expected, actual) |
| 71 #endif | 78 #endif |
| 72 | 79 |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, | 647 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, |
| 641 TestDisplayItem(multicol, backgroundDrawingType), | 648 TestDisplayItem(multicol, backgroundDrawingType), |
| 642 TestDisplayItem(content, foregroundDrawingType), | 649 TestDisplayItem(content, foregroundDrawingType), |
| 643 TestDisplayItem(content, foregroundDrawingType), | 650 TestDisplayItem(content, foregroundDrawingType), |
| 644 TestDisplayItem(content, foregroundDrawingType)); | 651 TestDisplayItem(content, foregroundDrawingType)); |
| 645 EXPECT_NE(picture1, displayItemList().displayItems()[1].picture()); | 652 EXPECT_NE(picture1, displayItemList().displayItems()[1].picture()); |
| 646 EXPECT_NE(picture2, displayItemList().displayItems()[2].picture()); | 653 EXPECT_NE(picture2, displayItemList().displayItems()[2].picture()); |
| 647 } | 654 } |
| 648 | 655 |
| 649 } // namespace blink | 656 } // namespace blink |
| OLD | NEW |