| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "cc/input/selection.h" | 6 #include "cc/input/selection.h" |
| 7 #include "cc/ipc/traits_test_service.mojom.h" | 7 #include "cc/ipc/traits_test_service.mojom.h" |
| 8 #include "cc/quads/debug_border_draw_quad.h" | 8 #include "cc/quads/debug_border_draw_quad.h" |
| 9 #include "cc/quads/render_pass.h" | 9 #include "cc/quads/render_pass.h" |
| 10 #include "cc/quads/render_pass_draw_quad.h" | 10 #include "cc/quads/render_pass_draw_quad.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const EchoSurfaceReferenceCallback& callback) override { | 94 const EchoSurfaceReferenceCallback& callback) override { |
| 95 callback.Run(s); | 95 callback.Run(s); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void EchoSurfaceSequence( | 98 void EchoSurfaceSequence( |
| 99 const SurfaceSequence& s, | 99 const SurfaceSequence& s, |
| 100 const EchoSurfaceSequenceCallback& callback) override { | 100 const EchoSurfaceSequenceCallback& callback) override { |
| 101 callback.Run(s); | 101 callback.Run(s); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void EchoTextureMailbox(const TextureMailbox& t, |
| 105 const EchoTextureMailboxCallback& callback) override { |
| 106 callback.Run(t); |
| 107 } |
| 108 |
| 104 void EchoTransferableResource( | 109 void EchoTransferableResource( |
| 105 const TransferableResource& t, | 110 const TransferableResource& t, |
| 106 const EchoTransferableResourceCallback& callback) override { | 111 const EchoTransferableResourceCallback& callback) override { |
| 107 callback.Run(t); | 112 callback.Run(t); |
| 108 } | 113 } |
| 109 | 114 |
| 110 mojo::BindingSet<TraitsTestService> traits_test_bindings_; | 115 mojo::BindingSet<TraitsTestService> traits_test_bindings_; |
| 111 DISALLOW_COPY_AND_ASSIGN(StructTraitsTest); | 116 DISALLOW_COPY_AND_ASSIGN(StructTraitsTest); |
| 112 }; | 117 }; |
| 113 | 118 |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 EXPECT_EQ(quad_to_target_transform, output_sqs.quad_to_target_transform); | 811 EXPECT_EQ(quad_to_target_transform, output_sqs.quad_to_target_transform); |
| 807 EXPECT_EQ(layer_bounds, output_sqs.quad_layer_bounds); | 812 EXPECT_EQ(layer_bounds, output_sqs.quad_layer_bounds); |
| 808 EXPECT_EQ(visible_layer_rect, output_sqs.visible_quad_layer_rect); | 813 EXPECT_EQ(visible_layer_rect, output_sqs.visible_quad_layer_rect); |
| 809 EXPECT_EQ(clip_rect, output_sqs.clip_rect); | 814 EXPECT_EQ(clip_rect, output_sqs.clip_rect); |
| 810 EXPECT_EQ(is_clipped, output_sqs.is_clipped); | 815 EXPECT_EQ(is_clipped, output_sqs.is_clipped); |
| 811 EXPECT_EQ(opacity, output_sqs.opacity); | 816 EXPECT_EQ(opacity, output_sqs.opacity); |
| 812 EXPECT_EQ(blend_mode, output_sqs.blend_mode); | 817 EXPECT_EQ(blend_mode, output_sqs.blend_mode); |
| 813 EXPECT_EQ(sorting_context_id, output_sqs.sorting_context_id); | 818 EXPECT_EQ(sorting_context_id, output_sqs.sorting_context_id); |
| 814 } | 819 } |
| 815 | 820 |
| 821 TEST_F(StructTraitsTest, TextureMailbox) { |
| 822 const int8_t mailbox_name[GL_MAILBOX_SIZE_CHROMIUM] = { |
| 823 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2}; |
| 824 const gpu::CommandBufferNamespace command_buffer_namespace = gpu::IN_PROCESS; |
| 825 const int32_t extra_data_field = 0xbeefbeef; |
| 826 const gpu::CommandBufferId command_buffer_id( |
| 827 gpu::CommandBufferId::FromUnsafeValue(0xdeadbeef)); |
| 828 const uint64_t release_count = 0xdeadbeefdeadL; |
| 829 const gpu::SyncToken sync_token(command_buffer_namespace, extra_data_field, |
| 830 command_buffer_id, release_count); |
| 831 const uint32_t texture_target = 1337; |
| 832 const gfx::Size size_in_pixels(93, 24); |
| 833 const bool is_overlay_candidate = true; |
| 834 const bool secure_output_only = true; |
| 835 const bool nearest_neighbor = true; |
| 836 const gfx::ColorSpace color_space(4, 5, 9, gfx::ColorSpace::RangeID::LIMITED); |
| 837 #if defined(OS_ANDROID) |
| 838 const bool is_backed_by_surface_texture = true; |
| 839 const bool wants_promotion_hint = true; |
| 840 #endif |
| 841 |
| 842 gpu::Mailbox mailbox; |
| 843 mailbox.SetName(mailbox_name); |
| 844 TextureMailbox input(mailbox, sync_token, texture_target, size_in_pixels, |
| 845 is_overlay_candidate, secure_output_only); |
| 846 input.set_nearest_neighbor(nearest_neighbor); |
| 847 input.set_color_space(color_space); |
| 848 #if defined(OS_ANDROID) |
| 849 input.set_is_backed_by_surface_texture(is_backed_by_surface_texture); |
| 850 input.set_wants_promotion_hint(wants_promotion_hint); |
| 851 #endif |
| 852 |
| 853 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| 854 TextureMailbox output; |
| 855 proxy->EchoTextureMailbox(input, &output); |
| 856 |
| 857 EXPECT_EQ(mailbox, output.mailbox()); |
| 858 EXPECT_EQ(sync_token, output.sync_token()); |
| 859 EXPECT_EQ(texture_target, output.target()); |
| 860 EXPECT_EQ(size_in_pixels, output.size_in_pixels()); |
| 861 EXPECT_EQ(is_overlay_candidate, output.is_overlay_candidate()); |
| 862 EXPECT_EQ(secure_output_only, output.secure_output_only()); |
| 863 EXPECT_EQ(nearest_neighbor, output.nearest_neighbor()); |
| 864 EXPECT_EQ(color_space, output.color_space()); |
| 865 #if defined(OS_ANDROID) |
| 866 EXPECT_EQ(is_backed_by_surface_texture, |
| 867 output.is_backed_by_surface_texture()); |
| 868 EXPECT_EQ(wants_promotion_hint, output.wants_promotion_hint()); |
| 869 #endif |
| 870 } |
| 871 |
| 816 TEST_F(StructTraitsTest, TransferableResource) { | 872 TEST_F(StructTraitsTest, TransferableResource) { |
| 817 const uint32_t id = 1337; | 873 const uint32_t id = 1337; |
| 818 const ResourceFormat format = ALPHA_8; | 874 const ResourceFormat format = ALPHA_8; |
| 819 const uint32_t filter = 1234; | 875 const uint32_t filter = 1234; |
| 820 const gfx::Size size(1234, 5678); | 876 const gfx::Size size(1234, 5678); |
| 821 const int8_t mailbox_name[GL_MAILBOX_SIZE_CHROMIUM] = { | 877 const int8_t mailbox_name[GL_MAILBOX_SIZE_CHROMIUM] = { |
| 822 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2}; | 878 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2}; |
| 823 const gpu::CommandBufferNamespace command_buffer_namespace = gpu::IN_PROCESS; | 879 const gpu::CommandBufferNamespace command_buffer_namespace = gpu::IN_PROCESS; |
| 824 const int32_t extra_data_field = 0xbeefbeef; | 880 const int32_t extra_data_field = 0xbeefbeef; |
| 825 const gpu::CommandBufferId command_buffer_id( | 881 const gpu::CommandBufferId command_buffer_id( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 EXPECT_EQ(u_plane_resource_id, out_quad->u_plane_resource_id()); | 970 EXPECT_EQ(u_plane_resource_id, out_quad->u_plane_resource_id()); |
| 915 EXPECT_EQ(v_plane_resource_id, out_quad->v_plane_resource_id()); | 971 EXPECT_EQ(v_plane_resource_id, out_quad->v_plane_resource_id()); |
| 916 EXPECT_EQ(a_plane_resource_id, out_quad->a_plane_resource_id()); | 972 EXPECT_EQ(a_plane_resource_id, out_quad->a_plane_resource_id()); |
| 917 EXPECT_EQ(color_space, out_quad->color_space); | 973 EXPECT_EQ(color_space, out_quad->color_space); |
| 918 EXPECT_EQ(resource_offset, out_quad->resource_offset); | 974 EXPECT_EQ(resource_offset, out_quad->resource_offset); |
| 919 EXPECT_EQ(resource_multiplier, out_quad->resource_multiplier); | 975 EXPECT_EQ(resource_multiplier, out_quad->resource_multiplier); |
| 920 EXPECT_EQ(bits_per_channel, out_quad->bits_per_channel); | 976 EXPECT_EQ(bits_per_channel, out_quad->bits_per_channel); |
| 921 } | 977 } |
| 922 | 978 |
| 923 } // namespace cc | 979 } // namespace cc |
| OLD | NEW |