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 "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "cc/input/selection.h" | 7 #include "cc/input/selection.h" |
8 #include "cc/ipc/copy_output_request_struct_traits.h" | 8 #include "cc/ipc/copy_output_request_struct_traits.h" |
9 #include "cc/ipc/traits_test_service.mojom.h" | 9 #include "cc/ipc/traits_test_service.mojom.h" |
10 #include "cc/output/copy_output_result.h" | 10 #include "cc/output/copy_output_result.h" |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 // The callback must be called with an empty CopyOutputResult. If it's never | 528 // The callback must be called with an empty CopyOutputResult. If it's never |
529 // called, this will never end and the test times out. | 529 // called, this will never end and the test times out. |
530 run_loop.Run(); | 530 run_loop.Run(); |
531 } | 531 } |
532 | 532 |
533 TEST_F(StructTraitsTest, CopyOutputResult_Bitmap) { | 533 TEST_F(StructTraitsTest, CopyOutputResult_Bitmap) { |
534 auto bitmap = base::MakeUnique<SkBitmap>(); | 534 auto bitmap = base::MakeUnique<SkBitmap>(); |
535 bitmap->allocN32Pixels(7, 8); | 535 bitmap->allocN32Pixels(7, 8); |
536 bitmap->eraseARGB(123, 213, 77, 33); | 536 bitmap->eraseARGB(123, 213, 77, 33); |
537 auto in_bitmap = base::MakeUnique<SkBitmap>(); | 537 auto in_bitmap = base::MakeUnique<SkBitmap>(); |
538 bitmap->deepCopyTo(in_bitmap.get()); | 538 in_bitmap->allocN32Pixels(7, 8); |
| 539 in_bitmap->eraseARGB(123, 213, 77, 33); |
539 auto input = CopyOutputResult::CreateBitmapResult(std::move(bitmap)); | 540 auto input = CopyOutputResult::CreateBitmapResult(std::move(bitmap)); |
540 auto size = input->size(); | 541 auto size = input->size(); |
541 | 542 |
542 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 543 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
543 std::unique_ptr<CopyOutputResult> output; | 544 std::unique_ptr<CopyOutputResult> output; |
544 proxy->EchoCopyOutputResult(std::move(input), &output); | 545 proxy->EchoCopyOutputResult(std::move(input), &output); |
545 | 546 |
546 EXPECT_TRUE(output->HasBitmap()); | 547 EXPECT_TRUE(output->HasBitmap()); |
547 EXPECT_FALSE(output->HasTexture()); | 548 EXPECT_FALSE(output->HasTexture()); |
548 EXPECT_EQ(size, output->size()); | 549 EXPECT_EQ(size, output->size()); |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 EXPECT_EQ(u_plane_resource_id, out_quad->u_plane_resource_id()); | 1246 EXPECT_EQ(u_plane_resource_id, out_quad->u_plane_resource_id()); |
1246 EXPECT_EQ(v_plane_resource_id, out_quad->v_plane_resource_id()); | 1247 EXPECT_EQ(v_plane_resource_id, out_quad->v_plane_resource_id()); |
1247 EXPECT_EQ(a_plane_resource_id, out_quad->a_plane_resource_id()); | 1248 EXPECT_EQ(a_plane_resource_id, out_quad->a_plane_resource_id()); |
1248 EXPECT_EQ(color_space, out_quad->color_space); | 1249 EXPECT_EQ(color_space, out_quad->color_space); |
1249 EXPECT_EQ(resource_offset, out_quad->resource_offset); | 1250 EXPECT_EQ(resource_offset, out_quad->resource_offset); |
1250 EXPECT_EQ(resource_multiplier, out_quad->resource_multiplier); | 1251 EXPECT_EQ(resource_multiplier, out_quad->resource_multiplier); |
1251 EXPECT_EQ(bits_per_channel, out_quad->bits_per_channel); | 1252 EXPECT_EQ(bits_per_channel, out_quad->bits_per_channel); |
1252 } | 1253 } |
1253 | 1254 |
1254 } // namespace cc | 1255 } // namespace cc |
OLD | NEW |