| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "cc/quads/debug_border_draw_quad.h" | 10 #include "cc/quads/debug_border_draw_quad.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 using mus::mojom::CompositorFrameMetadata; | 29 using mus::mojom::CompositorFrameMetadata; |
| 30 using mus::mojom::CompositorFrameMetadataPtr; | 30 using mus::mojom::CompositorFrameMetadataPtr; |
| 31 using mus::mojom::DebugBorderQuadState; | 31 using mus::mojom::DebugBorderQuadState; |
| 32 using mus::mojom::DebugBorderQuadStatePtr; | 32 using mus::mojom::DebugBorderQuadStatePtr; |
| 33 using mus::mojom::Pass; | 33 using mus::mojom::Pass; |
| 34 using mus::mojom::PassPtr; | 34 using mus::mojom::PassPtr; |
| 35 using mus::mojom::Quad; | 35 using mus::mojom::Quad; |
| 36 using mus::mojom::QuadPtr; | 36 using mus::mojom::QuadPtr; |
| 37 using mus::mojom::RenderPassQuadState; | 37 using mus::mojom::RenderPassQuadState; |
| 38 using mus::mojom::RenderPassQuadStatePtr; | 38 using mus::mojom::RenderPassQuadStatePtr; |
| 39 using mus::mojom::ResourceFormat; | |
| 40 using mus::mojom::SharedQuadState; | 39 using mus::mojom::SharedQuadState; |
| 41 using mus::mojom::SharedQuadStatePtr; | 40 using mus::mojom::SharedQuadStatePtr; |
| 42 using mus::mojom::SolidColorQuadState; | 41 using mus::mojom::SolidColorQuadState; |
| 43 using mus::mojom::SolidColorQuadStatePtr; | 42 using mus::mojom::SolidColorQuadStatePtr; |
| 44 using mus::mojom::SurfaceQuadState; | 43 using mus::mojom::SurfaceQuadState; |
| 45 using mus::mojom::SurfaceQuadStatePtr; | 44 using mus::mojom::SurfaceQuadStatePtr; |
| 46 using mus::mojom::TextureQuadState; | 45 using mus::mojom::TextureQuadState; |
| 47 using mus::mojom::TextureQuadStatePtr; | 46 using mus::mojom::TextureQuadStatePtr; |
| 48 using mus::mojom::TileQuadState; | 47 using mus::mojom::TileQuadState; |
| 49 using mus::mojom::TileQuadStatePtr; | 48 using mus::mojom::TileQuadStatePtr; |
| 50 using mus::mojom::TransferableResource; | |
| 51 using mus::mojom::TransferableResourcePtr; | |
| 52 using mus::mojom::YUVColorSpace; | 49 using mus::mojom::YUVColorSpace; |
| 53 using mus::mojom::YUVVideoQuadState; | 50 using mus::mojom::YUVVideoQuadState; |
| 54 using mus::mojom::YUVVideoQuadStatePtr; | 51 using mus::mojom::YUVVideoQuadStatePtr; |
| 55 | 52 |
| 56 namespace mojo { | 53 namespace mojo { |
| 57 namespace { | 54 namespace { |
| 58 | 55 |
| 59 | 56 |
| 60 TEST(SurfaceLibTest, Color) { | 57 TEST(SurfaceLibTest, Color) { |
| 61 SkColor arbitrary_color = SK_ColorMAGENTA; | 58 SkColor arbitrary_color = SK_ColorMAGENTA; |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 EXPECT_EQ(uv_bottom_right, round_trip_texture_quad->uv_bottom_right); | 357 EXPECT_EQ(uv_bottom_right, round_trip_texture_quad->uv_bottom_right); |
| 361 EXPECT_EQ(background_color, round_trip_texture_quad->background_color); | 358 EXPECT_EQ(background_color, round_trip_texture_quad->background_color); |
| 362 for (size_t i = 0; i < 4; ++i) { | 359 for (size_t i = 0; i < 4; ++i) { |
| 363 EXPECT_EQ(vertex_opacity[i], round_trip_texture_quad->vertex_opacity[i]) | 360 EXPECT_EQ(vertex_opacity[i], round_trip_texture_quad->vertex_opacity[i]) |
| 364 << i; | 361 << i; |
| 365 } | 362 } |
| 366 EXPECT_EQ(y_flipped, round_trip_texture_quad->y_flipped); | 363 EXPECT_EQ(y_flipped, round_trip_texture_quad->y_flipped); |
| 367 EXPECT_EQ(secure_output_only, round_trip_texture_quad->secure_output_only); | 364 EXPECT_EQ(secure_output_only, round_trip_texture_quad->secure_output_only); |
| 368 } | 365 } |
| 369 | 366 |
| 370 TEST(SurfaceLibTest, TransferableResource) { | |
| 371 uint32_t id = 7u; | |
| 372 cc::ResourceFormat format = cc::BGRA_8888; | |
| 373 uint32_t filter = 123u; | |
| 374 gfx::Size size(17, 18); | |
| 375 gpu::MailboxHolder mailbox_holder; | |
| 376 bool is_software = false; | |
| 377 cc::TransferableResource resource; | |
| 378 resource.id = id; | |
| 379 resource.format = format; | |
| 380 resource.filter = filter; | |
| 381 resource.size = size; | |
| 382 resource.mailbox_holder = mailbox_holder; | |
| 383 resource.is_software = is_software; | |
| 384 | |
| 385 TransferableResourcePtr mus_resource = TransferableResource::From(resource); | |
| 386 EXPECT_EQ(id, mus_resource->id); | |
| 387 EXPECT_EQ(static_cast<ResourceFormat>(format), mus_resource->format); | |
| 388 EXPECT_EQ(filter, mus_resource->filter); | |
| 389 EXPECT_EQ(size, mus_resource->size); | |
| 390 EXPECT_EQ(is_software, mus_resource->is_software); | |
| 391 | |
| 392 cc::TransferableResource round_trip_resource = | |
| 393 mus_resource.To<cc::TransferableResource>(); | |
| 394 EXPECT_EQ(id, round_trip_resource.id); | |
| 395 EXPECT_EQ(format, round_trip_resource.format); | |
| 396 EXPECT_EQ(filter, round_trip_resource.filter); | |
| 397 EXPECT_EQ(size, round_trip_resource.size); | |
| 398 EXPECT_EQ(mailbox_holder.mailbox, round_trip_resource.mailbox_holder.mailbox); | |
| 399 EXPECT_EQ(mailbox_holder.texture_target, | |
| 400 round_trip_resource.mailbox_holder.texture_target); | |
| 401 EXPECT_EQ(mailbox_holder.sync_token, | |
| 402 round_trip_resource.mailbox_holder.sync_token); | |
| 403 EXPECT_EQ(is_software, round_trip_resource.is_software); | |
| 404 } | |
| 405 | |
| 406 TEST_F(SurfaceLibQuadTest, DebugBorderQuad) { | 367 TEST_F(SurfaceLibQuadTest, DebugBorderQuad) { |
| 407 cc::DebugBorderDrawQuad* debug_border_quad = | 368 cc::DebugBorderDrawQuad* debug_border_quad = |
| 408 pass->CreateAndAppendDrawQuad<cc::DebugBorderDrawQuad>(); | 369 pass->CreateAndAppendDrawQuad<cc::DebugBorderDrawQuad>(); |
| 409 const SkColor arbitrary_color = SK_ColorGREEN; | 370 const SkColor arbitrary_color = SK_ColorGREEN; |
| 410 const int width = 3; | 371 const int width = 3; |
| 411 debug_border_quad->SetAll(sqs, | 372 debug_border_quad->SetAll(sqs, |
| 412 rect, | 373 rect, |
| 413 opaque_rect, | 374 opaque_rect, |
| 414 visible_rect, | 375 visible_rect, |
| 415 needs_blending, | 376 needs_blending, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 426 ASSERT_TRUE(mus_quad->debug_border_quad_state); | 387 ASSERT_TRUE(mus_quad->debug_border_quad_state); |
| 427 DebugBorderQuadStatePtr& mus_debug_border_state = | 388 DebugBorderQuadStatePtr& mus_debug_border_state = |
| 428 mus_quad->debug_border_quad_state; | 389 mus_quad->debug_border_quad_state; |
| 429 EXPECT_TRUE( | 390 EXPECT_TRUE( |
| 430 Color::From(arbitrary_color).Equals(mus_debug_border_state->color)); | 391 Color::From(arbitrary_color).Equals(mus_debug_border_state->color)); |
| 431 EXPECT_EQ(width, mus_debug_border_state->width); | 392 EXPECT_EQ(width, mus_debug_border_state->width); |
| 432 } | 393 } |
| 433 | 394 |
| 434 } // namespace | 395 } // namespace |
| 435 } // namespace mojo | 396 } // namespace mojo |
| OLD | NEW |