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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "components/exo/buffer.h" | 6 #include "components/exo/buffer.h" |
7 #include "components/exo/surface.h" | 7 #include "components/exo/surface.h" |
8 #include "components/exo/test/exo_test_base.h" | 8 #include "components/exo/test/exo_test_base.h" |
9 #include "components/exo/test/exo_test_helper.h" | 9 #include "components/exo/test/exo_test_helper.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 cc::TextureMailbox mailbox; | 146 cc::TextureMailbox mailbox; |
147 std::unique_ptr<cc::SingleReleaseCallback> release_callback; | 147 std::unique_ptr<cc::SingleReleaseCallback> release_callback; |
148 bool rv = surface->layer()->PrepareTextureMailbox(&mailbox, &release_callback, | 148 bool rv = surface->layer()->PrepareTextureMailbox(&mailbox, &release_callback, |
149 false); | 149 false); |
150 ASSERT_TRUE(rv); | 150 ASSERT_TRUE(rv); |
151 | 151 |
152 EXPECT_TRUE(mailbox.secure_output_only()); | 152 EXPECT_TRUE(mailbox.secure_output_only()); |
153 release_callback->Run(gpu::SyncToken(), false); | 153 release_callback->Run(gpu::SyncToken(), false); |
154 } | 154 } |
155 | 155 |
| 156 TEST_F(SurfaceTest, SetBlendMode) { |
| 157 gfx::Size buffer_size(1, 1); |
| 158 std::unique_ptr<Buffer> buffer( |
| 159 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 160 std::unique_ptr<Surface> surface(new Surface); |
| 161 |
| 162 surface->Attach(buffer.get()); |
| 163 surface->SetBlendMode(SkXfermode::kSrc_Mode); |
| 164 surface->Commit(); |
| 165 |
| 166 EXPECT_TRUE(surface->layer()->fills_bounds_opaquely()); |
| 167 } |
| 168 |
| 169 TEST_F(SurfaceTest, SetAlpha) { |
| 170 gfx::Size buffer_size(1, 1); |
| 171 std::unique_ptr<Buffer> buffer( |
| 172 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 173 std::unique_ptr<Surface> surface(new Surface); |
| 174 |
| 175 surface->Attach(buffer.get()); |
| 176 surface->SetAlpha(0.5f); |
| 177 surface->Commit(); |
| 178 } |
| 179 |
156 TEST_F(SurfaceTest, Commit) { | 180 TEST_F(SurfaceTest, Commit) { |
157 std::unique_ptr<Surface> surface(new Surface); | 181 std::unique_ptr<Surface> surface(new Surface); |
158 | 182 |
159 // Calling commit without a buffer should succeed. | 183 // Calling commit without a buffer should succeed. |
160 surface->Commit(); | 184 surface->Commit(); |
161 } | 185 } |
162 | 186 |
163 } // namespace | 187 } // namespace |
164 } // namespace exo | 188 } // namespace exo |
OLD | NEW |