OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/layer_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
12 #include "cc/compositor_frame_metadata.h" | 12 #include "cc/compositor_frame_metadata.h" |
13 #include "cc/delegated_renderer_layer_impl.h" | 13 #include "cc/delegated_renderer_layer_impl.h" |
14 #include "cc/gl_renderer.h" | 14 #include "cc/gl_renderer.h" |
15 #include "cc/heads_up_display_layer_impl.h" | 15 #include "cc/heads_up_display_layer_impl.h" |
16 #include "cc/io_surface_layer_impl.h" | 16 #include "cc/io_surface_layer_impl.h" |
17 #include "cc/layer_impl.h" | 17 #include "cc/layer_impl.h" |
18 #include "cc/layer_tiling_data.h" | 18 #include "cc/layer_tiling_data.h" |
19 #include "cc/layer_tree_impl.h" | 19 #include "cc/layer_tree_impl.h" |
20 #include "cc/math_util.h" | 20 #include "cc/math_util.h" |
21 #include "cc/quad_sink.h" | 21 #include "cc/quad_sink.h" |
22 #include "cc/render_pass_draw_quad.h" | 22 #include "cc/render_pass_draw_quad.h" |
23 #include "cc/scrollbar_geometry_fixed_thumb.h" | 23 #include "cc/scrollbar_geometry_fixed_thumb.h" |
24 #include "cc/scrollbar_layer_impl.h" | 24 #include "cc/scrollbar_layer_impl.h" |
25 #include "cc/single_thread_proxy.h" | 25 #include "cc/single_thread_proxy.h" |
26 #include "cc/solid_color_draw_quad.h" | 26 #include "cc/solid_color_draw_quad.h" |
27 #include "cc/test/animation_test_common.h" | 27 #include "cc/test/animation_test_common.h" |
28 #include "cc/test/fake_output_surface.h" | 28 #include "cc/test/fake_output_surface.h" |
29 #include "cc/test/fake_proxy.h" | 29 #include "cc/test/fake_proxy.h" |
30 #include "cc/test/fake_video_frame.h" | |
31 #include "cc/test/fake_video_frame_provider.h" | 30 #include "cc/test/fake_video_frame_provider.h" |
32 #include "cc/test/fake_web_graphics_context_3d.h" | 31 #include "cc/test/fake_web_graphics_context_3d.h" |
33 #include "cc/test/fake_web_scrollbar_theme_geometry.h" | 32 #include "cc/test/fake_web_scrollbar_theme_geometry.h" |
34 #include "cc/test/geometry_test_utils.h" | 33 #include "cc/test/geometry_test_utils.h" |
35 #include "cc/test/layer_test_common.h" | 34 #include "cc/test/layer_test_common.h" |
36 #include "cc/test/render_pass_test_common.h" | 35 #include "cc/test/render_pass_test_common.h" |
37 #include "cc/texture_draw_quad.h" | 36 #include "cc/texture_draw_quad.h" |
38 #include "cc/texture_layer_impl.h" | 37 #include "cc/texture_layer_impl.h" |
39 #include "cc/tile_draw_quad.h" | 38 #include "cc/tile_draw_quad.h" |
40 #include "cc/tiled_layer_impl.h" | 39 #include "cc/tiled_layer_impl.h" |
41 #include "cc/video_layer_impl.h" | 40 #include "cc/video_layer_impl.h" |
42 #include "media/base/media.h" | 41 #include "media/base/media.h" |
43 #include "testing/gmock/include/gmock/gmock.h" | 42 #include "testing/gmock/include/gmock/gmock.h" |
44 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
45 #include "ui/gfx/size_conversions.h" | 44 #include "ui/gfx/size_conversions.h" |
46 #include "ui/gfx/vector2d_conversions.h" | 45 #include "ui/gfx/vector2d_conversions.h" |
47 | 46 |
48 using ::testing::Mock; | 47 using ::testing::Mock; |
49 using ::testing::Return; | 48 using ::testing::Return; |
50 using ::testing::AnyNumber; | 49 using ::testing::AnyNumber; |
51 using ::testing::AtLeast; | 50 using ::testing::AtLeast; |
52 using ::testing::_; | 51 using ::testing::_; |
| 52 using media::VideoFrame; |
53 | 53 |
54 namespace cc { | 54 namespace cc { |
55 namespace { | 55 namespace { |
56 | 56 |
57 // This test is parametrized to run all tests with the | 57 // This test is parametrized to run all tests with the |
58 // m_settings.pageScalePinchZoomEnabled field enabled and disabled. | 58 // m_settings.pageScalePinchZoomEnabled field enabled and disabled. |
59 class LayerTreeHostImplTest : public testing::TestWithParam<bool>, | 59 class LayerTreeHostImplTest : public testing::TestWithParam<bool>, |
60 public LayerTreeHostImplClient { | 60 public LayerTreeHostImplClient { |
61 public: | 61 public: |
62 LayerTreeHostImplTest() | 62 LayerTreeHostImplTest() |
(...skipping 2449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 FakeWebGraphicsContext3D::Create(); | 2512 FakeWebGraphicsContext3D::Create(); |
2513 FakeWebGraphicsContext3D* context3d = context.get(); | 2513 FakeWebGraphicsContext3D* context3d = context.get(); |
2514 scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d( | 2514 scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d( |
2515 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 2515 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
2516 m_hostImpl->initializeRenderer(outputSurface.Pass()); | 2516 m_hostImpl->initializeRenderer(outputSurface.Pass()); |
2517 | 2517 |
2518 scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(m_hostImpl->activeTree(),
1)); | 2518 scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(m_hostImpl->activeTree(),
1)); |
2519 rootLayer->setBounds(gfx::Size(10, 10)); | 2519 rootLayer->setBounds(gfx::Size(10, 10)); |
2520 rootLayer->setAnchorPoint(gfx::PointF(0, 0)); | 2520 rootLayer->setAnchorPoint(gfx::PointF(0, 0)); |
2521 | 2521 |
2522 FakeVideoFrame softwareFrame(media::VideoFrame::CreateColorFrame( | 2522 scoped_refptr<VideoFrame> softwareFrame(media::VideoFrame::CreateColorFrame( |
2523 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta())); | 2523 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta())); |
2524 VideoLayerImpl::FrameUnwrapper unwrapper = | |
2525 base::Bind(FakeVideoFrame::ToVideoFrame); | |
2526 FakeVideoFrameProvider provider; | 2524 FakeVideoFrameProvider provider; |
2527 provider.set_frame(&softwareFrame); | 2525 provider.set_frame(softwareFrame); |
2528 scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(m_hostImpl->a
ctiveTree(), 4, &provider, unwrapper); | 2526 scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(m_hostImpl->a
ctiveTree(), 4, &provider); |
2529 videoLayer->setBounds(gfx::Size(10, 10)); | 2527 videoLayer->setBounds(gfx::Size(10, 10)); |
2530 videoLayer->setAnchorPoint(gfx::PointF(0, 0)); | 2528 videoLayer->setAnchorPoint(gfx::PointF(0, 0)); |
2531 videoLayer->setContentBounds(gfx::Size(10, 10)); | 2529 videoLayer->setContentBounds(gfx::Size(10, 10)); |
2532 videoLayer->setDrawsContent(true); | 2530 videoLayer->setDrawsContent(true); |
2533 rootLayer->addChild(videoLayer.PassAs<LayerImpl>()); | 2531 rootLayer->addChild(videoLayer.PassAs<LayerImpl>()); |
2534 | 2532 |
2535 scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(m
_hostImpl->activeTree(), 5); | 2533 scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(m
_hostImpl->activeTree(), 5); |
2536 ioSurfaceLayer->setBounds(gfx::Size(10, 10)); | 2534 ioSurfaceLayer->setBounds(gfx::Size(10, 10)); |
2537 ioSurfaceLayer->setAnchorPoint(gfx::PointF(0, 0)); | 2535 ioSurfaceLayer->setAnchorPoint(gfx::PointF(0, 0)); |
2538 ioSurfaceLayer->setContentBounds(gfx::Size(10, 10)); | 2536 ioSurfaceLayer->setContentBounds(gfx::Size(10, 10)); |
(...skipping 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4340 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); | 4338 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); |
4341 drawFrameAndTestDamage(noDamage); | 4339 drawFrameAndTestDamage(noDamage); |
4342 } | 4340 } |
4343 | 4341 |
4344 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4342 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4345 LayerTreeHostImplTest, | 4343 LayerTreeHostImplTest, |
4346 ::testing::Values(false, true)); | 4344 ::testing::Values(false, true)); |
4347 | 4345 |
4348 } // namespace | 4346 } // namespace |
4349 } // namespace cc | 4347 } // namespace cc |
OLD | NEW |