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 19 matching lines...) Expand all Loading... |
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; | 39 using mus::mojom::ResourceFormat; |
40 using mus::mojom::ReturnedResource; | |
41 using mus::mojom::ReturnedResourcePtr; | |
42 using mus::mojom::SharedQuadState; | 40 using mus::mojom::SharedQuadState; |
43 using mus::mojom::SharedQuadStatePtr; | 41 using mus::mojom::SharedQuadStatePtr; |
44 using mus::mojom::SolidColorQuadState; | 42 using mus::mojom::SolidColorQuadState; |
45 using mus::mojom::SolidColorQuadStatePtr; | 43 using mus::mojom::SolidColorQuadStatePtr; |
46 using mus::mojom::SurfaceQuadState; | 44 using mus::mojom::SurfaceQuadState; |
47 using mus::mojom::SurfaceQuadStatePtr; | 45 using mus::mojom::SurfaceQuadStatePtr; |
48 using mus::mojom::TextureQuadState; | 46 using mus::mojom::TextureQuadState; |
49 using mus::mojom::TextureQuadStatePtr; | 47 using mus::mojom::TextureQuadStatePtr; |
50 using mus::mojom::TileQuadState; | 48 using mus::mojom::TileQuadState; |
51 using mus::mojom::TileQuadStatePtr; | 49 using mus::mojom::TileQuadStatePtr; |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 EXPECT_EQ(filter, round_trip_resource.filter); | 396 EXPECT_EQ(filter, round_trip_resource.filter); |
399 EXPECT_EQ(size, round_trip_resource.size); | 397 EXPECT_EQ(size, round_trip_resource.size); |
400 EXPECT_EQ(mailbox_holder.mailbox, round_trip_resource.mailbox_holder.mailbox); | 398 EXPECT_EQ(mailbox_holder.mailbox, round_trip_resource.mailbox_holder.mailbox); |
401 EXPECT_EQ(mailbox_holder.texture_target, | 399 EXPECT_EQ(mailbox_holder.texture_target, |
402 round_trip_resource.mailbox_holder.texture_target); | 400 round_trip_resource.mailbox_holder.texture_target); |
403 EXPECT_EQ(mailbox_holder.sync_token, | 401 EXPECT_EQ(mailbox_holder.sync_token, |
404 round_trip_resource.mailbox_holder.sync_token); | 402 round_trip_resource.mailbox_holder.sync_token); |
405 EXPECT_EQ(is_software, round_trip_resource.is_software); | 403 EXPECT_EQ(is_software, round_trip_resource.is_software); |
406 } | 404 } |
407 | 405 |
408 TEST(SurfaceLibTest, ReturnedResource) { | |
409 uint32_t id = 5u; | |
410 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, | |
411 gpu::CommandBufferId::FromUnsafeValue(1), 24u); | |
412 sync_token.SetVerifyFlush(); | |
413 int count = 2; | |
414 bool lost = false; | |
415 cc::ReturnedResource resource; | |
416 resource.id = id; | |
417 resource.sync_token = sync_token; | |
418 resource.count = count; | |
419 resource.lost = lost; | |
420 | |
421 ReturnedResourcePtr mus_resource = ReturnedResource::From(resource); | |
422 EXPECT_EQ(id, mus_resource->id); | |
423 EXPECT_EQ(sync_token, mus_resource->sync_token); | |
424 EXPECT_EQ(count, mus_resource->count); | |
425 EXPECT_EQ(lost, mus_resource->lost); | |
426 | |
427 cc::ReturnedResource round_trip_resource = | |
428 mus_resource.To<cc::ReturnedResource>(); | |
429 EXPECT_EQ(id, round_trip_resource.id); | |
430 EXPECT_EQ(sync_token, round_trip_resource.sync_token); | |
431 EXPECT_EQ(count, round_trip_resource.count); | |
432 EXPECT_EQ(lost, round_trip_resource.lost); | |
433 } | |
434 | |
435 TEST_F(SurfaceLibQuadTest, DebugBorderQuad) { | 406 TEST_F(SurfaceLibQuadTest, DebugBorderQuad) { |
436 cc::DebugBorderDrawQuad* debug_border_quad = | 407 cc::DebugBorderDrawQuad* debug_border_quad = |
437 pass->CreateAndAppendDrawQuad<cc::DebugBorderDrawQuad>(); | 408 pass->CreateAndAppendDrawQuad<cc::DebugBorderDrawQuad>(); |
438 const SkColor arbitrary_color = SK_ColorGREEN; | 409 const SkColor arbitrary_color = SK_ColorGREEN; |
439 const int width = 3; | 410 const int width = 3; |
440 debug_border_quad->SetAll(sqs, | 411 debug_border_quad->SetAll(sqs, |
441 rect, | 412 rect, |
442 opaque_rect, | 413 opaque_rect, |
443 visible_rect, | 414 visible_rect, |
444 needs_blending, | 415 needs_blending, |
(...skipping 10 matching lines...) Expand all Loading... |
455 ASSERT_TRUE(mus_quad->debug_border_quad_state); | 426 ASSERT_TRUE(mus_quad->debug_border_quad_state); |
456 DebugBorderQuadStatePtr& mus_debug_border_state = | 427 DebugBorderQuadStatePtr& mus_debug_border_state = |
457 mus_quad->debug_border_quad_state; | 428 mus_quad->debug_border_quad_state; |
458 EXPECT_TRUE( | 429 EXPECT_TRUE( |
459 Color::From(arbitrary_color).Equals(mus_debug_border_state->color)); | 430 Color::From(arbitrary_color).Equals(mus_debug_border_state->color)); |
460 EXPECT_EQ(width, mus_debug_border_state->width); | 431 EXPECT_EQ(width, mus_debug_border_state->width); |
461 } | 432 } |
462 | 433 |
463 } // namespace | 434 } // namespace |
464 } // namespace mojo | 435 } // namespace mojo |
OLD | NEW |