Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11447028: cc: Split out calcDrawEtc from drawLayers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/test/fake_layer_tree_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 408
409 TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndScroll) 409 TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndScroll)
410 { 410 {
411 setupScrollAndContentsLayers(gfx::Size(100, 100)); 411 setupScrollAndContentsLayers(gfx::Size(100, 100));
412 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); 412 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
413 initializeRendererAndDrawFrame(); 413 initializeRendererAndDrawFrame();
414 414
415 // We should be able to scroll even if the root layer loses its render surfa ce after the most 415 // We should be able to scroll even if the root layer loses its render surfa ce after the most
416 // recent render. 416 // recent render.
417 m_hostImpl->rootLayer()->clearRenderSurface(); 417 m_hostImpl->rootLayer()->clearRenderSurface();
418 m_hostImpl->setNeedsUpdateDrawProperties();
419
418 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Whee l), InputHandlerClient::ScrollStarted); 420 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Whee l), InputHandlerClient::ScrollStarted);
419 } 421 }
420 422
421 TEST_P(LayerTreeHostImplTest, wheelEventHandlers) 423 TEST_P(LayerTreeHostImplTest, wheelEventHandlers)
422 { 424 {
423 setupScrollAndContentsLayers(gfx::Size(100, 100)); 425 setupScrollAndContentsLayers(gfx::Size(100, 100));
424 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); 426 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
425 initializeRendererAndDrawFrame(); 427 initializeRendererAndDrawFrame();
426 LayerImpl* root = m_hostImpl->rootLayer(); 428 LayerImpl* root = m_hostImpl->rootLayer();
427 429
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 gfx::Rect layerRect(0, 0, 0, 0); 1926 gfx::Rect layerRect(0, 0, 0, 0);
1925 child->setPosition(layerRect.origin()); 1927 child->setPosition(layerRect.origin());
1926 child->setBounds(layerRect.size()); 1928 child->setBounds(layerRect.size());
1927 child->setContentBounds(layerRect.size()); 1929 child->setContentBounds(layerRect.size());
1928 child->setQuadRect(gfx::Rect(gfx::Point(), layerRect.size())); 1930 child->setQuadRect(gfx::Rect(gfx::Point(), layerRect.size()));
1929 child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size())); 1931 child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size()));
1930 1932
1931 LayerTreeHostImpl::FrameData frame; 1933 LayerTreeHostImpl::FrameData frame;
1932 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); 1934 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
1933 ASSERT_EQ(1u, frame.renderPasses.size()); 1935 ASSERT_EQ(1u, frame.renderPasses.size());
1934 m_hostImpl->didDrawAllLayers(frame);
1935 1936
1936 size_t numGutterQuads = 0; 1937 size_t numGutterQuads = 0;
1937 for (size_t i = 0; i < frame.renderPasses[0]->quad_list.size(); ++i) 1938 for (size_t i = 0; i < frame.renderPasses[0]->quad_list.size(); ++i)
1938 numGutterQuads += (frame.renderPasses[0]->quad_list[i]->material == DrawQuad::SOLID_COLOR) ? 1 : 0; 1939 numGutterQuads += (frame.renderPasses[0]->quad_list[i]->material == DrawQuad::SOLID_COLOR) ? 1 : 0;
1939 EXPECT_EQ(1u, numGutterQuads); 1940 EXPECT_EQ(1u, numGutterQuads);
1940 EXPECT_EQ(1u, frame.renderPasses[0]->quad_list.size()); 1941 EXPECT_EQ(1u, frame.renderPasses[0]->quad_list.size());
1941 1942
1942 verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quad_list, gfx::Rect( gfx::Point(), viewportSize)); 1943 verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quad_list, gfx::Rect( gfx::Point(), viewportSize));
1943 m_hostImpl->didDrawAllLayers(frame); 1944 m_hostImpl->didDrawAllLayers(frame);
1944 } 1945 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack erContext*>(outputSurface->Context3D()); 2044 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack erContext*>(outputSurface->Context3D());
2044 2045
2045 // This test creates its own LayerTreeHostImpl, so 2046 // This test creates its own LayerTreeHostImpl, so
2046 // that we can force partial swap enabled. 2047 // that we can force partial swap enabled.
2047 LayerTreeSettings settings; 2048 LayerTreeSettings settings;
2048 settings.partialSwapEnabled = true; 2049 settings.partialSwapEnabled = true;
2049 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create( settings, this, &m_proxy); 2050 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create( settings, this, &m_proxy);
2050 layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); 2051 layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
2051 layerTreeHostImpl->setViewportSize(gfx::Size(500, 500), gfx::Size(500, 500)) ; 2052 layerTreeHostImpl->setViewportSize(gfx::Size(500, 500), gfx::Size(500, 500)) ;
2052 2053
2053 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(m_hostImpl.get(), 1); 2054 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(layerTreeHostImpl .get(), 1);
2054 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(m_hostImpl.get() , 2); 2055 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(layerTreeHostImp l.get(), 2);
2055 child->setPosition(gfx::PointF(12, 13)); 2056 child->setPosition(gfx::PointF(12, 13));
2056 child->setAnchorPoint(gfx::PointF(0, 0)); 2057 child->setAnchorPoint(gfx::PointF(0, 0));
2057 child->setBounds(gfx::Size(14, 15)); 2058 child->setBounds(gfx::Size(14, 15));
2058 child->setContentBounds(gfx::Size(14, 15)); 2059 child->setContentBounds(gfx::Size(14, 15));
2059 child->setDrawsContent(true); 2060 child->setDrawsContent(true);
2060 root->setAnchorPoint(gfx::PointF(0, 0)); 2061 root->setAnchorPoint(gfx::PointF(0, 0));
2061 root->setBounds(gfx::Size(500, 500)); 2062 root->setBounds(gfx::Size(500, 500));
2062 root->setContentBounds(gfx::Size(500, 500)); 2063 root->setContentBounds(gfx::Size(500, 500));
2063 root->setDrawsContent(true); 2064 root->setDrawsContent(true);
2064 root->addChild(child.Pass()); 2065 root->addChild(child.Pass());
(...skipping 2862 matching lines...) Expand 10 before | Expand all | Expand 10 after
4927 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); 4928 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize());
4928 drawFrameAndTestDamage(noDamage); 4929 drawFrameAndTestDamage(noDamage);
4929 } 4930 }
4930 4931
4931 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4932 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4932 LayerTreeHostImplTest, 4933 LayerTreeHostImplTest,
4933 ::testing::Values(false, true)); 4934 ::testing::Values(false, true));
4934 4935
4935 } // namespace 4936 } // namespace
4936 } // namespace cc 4937 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/test/fake_layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698