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

Side by Side Diff: Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp

Issue 10146014: Merge 113677 - [chromium] Viewport is not filled when out of texture memory on mac (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 8 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #define EXPECT_EQ_RECT(a, b) \ 46 #define EXPECT_EQ_RECT(a, b) \
47 EXPECT_EQ(a.x(), b.x()); \ 47 EXPECT_EQ(a.x(), b.x()); \
48 EXPECT_EQ(a.y(), b.y()); \ 48 EXPECT_EQ(a.y(), b.y()); \
49 EXPECT_EQ(a.width(), b.width()); \ 49 EXPECT_EQ(a.width(), b.width()); \
50 EXPECT_EQ(a.height(), b.height()); 50 EXPECT_EQ(a.height(), b.height());
51 51
52 namespace { 52 namespace {
53 53
54 class TestContentLayerChromium : public LayerChromium { 54 class TestContentLayerChromium : public LayerChromium {
55 public: 55 public:
56 TestContentLayerChromium() : LayerChromium() { } 56 TestContentLayerChromium()
57 : LayerChromium()
58 , m_overrideOpaqueContentsRect(false)
59 {
60 }
57 61
58 virtual bool drawsContent() const { return true; } 62 virtual bool drawsContent() const { return true; }
59 virtual Region visibleContentOpaqueRegion() const { return intersection(m_op aqueContentsRect, visibleLayerRect()); } 63 virtual Region visibleContentOpaqueRegion() const
60 void setOpaqueContentsRect(const IntRect& opaqueContentsRect) { m_opaqueCont entsRect = opaqueContentsRect; } 64 {
65 if (m_overrideOpaqueContentsRect)
66 return intersection(m_opaqueContentsRect, visibleLayerRect());
67 return LayerChromium::visibleContentOpaqueRegion();
68 }
69 void setOpaqueContentsRect(const IntRect& opaqueContentsRect)
70 {
71 m_overrideOpaqueContentsRect = true;
72 m_opaqueContentsRect = opaqueContentsRect;
73 }
61 74
62 private: 75 private:
76 bool m_overrideOpaqueContentsRect;
63 IntRect m_opaqueContentsRect; 77 IntRect m_opaqueContentsRect;
64 }; 78 };
65 79
66 class TestContentLayerImpl : public CCLayerImpl { 80 class TestContentLayerImpl : public CCLayerImpl {
67 public: 81 public:
68 TestContentLayerImpl(int id) : CCLayerImpl(id) { setDrawsContent(true); } 82 TestContentLayerImpl(int id)
83 : CCLayerImpl(id)
84 , m_overrideOpaqueContentsRect(false)
85 {
86 setDrawsContent(true);
87 }
69 88
70 virtual Region visibleContentOpaqueRegion() const { return intersection(m_op aqueContentsRect, visibleLayerRect()); } 89 virtual Region visibleContentOpaqueRegion() const
71 void setOpaqueContentsRect(const IntRect& opaqueContentsRect) { m_opaqueCont entsRect = opaqueContentsRect; } 90 {
91 if (m_overrideOpaqueContentsRect)
92 return intersection(m_opaqueContentsRect, visibleLayerRect());
93 return CCLayerImpl::visibleContentOpaqueRegion();
94 }
95 void setOpaqueContentsRect(const IntRect& opaqueContentsRect)
96 {
97 m_overrideOpaqueContentsRect = true;
98 m_opaqueContentsRect = opaqueContentsRect;
99 }
100
72 private: 101 private:
102 bool m_overrideOpaqueContentsRect;
73 IntRect m_opaqueContentsRect; 103 IntRect m_opaqueContentsRect;
74 }; 104 };
75 105
76 // A subclass to expose the total current occlusion. 106 // A subclass to expose the total current occlusion.
77 template<typename LayerType, typename RenderSurfaceType> 107 template<typename LayerType, typename RenderSurfaceType>
78 class TestCCOcclusionTrackerBase : public CCOcclusionTrackerBase<LayerType, Rend erSurfaceType> { 108 class TestCCOcclusionTrackerBase : public CCOcclusionTrackerBase<LayerType, Rend erSurfaceType> {
79 public: 109 public:
80 TestCCOcclusionTrackerBase(IntRect screenScissorRect, bool recordMetricsForF rame = false) 110 TestCCOcclusionTrackerBase(IntRect screenScissorRect, bool recordMetricsForF rame = false)
81 : CCOcclusionTrackerBase<LayerType, RenderSurfaceType>(screenScissorRect , recordMetricsForFrame) 111 : CCOcclusionTrackerBase<LayerType, RenderSurfaceType>(screenScissorRect , recordMetricsForFrame)
82 , m_overrideLayerScissorRect(false) 112 , m_overrideLayerScissorRect(false)
(...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace ().bounds()); 1944 EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace ().bounds());
1915 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1945 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1916 EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurfa ce().bounds()); 1946 EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurfa ce().bounds());
1917 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 1947 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
1918 } 1948 }
1919 }; 1949 };
1920 1950
1921 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithCl ipping); 1951 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithCl ipping);
1922 1952
1923 } // namespace 1953 } // namespace
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp ('k') | Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698