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

Side by Side Diff: mojo/converters/surfaces/tests/surface_unittest.cc

Issue 1538823002: Convert Pass()→std::move() in mojo/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <utility>
6
5 #include "cc/quads/debug_border_draw_quad.h" 7 #include "cc/quads/debug_border_draw_quad.h"
6 #include "cc/quads/render_pass.h" 8 #include "cc/quads/render_pass.h"
7 #include "cc/quads/solid_color_draw_quad.h" 9 #include "cc/quads/solid_color_draw_quad.h"
8 #include "cc/quads/surface_draw_quad.h" 10 #include "cc/quads/surface_draw_quad.h"
9 #include "cc/quads/texture_draw_quad.h" 11 #include "cc/quads/texture_draw_quad.h"
10 #include "cc/resources/resource_provider.h" 12 #include "cc/resources/resource_provider.h"
11 #include "gpu/command_buffer/common/mailbox.h" 13 #include "gpu/command_buffer/common/mailbox.h"
12 #include "gpu/command_buffer/common/mailbox_holder.h" 14 #include "gpu/command_buffer/common/mailbox_holder.h"
13 #include "mojo/converters/geometry/geometry_type_converters.h" 15 #include "mojo/converters/geometry/geometry_type_converters.h"
14 #include "mojo/converters/surfaces/surfaces_type_converters.h" 16 #include "mojo/converters/surfaces/surfaces_type_converters.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 EXPECT_EQ(vertex_opacity[i], mus_texture_state->vertex_opacity[i]) << i; 175 EXPECT_EQ(vertex_opacity[i], mus_texture_state->vertex_opacity[i]) << i;
174 } 176 }
175 EXPECT_EQ(y_flipped, mus_texture_state->y_flipped); 177 EXPECT_EQ(y_flipped, mus_texture_state->y_flipped);
176 } 178 }
177 179
178 TEST_F(SurfaceLibQuadTest, TextureQuadEmptyVertexOpacity) { 180 TEST_F(SurfaceLibQuadTest, TextureQuadEmptyVertexOpacity) {
179 QuadPtr mus_texture_quad = Quad::New(); 181 QuadPtr mus_texture_quad = Quad::New();
180 mus_texture_quad->material = mus::mojom::MATERIAL_TEXTURE_CONTENT; 182 mus_texture_quad->material = mus::mojom::MATERIAL_TEXTURE_CONTENT;
181 TextureQuadStatePtr mus_texture_state = TextureQuadState::New(); 183 TextureQuadStatePtr mus_texture_state = TextureQuadState::New();
182 mus_texture_state->background_color = Color::New(); 184 mus_texture_state->background_color = Color::New();
183 mus_texture_quad->texture_quad_state = mus_texture_state.Pass(); 185 mus_texture_quad->texture_quad_state = std::move(mus_texture_state);
184 PassPtr mus_pass = Pass::New(); 186 PassPtr mus_pass = Pass::New();
185 mus_pass->id = RenderPassId::New(); 187 mus_pass->id = RenderPassId::New();
186 mus_pass->id->layer_id = 1; 188 mus_pass->id->layer_id = 1;
187 mus_pass->id->index = 1u; 189 mus_pass->id->index = 1u;
188 mus_pass->quads.push_back(mus_texture_quad.Pass()); 190 mus_pass->quads.push_back(std::move(mus_texture_quad));
189 SharedQuadStatePtr mus_sqs = SharedQuadState::New(); 191 SharedQuadStatePtr mus_sqs = SharedQuadState::New();
190 mus_pass->shared_quad_states.push_back(mus_sqs.Pass()); 192 mus_pass->shared_quad_states.push_back(std::move(mus_sqs));
191 193
192 scoped_ptr<cc::RenderPass> pass = mus_pass.To<scoped_ptr<cc::RenderPass>>(); 194 scoped_ptr<cc::RenderPass> pass = mus_pass.To<scoped_ptr<cc::RenderPass>>();
193 195
194 EXPECT_FALSE(pass); 196 EXPECT_FALSE(pass);
195 } 197 }
196 198
197 TEST_F(SurfaceLibQuadTest, TextureQuadEmptyBackgroundColor) { 199 TEST_F(SurfaceLibQuadTest, TextureQuadEmptyBackgroundColor) {
198 QuadPtr mus_texture_quad = Quad::New(); 200 QuadPtr mus_texture_quad = Quad::New();
199 mus_texture_quad->material = mus::mojom::MATERIAL_TEXTURE_CONTENT; 201 mus_texture_quad->material = mus::mojom::MATERIAL_TEXTURE_CONTENT;
200 TextureQuadStatePtr mus_texture_state = TextureQuadState::New(); 202 TextureQuadStatePtr mus_texture_state = TextureQuadState::New();
201 mus_texture_state->vertex_opacity = mojo::Array<float>::New(4); 203 mus_texture_state->vertex_opacity = mojo::Array<float>::New(4);
202 mus_texture_quad->texture_quad_state = mus_texture_state.Pass(); 204 mus_texture_quad->texture_quad_state = std::move(mus_texture_state);
203 PassPtr mus_pass = Pass::New(); 205 PassPtr mus_pass = Pass::New();
204 mus_pass->id = RenderPassId::New(); 206 mus_pass->id = RenderPassId::New();
205 mus_pass->id->layer_id = 1; 207 mus_pass->id->layer_id = 1;
206 mus_pass->id->index = 1u; 208 mus_pass->id->index = 1u;
207 mus_pass->quads.push_back(mus_texture_quad.Pass()); 209 mus_pass->quads.push_back(std::move(mus_texture_quad));
208 SharedQuadStatePtr mus_sqs = SharedQuadState::New(); 210 SharedQuadStatePtr mus_sqs = SharedQuadState::New();
209 mus_pass->shared_quad_states.push_back(mus_sqs.Pass()); 211 mus_pass->shared_quad_states.push_back(std::move(mus_sqs));
210 212
211 scoped_ptr<cc::RenderPass> pass = mus_pass.To<scoped_ptr<cc::RenderPass>>(); 213 scoped_ptr<cc::RenderPass> pass = mus_pass.To<scoped_ptr<cc::RenderPass>>();
212 EXPECT_FALSE(pass); 214 EXPECT_FALSE(pass);
213 } 215 }
214 216
215 TEST(SurfaceLibTest, SharedQuadState) { 217 TEST(SurfaceLibTest, SharedQuadState) {
216 gfx::Transform quad_to_target_transform; 218 gfx::Transform quad_to_target_transform;
217 quad_to_target_transform.Scale3d(0.3f, 0.7f, 0.9f); 219 quad_to_target_transform.Scale3d(0.3f, 0.7f, 0.9f);
218 gfx::Size quad_layer_bounds(57, 39); 220 gfx::Size quad_layer_bounds(57, 39);
219 gfx::Rect visible_quad_layer_rect(3, 7, 28, 42); 221 gfx::Rect visible_quad_layer_rect(3, 7, 28, 42);
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 ASSERT_TRUE(mus_quad->debug_border_quad_state); 501 ASSERT_TRUE(mus_quad->debug_border_quad_state);
500 DebugBorderQuadStatePtr& mus_debug_border_state = 502 DebugBorderQuadStatePtr& mus_debug_border_state =
501 mus_quad->debug_border_quad_state; 503 mus_quad->debug_border_quad_state;
502 EXPECT_TRUE( 504 EXPECT_TRUE(
503 Color::From(arbitrary_color).Equals(mus_debug_border_state->color)); 505 Color::From(arbitrary_color).Equals(mus_debug_border_state->color));
504 EXPECT_EQ(width, mus_debug_border_state->width); 506 EXPECT_EQ(width, mus_debug_border_state->width);
505 } 507 }
506 508
507 } // namespace 509 } // namespace
508 } // namespace mojo 510 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/converters/surfaces/surfaces_utils.cc ('k') | mojo/converters/transform/transform_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698