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

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

Issue 2160113002: exo: Fullscreen overlay candidates support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/quads/texture_draw_quad.h"
8 #include "cc/surfaces/surface.h" 9 #include "cc/surfaces/surface.h"
9 #include "cc/surfaces/surface_manager.h" 10 #include "cc/surfaces/surface_manager.h"
10 #include "components/exo/buffer.h" 11 #include "components/exo/buffer.h"
11 #include "components/exo/surface.h" 12 #include "components/exo/surface.h"
12 #include "components/exo/test/exo_test_base.h" 13 #include "components/exo/test/exo_test_base.h"
13 #include "components/exo/test/exo_test_helper.h" 14 #include "components/exo/test/exo_test_helper.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "ui/aura/env.h" 16 #include "ui/aura/env.h"
16 #include "ui/compositor/layer_tree_owner.h" 17 #include "ui/compositor/layer_tree_owner.h"
17 #include "ui/gfx/gpu_memory_buffer.h" 18 #include "ui/gfx/gpu_memory_buffer.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 surface->Commit(); 208 surface->Commit();
208 209
209 const cc::DelegatedFrameData* frame_data = GetFrameFromSurface(surface.get()); 210 const cc::DelegatedFrameData* frame_data = GetFrameFromSurface(surface.get());
210 ASSERT_EQ(1u, frame_data->render_pass_list.size()); 211 ASSERT_EQ(1u, frame_data->render_pass_list.size());
211 ASSERT_EQ(1u, frame_data->render_pass_list.back()->quad_list.size()); 212 ASSERT_EQ(1u, frame_data->render_pass_list.back()->quad_list.size());
212 EXPECT_FALSE(frame_data->render_pass_list.back() 213 EXPECT_FALSE(frame_data->render_pass_list.back()
213 ->quad_list.back() 214 ->quad_list.back()
214 ->ShouldDrawWithBlending()); 215 ->ShouldDrawWithBlending());
215 } 216 }
216 217
218 TEST_F(SurfaceTest, OverlayCandidate) {
219 gfx::Size buffer_size(1, 1);
220 std::unique_ptr<Buffer> buffer(new Buffer(
221 exo_test_helper()->CreateGpuMemoryBuffer(buffer_size), 0, 0, true, true));
222 std::unique_ptr<Surface> surface(new Surface);
223
224 surface->Attach(buffer.get());
225 surface->Commit();
226
227 const cc::DelegatedFrameData* frame_data = GetFrameFromSurface(surface.get());
228 ASSERT_EQ(1u, frame_data->render_pass_list.size());
229 ASSERT_EQ(1u, frame_data->render_pass_list.back()->quad_list.size());
230 cc::DrawQuad* draw_quad =
231 frame_data->render_pass_list.back()->quad_list.back();
232 ASSERT_EQ(cc::DrawQuad::TEXTURE_CONTENT, draw_quad->material);
233
234 const cc::TextureDrawQuad* texture_quad =
235 cc::TextureDrawQuad::MaterialCast(draw_quad);
236 EXPECT_FALSE(texture_quad->resource_size_in_pixels().IsEmpty());
237 }
238
217 TEST_F(SurfaceTest, SetAlpha) { 239 TEST_F(SurfaceTest, SetAlpha) {
218 gfx::Size buffer_size(1, 1); 240 gfx::Size buffer_size(1, 1);
219 std::unique_ptr<Buffer> buffer( 241 std::unique_ptr<Buffer> buffer(
220 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 242 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
221 std::unique_ptr<Surface> surface(new Surface); 243 std::unique_ptr<Surface> surface(new Surface);
222 244
223 surface->Attach(buffer.get()); 245 surface->Attach(buffer.get());
224 surface->SetAlpha(0.5f); 246 surface->SetAlpha(0.5f);
225 surface->Commit(); 247 surface->Commit();
226 } 248 }
227 249
228 TEST_F(SurfaceTest, Commit) { 250 TEST_F(SurfaceTest, Commit) {
229 std::unique_ptr<Surface> surface(new Surface); 251 std::unique_ptr<Surface> surface(new Surface);
230 252
231 // Calling commit without a buffer should succeed. 253 // Calling commit without a buffer should succeed.
232 surface->Commit(); 254 surface->Commit();
233 } 255 }
234 256
235 } // namespace 257 } // namespace
236 } // namespace exo 258 } // 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