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

Side by Side Diff: cc/layer_tree_host_unittest.cc

Issue 11474050: cc: Unify namespaces for all test files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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_perftest.cc ('k') | cc/occlusion_tracker_unittest.cc » ('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.h" 5 #include "cc/layer_tree_host.h"
6 6
7 #include "base/synchronization/lock.h" 7 #include "base/synchronization/lock.h"
8 #include "cc/content_layer.h" 8 #include "cc/content_layer.h"
9 #include "cc/content_layer_client.h" 9 #include "cc/content_layer_client.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 12 matching lines...) Expand all
23 #include "cc/timing_function.h" 23 #include "cc/timing_function.h"
24 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
25 #include "third_party/khronos/GLES2/gl2.h" 25 #include "third_party/khronos/GLES2/gl2.h"
26 #include "third_party/khronos/GLES2/gl2ext.h" 26 #include "third_party/khronos/GLES2/gl2ext.h"
27 #include "ui/gfx/point_conversions.h" 27 #include "ui/gfx/point_conversions.h"
28 #include "ui/gfx/size_conversions.h" 28 #include "ui/gfx/size_conversions.h"
29 #include "ui/gfx/vector2d_conversions.h" 29 #include "ui/gfx/vector2d_conversions.h"
30 #include <public/WebLayerScrollClient.h> 30 #include <public/WebLayerScrollClient.h>
31 #include <public/WebSize.h> 31 #include <public/WebSize.h>
32 32
33 using namespace WebKit;
34 using namespace WebKitTests;
35
36 namespace cc { 33 namespace cc {
37 namespace { 34 namespace {
38 35
39 class LayerTreeHostTest : public ThreadedTest { }; 36 class LayerTreeHostTest : public ThreadedTest { };
40 37
41 // Shortlived layerTreeHosts shouldn't die. 38 // Shortlived layerTreeHosts shouldn't die.
42 class LayerTreeHostTestShortlived1 : public LayerTreeHostTest { 39 class LayerTreeHostTestShortlived1 : public LayerTreeHostTest {
43 public: 40 public:
44 LayerTreeHostTestShortlived1() { } 41 LayerTreeHostTestShortlived1() { }
45 42
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 child->setMasksToBounds(true); 1848 child->setMasksToBounds(true);
1852 1849
1853 // If the child layer has a filter that changes alpha values, and is bel ow child2, then child2 should contribute to occlusion on everything, 1850 // If the child layer has a filter that changes alpha values, and is bel ow child2, then child2 should contribute to occlusion on everything,
1854 // and child shouldn't contribute to the rootLayer 1851 // and child shouldn't contribute to the rootLayer
1855 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx ::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); 1852 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx ::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
1856 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); 1853 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
1857 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); 1854 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
1858 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); 1855 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
1859 1856
1860 { 1857 {
1861 WebFilterOperations filters; 1858 WebKit::WebFilterOperations filters;
1862 filters.append(WebFilterOperation::createOpacityFilter(0.5)); 1859 filters.append(WebKit::WebFilterOperation::createOpacityFilter(0.5)) ;
1863 child->setFilters(filters); 1860 child->setFilters(filters);
1864 } 1861 }
1865 1862
1866 m_layerTreeHost->setRootLayer(rootLayer); 1863 m_layerTreeHost->setRootLayer(rootLayer);
1867 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1864 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1868 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); 1865 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded());
1869 ResourceUpdateQueue queue; 1866 ResourceUpdateQueue queue;
1870 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1867 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1871 m_layerTreeHost->commitComplete(); 1868 m_layerTreeHost->commitComplete();
1872 1869
1873 EXPECT_EQ(gfx::Rect().ToString(), child2->occludedScreenSpace().ToString ()); 1870 EXPECT_EQ(gfx::Rect().ToString(), child2->occludedScreenSpace().ToString ());
1874 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), grandChild->occludedSc reenSpace().ToString()); 1871 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), grandChild->occludedSc reenSpace().ToString());
1875 EXPECT_EQ(UnionRegions(gfx::Rect(30, 40, 170, 30), gfx::Rect(10, 70, 190 , 130)).ToString(), child->occludedScreenSpace().ToString()); 1872 EXPECT_EQ(UnionRegions(gfx::Rect(30, 40, 170, 30), gfx::Rect(10, 70, 190 , 130)).ToString(), child->occludedScreenSpace().ToString());
1876 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), rootLayer->occludedScr eenSpace().ToString()); 1873 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), rootLayer->occludedScr eenSpace().ToString());
1877 1874
1878 // If the child layer has a filter that moves pixels/changes alpha, and is below child2, then child should not inherit occlusion from outside its subtre e, 1875 // If the child layer has a filter that moves pixels/changes alpha, and is below child2, then child should not inherit occlusion from outside its subtre e,
1879 // and should not contribute to the rootLayer 1876 // and should not contribute to the rootLayer
1880 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx ::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); 1877 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx ::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
1881 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); 1878 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
1882 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); 1879 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
1883 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); 1880 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
1884 1881
1885 { 1882 {
1886 WebFilterOperations filters; 1883 WebKit::WebFilterOperations filters;
1887 filters.append(WebFilterOperation::createBlurFilter(10)); 1884 filters.append(WebKit::WebFilterOperation::createBlurFilter(10));
1888 child->setFilters(filters); 1885 child->setFilters(filters);
1889 } 1886 }
1890 1887
1891 m_layerTreeHost->setRootLayer(rootLayer); 1888 m_layerTreeHost->setRootLayer(rootLayer);
1892 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1889 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1893 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1890 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1894 m_layerTreeHost->commitComplete(); 1891 m_layerTreeHost->commitComplete();
1895 1892
1896 EXPECT_EQ(gfx::Rect().ToString(), child2->occludedScreenSpace().ToString ()); 1893 EXPECT_EQ(gfx::Rect().ToString(), child2->occludedScreenSpace().ToString ());
1897 EXPECT_EQ(gfx::Rect().ToString(), grandChild->occludedScreenSpace().ToSt ring()); 1894 EXPECT_EQ(gfx::Rect().ToString(), grandChild->occludedScreenSpace().ToSt ring());
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 } 2173 }
2177 2174
2178 virtual void afterTest() OVERRIDE { } 2175 virtual void afterTest() OVERRIDE { }
2179 2176
2180 private: 2177 private:
2181 bool m_addedAnimation; 2178 bool m_addedAnimation;
2182 }; 2179 };
2183 2180
2184 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLayerAddedWithAnimation) 2181 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLayerAddedWithAnimation)
2185 2182
2186 class LayerTreeHostTestScrollChildLayer : public LayerTreeHostTest, public WebLa yerScrollClient { 2183 class LayerTreeHostTestScrollChildLayer : public LayerTreeHostTest, public WebKi t::WebLayerScrollClient {
2187 public: 2184 public:
2188 LayerTreeHostTestScrollChildLayer(float deviceScaleFactor) 2185 LayerTreeHostTestScrollChildLayer(float deviceScaleFactor)
2189 : m_deviceScaleFactor(deviceScaleFactor) 2186 : m_deviceScaleFactor(deviceScaleFactor)
2190 , m_initialScroll(10, 20) 2187 , m_initialScroll(10, 20)
2191 , m_secondScroll(40, 5) 2188 , m_secondScroll(40, 5)
2192 , m_scrollAmount(2, -1) 2189 , m_scrollAmount(2, -1)
2193 , m_rootScrolls(0) 2190 , m_rootScrolls(0)
2194 { 2191 {
2195 } 2192 }
2196 2193
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
2917 2914
2918 private: 2915 private:
2919 FakeContentLayerClient m_client; 2916 FakeContentLayerClient m_client;
2920 scoped_refptr<EvictionTestLayer> m_layer; 2917 scoped_refptr<EvictionTestLayer> m_layer;
2921 LayerTreeHostImpl* m_implForEvictTextures; 2918 LayerTreeHostImpl* m_implForEvictTextures;
2922 int m_numCommits; 2919 int m_numCommits;
2923 }; 2920 };
2924 2921
2925 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLostContextAfterEvictTextures) 2922 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLostContextAfterEvictTextures)
2926 2923
2927 class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public WebKit::CompositorFakeWebGraphicsContext3D { 2924 class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public CompositorFakeWebGraphicsContext3D {
2928 public: 2925 public:
2929 static scoped_ptr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostC ontext> create(Attributes attrs) 2926 static scoped_ptr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostC ontext> create(Attributes attrs)
2930 { 2927 {
2931 return make_scoped_ptr(new CompositorFakeWebGraphicsContext3DWithEndQuer yCausingLostContext(attrs)); 2928 return make_scoped_ptr(new CompositorFakeWebGraphicsContext3DWithEndQuer yCausingLostContext(attrs));
2932 } 2929 }
2933 2930
2934 virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback ) { m_contextLostCallback = callback; } 2931 virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback ) { m_contextLostCallback = callback; }
2935 virtual bool isContextLost() { return m_isContextLost; } 2932 virtual bool isContextLost() { return m_isContextLost; }
2936 2933
2937 virtual void beginQueryEXT(WGC3Denum, WebGLId) { } 2934 virtual void beginQueryEXT(WebKit::WGC3Denum, WebKit::WebGLId) { }
2938 virtual void endQueryEXT(WGC3Denum) 2935 virtual void endQueryEXT(WebKit::WGC3Denum)
2939 { 2936 {
2940 // Lose context. 2937 // Lose context.
2941 if (!m_isContextLost) { 2938 if (!m_isContextLost) {
2942 m_contextLostCallback->onContextLost(); 2939 m_contextLostCallback->onContextLost();
2943 m_isContextLost = true; 2940 m_isContextLost = true;
2944 } 2941 }
2945 } 2942 }
2946 virtual void getQueryObjectuivEXT(WebGLId, WGC3Denum pname, WGC3Duint* param s) 2943 virtual void getQueryObjectuivEXT(WebKit::WebGLId, WebKit::WGC3Denum pname, WebKit::WGC3Duint* params)
2947 { 2944 {
2948 // Context is lost. We need to behave as if result is available. 2945 // Context is lost. We need to behave as if result is available.
2949 if (pname == GL_QUERY_RESULT_AVAILABLE_EXT) 2946 if (pname == GL_QUERY_RESULT_AVAILABLE_EXT)
2950 *params = 1; 2947 *params = 1;
2951 } 2948 }
2952 2949
2953 private: 2950 private:
2954 explicit CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(At tributes attrs) 2951 explicit CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(At tributes attrs)
2955 : CompositorFakeWebGraphicsContext3D(attrs) 2952 : CompositorFakeWebGraphicsContext3D(attrs)
2956 , m_contextLostCallback(0) 2953 , m_contextLostCallback(0)
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
3388 LayerTreeSettings settings; 3385 LayerTreeSettings settings;
3389 settings.maxPartialTextureUpdates = 4; 3386 settings.maxPartialTextureUpdates = 4;
3390 3387
3391 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>()); 3388 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>());
3392 EXPECT_TRUE(host->initializeRendererIfNeeded()); 3389 EXPECT_TRUE(host->initializeRendererIfNeeded());
3393 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); 3390 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates);
3394 } 3391 }
3395 3392
3396 } // namespace 3393 } // namespace
3397 } // namespace cc 3394 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_perftest.cc ('k') | cc/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698