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" |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 | 411 |
412 TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndScroll) | 412 TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndScroll) |
413 { | 413 { |
414 setupScrollAndContentsLayers(gfx::Size(100, 100)); | 414 setupScrollAndContentsLayers(gfx::Size(100, 100)); |
415 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 415 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); |
416 initializeRendererAndDrawFrame(); | 416 initializeRendererAndDrawFrame(); |
417 | 417 |
418 // We should be able to scroll even if the root layer loses its render surfa
ce after the most | 418 // We should be able to scroll even if the root layer loses its render surfa
ce after the most |
419 // recent render. | 419 // recent render. |
420 m_hostImpl->rootLayer()->clearRenderSurface(); | 420 m_hostImpl->rootLayer()->clearRenderSurface(); |
| 421 m_hostImpl->setNeedsUpdateDrawProperties(); |
| 422 |
421 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); | 423 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); |
422 } | 424 } |
423 | 425 |
424 TEST_P(LayerTreeHostImplTest, wheelEventHandlers) | 426 TEST_P(LayerTreeHostImplTest, wheelEventHandlers) |
425 { | 427 { |
426 setupScrollAndContentsLayers(gfx::Size(100, 100)); | 428 setupScrollAndContentsLayers(gfx::Size(100, 100)); |
427 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 429 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); |
428 initializeRendererAndDrawFrame(); | 430 initializeRendererAndDrawFrame(); |
429 LayerImpl* root = m_hostImpl->rootLayer(); | 431 LayerImpl* root = m_hostImpl->rootLayer(); |
430 | 432 |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 gfx::Rect layerRect(0, 0, 0, 0); | 1929 gfx::Rect layerRect(0, 0, 0, 0); |
1928 child->setPosition(layerRect.origin()); | 1930 child->setPosition(layerRect.origin()); |
1929 child->setBounds(layerRect.size()); | 1931 child->setBounds(layerRect.size()); |
1930 child->setContentBounds(layerRect.size()); | 1932 child->setContentBounds(layerRect.size()); |
1931 child->setQuadRect(gfx::Rect(gfx::Point(), layerRect.size())); | 1933 child->setQuadRect(gfx::Rect(gfx::Point(), layerRect.size())); |
1932 child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size())); | 1934 child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size())); |
1933 | 1935 |
1934 LayerTreeHostImpl::FrameData frame; | 1936 LayerTreeHostImpl::FrameData frame; |
1935 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 1937 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
1936 ASSERT_EQ(1u, frame.renderPasses.size()); | 1938 ASSERT_EQ(1u, frame.renderPasses.size()); |
1937 m_hostImpl->didDrawAllLayers(frame); | |
1938 | 1939 |
1939 size_t numGutterQuads = 0; | 1940 size_t numGutterQuads = 0; |
1940 for (size_t i = 0; i < frame.renderPasses[0]->quad_list.size(); ++i) | 1941 for (size_t i = 0; i < frame.renderPasses[0]->quad_list.size(); ++i) |
1941 numGutterQuads += (frame.renderPasses[0]->quad_list[i]->material ==
DrawQuad::SOLID_COLOR) ? 1 : 0; | 1942 numGutterQuads += (frame.renderPasses[0]->quad_list[i]->material ==
DrawQuad::SOLID_COLOR) ? 1 : 0; |
1942 EXPECT_EQ(1u, numGutterQuads); | 1943 EXPECT_EQ(1u, numGutterQuads); |
1943 EXPECT_EQ(1u, frame.renderPasses[0]->quad_list.size()); | 1944 EXPECT_EQ(1u, frame.renderPasses[0]->quad_list.size()); |
1944 | 1945 |
1945 verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quad_list, gfx::Rect(
gfx::Point(), viewportSize)); | 1946 verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quad_list, gfx::Rect(
gfx::Point(), viewportSize)); |
1946 m_hostImpl->didDrawAllLayers(frame); | 1947 m_hostImpl->didDrawAllLayers(frame); |
1947 } | 1948 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2046 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack
erContext*>(outputSurface->context3D()); | 2047 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack
erContext*>(outputSurface->context3D()); |
2047 | 2048 |
2048 // This test creates its own LayerTreeHostImpl, so | 2049 // This test creates its own LayerTreeHostImpl, so |
2049 // that we can force partial swap enabled. | 2050 // that we can force partial swap enabled. |
2050 LayerTreeSettings settings; | 2051 LayerTreeSettings settings; |
2051 settings.partialSwapEnabled = true; | 2052 settings.partialSwapEnabled = true; |
2052 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create(
settings, this, &m_proxy); | 2053 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create(
settings, this, &m_proxy); |
2053 layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); | 2054 layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); |
2054 layerTreeHostImpl->setViewportSize(gfx::Size(500, 500), gfx::Size(500, 500))
; | 2055 layerTreeHostImpl->setViewportSize(gfx::Size(500, 500), gfx::Size(500, 500))
; |
2055 | 2056 |
2056 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(m_hostImpl.get(),
1); | 2057 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(layerTreeHostImpl
.get(), 1); |
2057 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(m_hostImpl.get()
, 2); | 2058 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(layerTreeHostImp
l.get(), 2); |
2058 child->setPosition(gfx::PointF(12, 13)); | 2059 child->setPosition(gfx::PointF(12, 13)); |
2059 child->setAnchorPoint(gfx::PointF(0, 0)); | 2060 child->setAnchorPoint(gfx::PointF(0, 0)); |
2060 child->setBounds(gfx::Size(14, 15)); | 2061 child->setBounds(gfx::Size(14, 15)); |
2061 child->setContentBounds(gfx::Size(14, 15)); | 2062 child->setContentBounds(gfx::Size(14, 15)); |
2062 child->setDrawsContent(true); | 2063 child->setDrawsContent(true); |
2063 root->setAnchorPoint(gfx::PointF(0, 0)); | 2064 root->setAnchorPoint(gfx::PointF(0, 0)); |
2064 root->setBounds(gfx::Size(500, 500)); | 2065 root->setBounds(gfx::Size(500, 500)); |
2065 root->setContentBounds(gfx::Size(500, 500)); | 2066 root->setContentBounds(gfx::Size(500, 500)); |
2066 root->setDrawsContent(true); | 2067 root->setDrawsContent(true); |
2067 root->addChild(child.Pass()); | 2068 root->addChild(child.Pass()); |
(...skipping 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4891 { | 4892 { |
4892 pinchZoomPanViewportAndScrollBoundaryTest(2); | 4893 pinchZoomPanViewportAndScrollBoundaryTest(2); |
4893 } | 4894 } |
4894 | 4895 |
4895 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4896 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4896 LayerTreeHostImplTest, | 4897 LayerTreeHostImplTest, |
4897 ::testing::Values(false, true)); | 4898 ::testing::Values(false, true)); |
4898 | 4899 |
4899 } // namespace | 4900 } // namespace |
4900 } // namespace cc | 4901 } // namespace cc |
OLD | NEW |