OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 IntSize m_size; | 84 IntSize m_size; |
85 sk_sp<SkImage> m_image; | 85 sk_sp<SkImage> m_image; |
86 }; | 86 }; |
87 | 87 |
88 } // anonymous namespace | 88 } // anonymous namespace |
89 | 89 |
90 TEST(ImageLayerChromiumTest, imageLayerContentReset) { | 90 TEST(ImageLayerChromiumTest, imageLayerContentReset) { |
91 FakeGraphicsLayerClient client; | 91 FakeGraphicsLayerClient client; |
92 std::unique_ptr<FakeGraphicsLayer> graphicsLayer = | 92 std::unique_ptr<FakeGraphicsLayer> graphicsLayer = |
93 wrapUnique(new FakeGraphicsLayer(&client)); | 93 WTF::wrapUnique(new FakeGraphicsLayer(&client)); |
94 ASSERT_TRUE(graphicsLayer.get()); | 94 ASSERT_TRUE(graphicsLayer.get()); |
95 | 95 |
96 ASSERT_FALSE(graphicsLayer->hasContentsLayer()); | 96 ASSERT_FALSE(graphicsLayer->hasContentsLayer()); |
97 ASSERT_FALSE(graphicsLayer->contentsLayer()); | 97 ASSERT_FALSE(graphicsLayer->contentsLayer()); |
98 | 98 |
99 bool opaque = false; | 99 bool opaque = false; |
100 RefPtr<Image> image = TestImage::create(IntSize(100, 100), opaque); | 100 RefPtr<Image> image = TestImage::create(IntSize(100, 100), opaque); |
101 ASSERT_TRUE(image.get()); | 101 ASSERT_TRUE(image.get()); |
102 | 102 |
103 graphicsLayer->setContentsToImage(image.get()); | 103 graphicsLayer->setContentsToImage(image.get()); |
104 ASSERT_TRUE(graphicsLayer->hasContentsLayer()); | 104 ASSERT_TRUE(graphicsLayer->hasContentsLayer()); |
105 ASSERT_TRUE(graphicsLayer->contentsLayer()); | 105 ASSERT_TRUE(graphicsLayer->contentsLayer()); |
106 | 106 |
107 graphicsLayer->setContentsToImage(0); | 107 graphicsLayer->setContentsToImage(0); |
108 ASSERT_FALSE(graphicsLayer->hasContentsLayer()); | 108 ASSERT_FALSE(graphicsLayer->hasContentsLayer()); |
109 ASSERT_FALSE(graphicsLayer->contentsLayer()); | 109 ASSERT_FALSE(graphicsLayer->contentsLayer()); |
110 } | 110 } |
111 | 111 |
112 TEST(ImageLayerChromiumTest, opaqueImages) { | 112 TEST(ImageLayerChromiumTest, opaqueImages) { |
113 FakeGraphicsLayerClient client; | 113 FakeGraphicsLayerClient client; |
114 std::unique_ptr<FakeGraphicsLayer> graphicsLayer = | 114 std::unique_ptr<FakeGraphicsLayer> graphicsLayer = |
115 wrapUnique(new FakeGraphicsLayer(&client)); | 115 WTF::wrapUnique(new FakeGraphicsLayer(&client)); |
116 ASSERT_TRUE(graphicsLayer.get()); | 116 ASSERT_TRUE(graphicsLayer.get()); |
117 | 117 |
118 bool opaque = true; | 118 bool opaque = true; |
119 RefPtr<Image> opaqueImage = TestImage::create(IntSize(100, 100), opaque); | 119 RefPtr<Image> opaqueImage = TestImage::create(IntSize(100, 100), opaque); |
120 ASSERT_TRUE(opaqueImage.get()); | 120 ASSERT_TRUE(opaqueImage.get()); |
121 RefPtr<Image> nonOpaqueImage = TestImage::create(IntSize(100, 100), !opaque); | 121 RefPtr<Image> nonOpaqueImage = TestImage::create(IntSize(100, 100), !opaque); |
122 ASSERT_TRUE(nonOpaqueImage.get()); | 122 ASSERT_TRUE(nonOpaqueImage.get()); |
123 | 123 |
124 ASSERT_FALSE(graphicsLayer->contentsLayer()); | 124 ASSERT_FALSE(graphicsLayer->contentsLayer()); |
125 | 125 |
126 graphicsLayer->setContentsToImage(opaqueImage.get()); | 126 graphicsLayer->setContentsToImage(opaqueImage.get()); |
127 ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque()); | 127 ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque()); |
128 | 128 |
129 graphicsLayer->setContentsToImage(nonOpaqueImage.get()); | 129 graphicsLayer->setContentsToImage(nonOpaqueImage.get()); |
130 ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque()); | 130 ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque()); |
131 } | 131 } |
132 | 132 |
133 } // namespace blink | 133 } // namespace blink |
OLD | NEW |