| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/DisplayItemClient.h" | 5 #include "platform/graphics/paint/DisplayItemClient.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 namespace { | 10 namespace { |
| 11 | 11 |
| 12 #if ENABLE(ASSERT) | 12 #if ENABLE(ASSERT) |
| 13 | 13 |
| 14 class TestDisplayItemClient : public DisplayItemClient { | 14 class TestDisplayItemClient : public DisplayItemClient { |
| 15 public: | 15 public: |
| 16 String debugName() const final { return "TestDisplayItemClient"; } | 16 String debugName() const final { return "TestDisplayItemClient"; } |
| 17 IntRect visualRect() const final { return IntRect(); } | 17 IntRect visualRect() const final { return IntRect(); } |
| 18 private: |
| 19 DISPLAY_ITEM_CACHE_STATUS_UNCACHEABLE_IMPLEMENTATION |
| 18 }; | 20 }; |
| 19 | 21 |
| 20 TEST(DisplayItemClientTest, IsAlive) | 22 TEST(DisplayItemClientTest, IsAlive) |
| 21 { | 23 { |
| 22 EXPECT_FALSE(DisplayItemClient::isAlive(*reinterpret_cast<DisplayItemClient*
>(0x12345678))); | 24 EXPECT_FALSE(DisplayItemClient::isAlive(*reinterpret_cast<DisplayItemClient*
>(0x12345678))); |
| 23 TestDisplayItemClient* testClient = new TestDisplayItemClient; | 25 TestDisplayItemClient* testClient = new TestDisplayItemClient; |
| 24 EXPECT_TRUE(DisplayItemClient::isAlive(*testClient)); | 26 EXPECT_TRUE(DisplayItemClient::isAlive(*testClient)); |
| 25 delete testClient; | 27 delete testClient; |
| 26 EXPECT_FALSE(DisplayItemClient::isAlive(*testClient)); | 28 EXPECT_FALSE(DisplayItemClient::isAlive(*testClient)); |
| 27 } | 29 } |
| 28 | 30 |
| 29 #endif // ENABLE(ASSERT) | 31 #endif // ENABLE(ASSERT) |
| 30 | 32 |
| 31 } // namespace | 33 } // namespace |
| 32 } // namespace blink | 34 } // namespace blink |
| OLD | NEW |