| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 IntPoint m_initialScroll; | 1250 IntPoint m_initialScroll; |
| 1251 IntSize m_scrollAmount; | 1251 IntSize m_scrollAmount; |
| 1252 int m_scrolls; | 1252 int m_scrolls; |
| 1253 }; | 1253 }; |
| 1254 | 1254 |
| 1255 TEST_F(CCLayerTreeHostTestScrollMultipleRedraw, DISABLED_runMultiThread) | 1255 TEST_F(CCLayerTreeHostTestScrollMultipleRedraw, DISABLED_runMultiThread) |
| 1256 { | 1256 { |
| 1257 runTestThreaded(); | 1257 runTestThreaded(); |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 // This test verifies that properties on the layer tree host are commited to the
impl side. |
| 1261 class CCLayerTreeHostTestCommit : public CCLayerTreeHostTest { |
| 1262 public: |
| 1263 |
| 1264 CCLayerTreeHostTestCommit() { } |
| 1265 |
| 1266 virtual void beginTest() |
| 1267 { |
| 1268 m_layerTreeHost->setViewportSize(IntSize(20, 20)); |
| 1269 m_layerTreeHost->setBackgroundColor(Color::gray); |
| 1270 m_layerTreeHost->setPageScaleFactorAndLimits(5, 5, 5); |
| 1271 |
| 1272 postSetNeedsCommitToMainThread(); |
| 1273 } |
| 1274 |
| 1275 virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) |
| 1276 { |
| 1277 EXPECT_EQ(IntSize(20, 20), impl->viewportSize()); |
| 1278 EXPECT_EQ(Color::gray, impl->backgroundColor()); |
| 1279 EXPECT_EQ(5, impl->pageScale()); |
| 1280 |
| 1281 endTest(); |
| 1282 } |
| 1283 |
| 1284 virtual void afterTest() { } |
| 1285 }; |
| 1286 |
| 1287 TEST_F(CCLayerTreeHostTestCommit, runTest) |
| 1288 { |
| 1289 runTest(true); |
| 1290 } |
| 1291 |
| 1260 // Verifies that startPageScaleAnimation events propagate correctly from CCLayer
TreeHost to | 1292 // Verifies that startPageScaleAnimation events propagate correctly from CCLayer
TreeHost to |
| 1261 // CCLayerTreeHostImpl in the MT compositor. | 1293 // CCLayerTreeHostImpl in the MT compositor. |
| 1262 class CCLayerTreeHostTestStartPageScaleAnimation : public CCLayerTreeHostTest { | 1294 class CCLayerTreeHostTestStartPageScaleAnimation : public CCLayerTreeHostTest { |
| 1263 public: | 1295 public: |
| 1264 | 1296 |
| 1265 CCLayerTreeHostTestStartPageScaleAnimation() | 1297 CCLayerTreeHostTestStartPageScaleAnimation() |
| 1266 : m_animationRequested(false) | 1298 : m_animationRequested(false) |
| 1267 { | 1299 { |
| 1268 } | 1300 } |
| 1269 | 1301 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 public: | 1786 public: |
| 1755 static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLaye
rChromium()); } | 1787 static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLaye
rChromium()); } |
| 1756 | 1788 |
| 1757 virtual void paintContentsIfDirty(const CCOcclusionTracker* occlusion) | 1789 virtual void paintContentsIfDirty(const CCOcclusionTracker* occlusion) |
| 1758 { | 1790 { |
| 1759 m_occludedScreenSpace = occlusion ? occlusion->currentOcclusionInScreenS
pace() : Region(); | 1791 m_occludedScreenSpace = occlusion ? occlusion->currentOcclusionInScreenS
pace() : Region(); |
| 1760 } | 1792 } |
| 1761 | 1793 |
| 1762 virtual bool drawsContent() const { return true; } | 1794 virtual bool drawsContent() const { return true; } |
| 1763 | 1795 |
| 1764 virtual Region visibleContentOpaqueRegion() const { return intersection(m_op
aqueContentsRect, visibleLayerRect()); } | |
| 1765 void setOpaqueContentsRect(const IntRect& opaqueContentsRect) { m_opaqueCont
entsRect = opaqueContentsRect; } | |
| 1766 | |
| 1767 const Region& occludedScreenSpace() const { return m_occludedScreenSpace; } | 1796 const Region& occludedScreenSpace() const { return m_occludedScreenSpace; } |
| 1768 void clearOccludedScreenSpace() { m_occludedScreenSpace = Region(); } | 1797 void clearOccludedScreenSpace() { m_occludedScreenSpace = Region(); } |
| 1769 | 1798 |
| 1770 private: | 1799 private: |
| 1771 TestLayerChromium() : LayerChromium() { } | 1800 TestLayerChromium() : LayerChromium() { } |
| 1772 | 1801 |
| 1773 Region m_occludedScreenSpace; | 1802 Region m_occludedScreenSpace; |
| 1774 IntRect m_opaqueContentsRect; | |
| 1775 }; | 1803 }; |
| 1776 | 1804 |
| 1777 static void setLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium
* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const
FloatPoint& position, const IntSize& bounds, bool opaque) | 1805 static void setLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium
* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const
FloatPoint& position, const IntSize& bounds, bool opaque) |
| 1778 { | 1806 { |
| 1779 layer->removeAllChildren(); | 1807 layer->removeAllChildren(); |
| 1780 if (parent) | 1808 if (parent) |
| 1781 parent->addChild(layer); | 1809 parent->addChild(layer); |
| 1782 layer->setTransform(transform); | 1810 layer->setTransform(transform); |
| 1783 layer->setAnchorPoint(anchor); | 1811 layer->setAnchorPoint(anchor); |
| 1784 layer->setPosition(position); | 1812 layer->setPosition(position); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1981 endTest(); | 2009 endTest(); |
| 1982 } | 2010 } |
| 1983 | 2011 |
| 1984 virtual void afterTest() | 2012 virtual void afterTest() |
| 1985 { | 2013 { |
| 1986 } | 2014 } |
| 1987 }; | 2015 }; |
| 1988 | 2016 |
| 1989 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLayerOcclusion) | 2017 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLayerOcclusion) |
| 1990 | 2018 |
| 1991 class CCLayerTreeHostTestContentLayerOcclusion : public CCLayerTreeHostTest { | |
| 1992 public: | |
| 1993 CCLayerTreeHostTestContentLayerOcclusion() { } | |
| 1994 | |
| 1995 virtual void beginTest() | |
| 1996 { | |
| 1997 RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create(); | |
| 1998 RefPtr<TestLayerChromium> child = TestLayerChromium::create(); | |
| 1999 | |
| 2000 TransformationMatrix identityMatrix; | |
| 2001 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo
int(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); | |
| 2002 setLayerPropertiesForTesting(child.get(), rootLayer.get(), identityMatri
x, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(50, 50), false); | |
| 2003 | |
| 2004 child->setOpaqueContentsRect(IntRect(10, 10, 20, 20)); | |
| 2005 | |
| 2006 m_layerTreeHost->setRootLayer(rootLayer); | |
| 2007 m_layerTreeHost->setViewportSize(rootLayer->bounds()); | |
| 2008 m_layerTreeHost->updateLayers(); | |
| 2009 m_layerTreeHost->commitComplete(); | |
| 2010 | |
| 2011 EXPECT_EQ_RECT(IntRect(), child->occludedScreenSpace().bounds()); | |
| 2012 EXPECT_EQ(0u, child->occludedScreenSpace().rects().size()); | |
| 2013 | |
| 2014 EXPECT_EQ_RECT(IntRect(40, 40, 20, 20), rootLayer->occludedScreenSpace()
.bounds()); | |
| 2015 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | |
| 2016 | |
| 2017 // Kill the layerTreeHost immediately. | |
| 2018 m_layerTreeHost->setRootLayer(0); | |
| 2019 m_layerTreeHost.clear(); | |
| 2020 | |
| 2021 endTest(); | |
| 2022 } | |
| 2023 | |
| 2024 virtual void afterTest() | |
| 2025 { | |
| 2026 } | |
| 2027 }; | |
| 2028 | |
| 2029 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestContentLayerOcclusion) | |
| 2030 | |
| 2031 class CCLayerTreeHostTestLayerOcclusionWithFilters : public CCLayerTreeHostTest
{ | 2019 class CCLayerTreeHostTestLayerOcclusionWithFilters : public CCLayerTreeHostTest
{ |
| 2032 public: | 2020 public: |
| 2033 CCLayerTreeHostTestLayerOcclusionWithFilters() { } | 2021 CCLayerTreeHostTestLayerOcclusionWithFilters() { } |
| 2034 | 2022 |
| 2035 virtual void beginTest() | 2023 virtual void beginTest() |
| 2036 { | 2024 { |
| 2037 RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create(); | 2025 RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create(); |
| 2038 RefPtr<TestLayerChromium> child = TestLayerChromium::create(); | 2026 RefPtr<TestLayerChromium> child = TestLayerChromium::create(); |
| 2039 RefPtr<TestLayerChromium> child2 = TestLayerChromium::create(); | 2027 RefPtr<TestLayerChromium> child2 = TestLayerChromium::create(); |
| 2040 RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create(); | 2028 RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create(); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2289 private: | 2277 private: |
| 2290 FloatSize m_scrollAmount; | 2278 FloatSize m_scrollAmount; |
| 2291 }; | 2279 }; |
| 2292 | 2280 |
| 2293 TEST_F(CCLayerTreeHostTestFractionalScroll, runMultiThread) | 2281 TEST_F(CCLayerTreeHostTestFractionalScroll, runMultiThread) |
| 2294 { | 2282 { |
| 2295 runTestThreaded(); | 2283 runTestThreaded(); |
| 2296 } | 2284 } |
| 2297 | 2285 |
| 2298 } // namespace | 2286 } // namespace |
| OLD | NEW |