| 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/ipc/traits_test_service.mojom.h" | 6 #include "cc/ipc/traits_test_service.mojom.h" |
| 7 #include "cc/quads/render_pass_id.h" | 7 #include "cc/quads/render_pass_id.h" |
| 8 #include "mojo/public/cpp/bindings/binding_set.h" | 8 #include "mojo/public/cpp/bindings/binding_set.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const SharedQuadState& s, | 43 const SharedQuadState& s, |
| 44 const EchoSharedQuadStateCallback& callback) override { | 44 const EchoSharedQuadStateCallback& callback) override { |
| 45 callback.Run(s); | 45 callback.Run(s); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void EchoSurfaceId(const SurfaceId& s, | 48 void EchoSurfaceId(const SurfaceId& s, |
| 49 const EchoSurfaceIdCallback& callback) override { | 49 const EchoSurfaceIdCallback& callback) override { |
| 50 callback.Run(s); | 50 callback.Run(s); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void EchoSurfaceSequence( |
| 54 const SurfaceSequence& s, |
| 55 const EchoSurfaceSequenceCallback& callback) override { |
| 56 callback.Run(s); |
| 57 } |
| 58 |
| 53 void EchoTransferableResource( | 59 void EchoTransferableResource( |
| 54 const TransferableResource& t, | 60 const TransferableResource& t, |
| 55 const EchoTransferableResourceCallback& callback) override { | 61 const EchoTransferableResourceCallback& callback) override { |
| 56 callback.Run(t); | 62 callback.Run(t); |
| 57 } | 63 } |
| 58 | 64 |
| 59 mojo::BindingSet<TraitsTestService> traits_test_bindings_; | 65 mojo::BindingSet<TraitsTestService> traits_test_bindings_; |
| 60 DISALLOW_COPY_AND_ASSIGN(StructTraitsTest); | 66 DISALLOW_COPY_AND_ASSIGN(StructTraitsTest); |
| 61 }; | 67 }; |
| 62 | 68 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 const uint64_t nonce = 0xdeadbeef; | 133 const uint64_t nonce = 0xdeadbeef; |
| 128 SurfaceId input(id_namespace, local_id, nonce); | 134 SurfaceId input(id_namespace, local_id, nonce); |
| 129 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 135 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| 130 SurfaceId output; | 136 SurfaceId output; |
| 131 proxy->EchoSurfaceId(input, &output); | 137 proxy->EchoSurfaceId(input, &output); |
| 132 EXPECT_EQ(id_namespace, output.id_namespace()); | 138 EXPECT_EQ(id_namespace, output.id_namespace()); |
| 133 EXPECT_EQ(local_id, output.local_id()); | 139 EXPECT_EQ(local_id, output.local_id()); |
| 134 EXPECT_EQ(nonce, output.nonce()); | 140 EXPECT_EQ(nonce, output.nonce()); |
| 135 } | 141 } |
| 136 | 142 |
| 143 TEST_F(StructTraitsTest, SurfaceSequence) { |
| 144 const uint32_t id_namespace = 2016; |
| 145 const uint32_t sequence = 0xfbadbeef; |
| 146 SurfaceSequence input(id_namespace, sequence); |
| 147 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| 148 SurfaceSequence output; |
| 149 proxy->EchoSurfaceSequence(input, &output); |
| 150 EXPECT_EQ(id_namespace, output.id_namespace); |
| 151 EXPECT_EQ(sequence, output.sequence); |
| 152 } |
| 153 |
| 137 TEST_F(StructTraitsTest, SharedQuadState) { | 154 TEST_F(StructTraitsTest, SharedQuadState) { |
| 138 const gfx::Transform quad_to_target_transform(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, | 155 const gfx::Transform quad_to_target_transform(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, |
| 139 7.f, 8.f, 9.f, 10.f, 11.f, 12.f, | 156 7.f, 8.f, 9.f, 10.f, 11.f, 12.f, |
| 140 13.f, 14.f, 15.f, 16.f); | 157 13.f, 14.f, 15.f, 16.f); |
| 141 const gfx::Size layer_bounds(1234, 5678); | 158 const gfx::Size layer_bounds(1234, 5678); |
| 142 const gfx::Rect visible_layer_rect(12, 34, 56, 78); | 159 const gfx::Rect visible_layer_rect(12, 34, 56, 78); |
| 143 const gfx::Rect clip_rect(123, 456, 789, 101112); | 160 const gfx::Rect clip_rect(123, 456, 789, 101112); |
| 144 const bool is_clipped = true; | 161 const bool is_clipped = true; |
| 145 const float opacity = 0.9f; | 162 const float opacity = 0.9f; |
| 146 const SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; | 163 const SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 EXPECT_EQ(mailbox_holder.sync_token, output.mailbox_holder.sync_token); | 226 EXPECT_EQ(mailbox_holder.sync_token, output.mailbox_holder.sync_token); |
| 210 EXPECT_EQ(mailbox_holder.texture_target, | 227 EXPECT_EQ(mailbox_holder.texture_target, |
| 211 output.mailbox_holder.texture_target); | 228 output.mailbox_holder.texture_target); |
| 212 EXPECT_EQ(read_lock_fences_enabled, output.read_lock_fences_enabled); | 229 EXPECT_EQ(read_lock_fences_enabled, output.read_lock_fences_enabled); |
| 213 EXPECT_EQ(is_software, output.is_software); | 230 EXPECT_EQ(is_software, output.is_software); |
| 214 EXPECT_EQ(gpu_memory_buffer_id, output.gpu_memory_buffer_id.id); | 231 EXPECT_EQ(gpu_memory_buffer_id, output.gpu_memory_buffer_id.id); |
| 215 EXPECT_EQ(is_overlay_candidate, output.is_overlay_candidate); | 232 EXPECT_EQ(is_overlay_candidate, output.is_overlay_candidate); |
| 216 } | 233 } |
| 217 | 234 |
| 218 } // namespace cc | 235 } // namespace cc |
| OLD | NEW |