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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 selection.end.set_visible(false); | 367 selection.end.set_visible(false); |
368 selection.end.set_type(gfx::SelectionBound::RIGHT); | 368 selection.end.set_type(gfx::SelectionBound::RIGHT); |
369 ui::LatencyInfo latency_info; | 369 ui::LatencyInfo latency_info; |
370 latency_info.AddLatencyNumber( | 370 latency_info.AddLatencyNumber( |
371 ui::LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT, 1337, 7331); | 371 ui::LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT, 1337, 7331); |
372 std::vector<ui::LatencyInfo> latency_infos = {latency_info}; | 372 std::vector<ui::LatencyInfo> latency_infos = {latency_info}; |
373 std::vector<SurfaceId> referenced_surfaces; | 373 std::vector<SurfaceId> referenced_surfaces; |
374 SurfaceId id(FrameSinkId(1234, 4321), | 374 SurfaceId id(FrameSinkId(1234, 4321), |
375 LocalSurfaceId(5678, base::UnguessableToken::Create())); | 375 LocalSurfaceId(5678, base::UnguessableToken::Create())); |
376 referenced_surfaces.push_back(id); | 376 referenced_surfaces.push_back(id); |
| 377 std::vector<SurfaceId> embedded_surfaces; |
| 378 SurfaceId id2(FrameSinkId(4321, 1234), |
| 379 LocalSurfaceId(8765, base::UnguessableToken::Create())); |
| 380 embedded_surfaces.push_back(id2); |
377 uint32_t frame_token = 0xdeadbeef; | 381 uint32_t frame_token = 0xdeadbeef; |
378 | 382 |
379 CompositorFrameMetadata input; | 383 CompositorFrameMetadata input; |
380 input.device_scale_factor = device_scale_factor; | 384 input.device_scale_factor = device_scale_factor; |
381 input.root_scroll_offset = root_scroll_offset; | 385 input.root_scroll_offset = root_scroll_offset; |
382 input.page_scale_factor = page_scale_factor; | 386 input.page_scale_factor = page_scale_factor; |
383 input.scrollable_viewport_size = scrollable_viewport_size; | 387 input.scrollable_viewport_size = scrollable_viewport_size; |
384 input.root_layer_size = root_layer_size; | 388 input.root_layer_size = root_layer_size; |
385 input.min_page_scale_factor = min_page_scale_factor; | 389 input.min_page_scale_factor = min_page_scale_factor; |
386 input.max_page_scale_factor = max_page_scale_factor; | 390 input.max_page_scale_factor = max_page_scale_factor; |
387 input.root_overflow_x_hidden = root_overflow_x_hidden; | 391 input.root_overflow_x_hidden = root_overflow_x_hidden; |
388 input.root_overflow_y_hidden = root_overflow_y_hidden; | 392 input.root_overflow_y_hidden = root_overflow_y_hidden; |
389 input.may_contain_video = may_contain_video; | 393 input.may_contain_video = may_contain_video; |
390 input.is_resourceless_software_draw_with_scroll_or_animation = | 394 input.is_resourceless_software_draw_with_scroll_or_animation = |
391 is_resourceless_software_draw_with_scroll_or_animation; | 395 is_resourceless_software_draw_with_scroll_or_animation; |
392 input.top_controls_height = top_bar_height; | 396 input.top_controls_height = top_bar_height; |
393 input.top_controls_shown_ratio = top_bar_shown_ratio; | 397 input.top_controls_shown_ratio = top_bar_shown_ratio; |
394 input.bottom_controls_height = bottom_bar_height; | 398 input.bottom_controls_height = bottom_bar_height; |
395 input.bottom_controls_shown_ratio = bottom_bar_shown_ratio; | 399 input.bottom_controls_shown_ratio = bottom_bar_shown_ratio; |
396 input.root_background_color = root_background_color; | 400 input.root_background_color = root_background_color; |
397 input.selection = selection; | 401 input.selection = selection; |
398 input.latency_info = latency_infos; | 402 input.latency_info = latency_infos; |
399 input.referenced_surfaces = referenced_surfaces; | 403 input.referenced_surfaces = referenced_surfaces; |
| 404 input.embedded_surfaces = embedded_surfaces; |
400 input.frame_token = frame_token; | 405 input.frame_token = frame_token; |
401 | 406 |
402 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 407 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
403 CompositorFrameMetadata output; | 408 CompositorFrameMetadata output; |
404 proxy->EchoCompositorFrameMetadata(std::move(input), &output); | 409 proxy->EchoCompositorFrameMetadata(std::move(input), &output); |
405 EXPECT_EQ(device_scale_factor, output.device_scale_factor); | 410 EXPECT_EQ(device_scale_factor, output.device_scale_factor); |
406 EXPECT_EQ(root_scroll_offset, output.root_scroll_offset); | 411 EXPECT_EQ(root_scroll_offset, output.root_scroll_offset); |
407 EXPECT_EQ(page_scale_factor, output.page_scale_factor); | 412 EXPECT_EQ(page_scale_factor, output.page_scale_factor); |
408 EXPECT_EQ(scrollable_viewport_size, output.scrollable_viewport_size); | 413 EXPECT_EQ(scrollable_viewport_size, output.scrollable_viewport_size); |
409 EXPECT_EQ(root_layer_size, output.root_layer_size); | 414 EXPECT_EQ(root_layer_size, output.root_layer_size); |
(...skipping 12 matching lines...) Expand all Loading... |
422 EXPECT_EQ(selection, output.selection); | 427 EXPECT_EQ(selection, output.selection); |
423 EXPECT_EQ(latency_infos.size(), output.latency_info.size()); | 428 EXPECT_EQ(latency_infos.size(), output.latency_info.size()); |
424 ui::LatencyInfo::LatencyComponent component; | 429 ui::LatencyInfo::LatencyComponent component; |
425 EXPECT_TRUE(output.latency_info[0].FindLatency( | 430 EXPECT_TRUE(output.latency_info[0].FindLatency( |
426 ui::LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT, 1337, | 431 ui::LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT, 1337, |
427 &component)); | 432 &component)); |
428 EXPECT_EQ(7331, component.sequence_number); | 433 EXPECT_EQ(7331, component.sequence_number); |
429 EXPECT_EQ(referenced_surfaces.size(), output.referenced_surfaces.size()); | 434 EXPECT_EQ(referenced_surfaces.size(), output.referenced_surfaces.size()); |
430 for (uint32_t i = 0; i < referenced_surfaces.size(); ++i) | 435 for (uint32_t i = 0; i < referenced_surfaces.size(); ++i) |
431 EXPECT_EQ(referenced_surfaces[i], output.referenced_surfaces[i]); | 436 EXPECT_EQ(referenced_surfaces[i], output.referenced_surfaces[i]); |
| 437 EXPECT_EQ(embedded_surfaces.size(), output.embedded_surfaces.size()); |
| 438 for (uint32_t i = 0; i < embedded_surfaces.size(); ++i) |
| 439 EXPECT_EQ(embedded_surfaces[i], output.embedded_surfaces[i]); |
432 EXPECT_EQ(frame_token, output.frame_token); | 440 EXPECT_EQ(frame_token, output.frame_token); |
433 } | 441 } |
434 | 442 |
435 TEST_F(StructTraitsTest, CopyOutputRequest_BitmapRequest) { | 443 TEST_F(StructTraitsTest, CopyOutputRequest_BitmapRequest) { |
436 const gfx::Rect area(5, 7, 44, 55); | 444 const gfx::Rect area(5, 7, 44, 55); |
437 const auto source = | 445 const auto source = |
438 base::UnguessableToken::Deserialize(0xdeadbeef, 0xdeadf00d); | 446 base::UnguessableToken::Deserialize(0xdeadbeef, 0xdeadf00d); |
439 gfx::Size size(9, 8); | 447 gfx::Size size(9, 8); |
440 auto bitmap = base::MakeUnique<SkBitmap>(); | 448 auto bitmap = base::MakeUnique<SkBitmap>(); |
441 bitmap->allocN32Pixels(size.width(), size.height()); | 449 bitmap->allocN32Pixels(size.width(), size.height()); |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 EXPECT_EQ(u_plane_resource_id, out_quad->u_plane_resource_id()); | 1239 EXPECT_EQ(u_plane_resource_id, out_quad->u_plane_resource_id()); |
1232 EXPECT_EQ(v_plane_resource_id, out_quad->v_plane_resource_id()); | 1240 EXPECT_EQ(v_plane_resource_id, out_quad->v_plane_resource_id()); |
1233 EXPECT_EQ(a_plane_resource_id, out_quad->a_plane_resource_id()); | 1241 EXPECT_EQ(a_plane_resource_id, out_quad->a_plane_resource_id()); |
1234 EXPECT_EQ(color_space, out_quad->color_space); | 1242 EXPECT_EQ(color_space, out_quad->color_space); |
1235 EXPECT_EQ(resource_offset, out_quad->resource_offset); | 1243 EXPECT_EQ(resource_offset, out_quad->resource_offset); |
1236 EXPECT_EQ(resource_multiplier, out_quad->resource_multiplier); | 1244 EXPECT_EQ(resource_multiplier, out_quad->resource_multiplier); |
1237 EXPECT_EQ(bits_per_channel, out_quad->bits_per_channel); | 1245 EXPECT_EQ(bits_per_channel, out_quad->bits_per_channel); |
1238 } | 1246 } |
1239 | 1247 |
1240 } // namespace cc | 1248 } // namespace cc |
OLD | NEW |