Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: components/exo/surface_unittest.cc

Issue 2101453002: Re-land: exo: Take blending into account when setting opaque property. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/exo/surface.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/output/compositor_frame.h" 6 #include "cc/output/compositor_frame.h"
7 #include "cc/output/delegated_frame_data.h" 7 #include "cc/output/delegated_frame_data.h"
8 #include "cc/surfaces/surface.h" 8 #include "cc/surfaces/surface.h"
9 #include "cc/surfaces/surface_manager.h" 9 #include "cc/surfaces/surface_manager.h"
10 #include "components/exo/buffer.h" 10 #include "components/exo/buffer.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 TEST_F(SurfaceTest, SetBlendMode) { 199 TEST_F(SurfaceTest, SetBlendMode) {
200 gfx::Size buffer_size(1, 1); 200 gfx::Size buffer_size(1, 1);
201 std::unique_ptr<Buffer> buffer( 201 std::unique_ptr<Buffer> buffer(
202 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 202 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
203 std::unique_ptr<Surface> surface(new Surface); 203 std::unique_ptr<Surface> surface(new Surface);
204 204
205 surface->Attach(buffer.get()); 205 surface->Attach(buffer.get());
206 surface->SetBlendMode(SkXfermode::kSrc_Mode); 206 surface->SetBlendMode(SkXfermode::kSrc_Mode);
207 surface->Commit(); 207 surface->Commit();
208 208
209 EXPECT_FALSE(surface->window()->layer()->fills_bounds_opaquely());
210
211 const cc::DelegatedFrameData* frame_data = GetFrameFromSurface(surface.get()); 209 const cc::DelegatedFrameData* frame_data = GetFrameFromSurface(surface.get());
212 ASSERT_EQ(1u, frame_data->render_pass_list.size()); 210 ASSERT_EQ(1u, frame_data->render_pass_list.size());
213 ASSERT_EQ(1u, frame_data->render_pass_list.back()->quad_list.size()); 211 ASSERT_EQ(1u, frame_data->render_pass_list.back()->quad_list.size());
214 EXPECT_FALSE(frame_data->render_pass_list.back() 212 EXPECT_FALSE(frame_data->render_pass_list.back()
215 ->quad_list.back() 213 ->quad_list.back()
216 ->ShouldDrawWithBlending()); 214 ->ShouldDrawWithBlending());
217 } 215 }
218 216
219 TEST_F(SurfaceTest, SetAlpha) { 217 TEST_F(SurfaceTest, SetAlpha) {
220 gfx::Size buffer_size(1, 1); 218 gfx::Size buffer_size(1, 1);
221 std::unique_ptr<Buffer> buffer( 219 std::unique_ptr<Buffer> buffer(
222 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 220 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
223 std::unique_ptr<Surface> surface(new Surface); 221 std::unique_ptr<Surface> surface(new Surface);
224 222
225 surface->Attach(buffer.get()); 223 surface->Attach(buffer.get());
226 surface->SetAlpha(0.5f); 224 surface->SetAlpha(0.5f);
227 surface->Commit(); 225 surface->Commit();
228 } 226 }
229 227
230 TEST_F(SurfaceTest, Commit) { 228 TEST_F(SurfaceTest, Commit) {
231 std::unique_ptr<Surface> surface(new Surface); 229 std::unique_ptr<Surface> surface(new Surface);
232 230
233 // Calling commit without a buffer should succeed. 231 // Calling commit without a buffer should succeed.
234 surface->Commit(); 232 surface->Commit();
235 } 233 }
236 234
237 } // namespace 235 } // namespace
238 } // namespace exo 236 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/surface.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698