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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 public LayerTreeHostImplClient { | 60 public LayerTreeHostImplClient { |
61 public: | 61 public: |
62 LayerTreeHostImplTest() | 62 LayerTreeHostImplTest() |
63 : m_proxy(scoped_ptr<Thread>(NULL)) | 63 : m_proxy(scoped_ptr<Thread>(NULL)) |
64 , m_alwaysImplThread(&m_proxy) | 64 , m_alwaysImplThread(&m_proxy) |
65 , m_alwaysMainThreadBlocked(&m_proxy) | 65 , m_alwaysMainThreadBlocked(&m_proxy) |
66 , m_onCanDrawStateChangedCalled(false) | 66 , m_onCanDrawStateChangedCalled(false) |
67 , m_hasPendingTree(false) | 67 , m_hasPendingTree(false) |
68 , m_didRequestCommit(false) | 68 , m_didRequestCommit(false) |
69 , m_didRequestRedraw(false) | 69 , m_didRequestRedraw(false) |
70 , m_didSwapUseIncompleteTexture(false) | 70 , m_didSwapUseIncompleteTile(false) |
71 , m_didUploadVisibleHighResolutionTile(false) | 71 , m_didUploadVisibleHighResolutionTile(false) |
72 , m_reduceMemoryResult(true) | 72 , m_reduceMemoryResult(true) |
73 { | 73 { |
74 media::InitializeMediaLibraryForTesting(); | 74 media::InitializeMediaLibraryForTesting(); |
75 } | 75 } |
76 | 76 |
77 virtual void SetUp() | 77 virtual void SetUp() |
78 { | 78 { |
79 LayerTreeSettings settings; | 79 LayerTreeSettings settings; |
80 settings.minimumOcclusionTrackingSize = gfx::Size(); | 80 settings.minimumOcclusionTrackingSize = gfx::Size(); |
81 settings.pageScalePinchZoomEnabled = GetParam(); | 81 settings.pageScalePinchZoomEnabled = GetParam(); |
82 | 82 |
83 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); | 83 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
84 m_hostImpl->initializeRenderer(createOutputSurface()); | 84 m_hostImpl->initializeRenderer(createOutputSurface()); |
85 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 85 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); |
86 } | 86 } |
87 | 87 |
88 virtual void TearDown() | 88 virtual void TearDown() |
89 { | 89 { |
90 } | 90 } |
91 | 91 |
92 virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { } | 92 virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { } |
93 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } | 93 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } |
94 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER
RIDE { } | 94 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER
RIDE { } |
95 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } | 95 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } |
96 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE { m_
hasPendingTree = hasPendingTree; } | 96 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE { m_
hasPendingTree = hasPendingTree; } |
97 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } | 97 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } |
98 virtual void didSwapUseIncompleteTextureOnImplThread() OVERRIDE { m_didSwapU
seIncompleteTexture = true; } | 98 virtual void didSwapUseIncompleteTileOnImplThread() OVERRIDE { m_didSwapUseI
ncompleteTile = true; } |
99 virtual void didUploadVisibleHighResolutionTileOnImplTread() OVERRIDE { m_di
dUploadVisibleHighResolutionTile = true; } | 99 virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE { m_d
idUploadVisibleHighResolutionTile = true; } |
100 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } | 100 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } |
101 virtual void setNeedsManageTilesOnImplThread() OVERRIDE { } | 101 virtual void setNeedsManageTilesOnImplThread() OVERRIDE { } |
102 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) OVERRIDE { } | 102 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) OVERRIDE { } |
103 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) OVERRIDE { return m_reduceMemoryResult; } | 103 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) OVERRIDE { return m_reduceMemoryResult; } |
104 virtual void sendManagedMemoryStats() OVERRIDE { } | 104 virtual void sendManagedMemoryStats() OVERRIDE { } |
105 virtual bool isInsideDraw() OVERRIDE { return false; } | 105 virtual bool isInsideDraw() OVERRIDE { return false; } |
106 virtual void renewTreePriority() OVERRIDE { } | 106 virtual void renewTreePriority() OVERRIDE { } |
107 | 107 |
108 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult =
reduceMemoryResult; } | 108 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult =
reduceMemoryResult; } |
109 | 109 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 FakeProxy m_proxy; | 223 FakeProxy m_proxy; |
224 DebugScopedSetImplThread m_alwaysImplThread; | 224 DebugScopedSetImplThread m_alwaysImplThread; |
225 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; | 225 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; |
226 | 226 |
227 scoped_ptr<LayerTreeHostImpl> m_hostImpl; | 227 scoped_ptr<LayerTreeHostImpl> m_hostImpl; |
228 bool m_onCanDrawStateChangedCalled; | 228 bool m_onCanDrawStateChangedCalled; |
229 bool m_hasPendingTree; | 229 bool m_hasPendingTree; |
230 bool m_didRequestCommit; | 230 bool m_didRequestCommit; |
231 bool m_didRequestRedraw; | 231 bool m_didRequestRedraw; |
232 bool m_didSwapUseIncompleteTexture; | 232 bool m_didSwapUseIncompleteTile; |
233 bool m_didUploadVisibleHighResolutionTile; | 233 bool m_didUploadVisibleHighResolutionTile; |
234 bool m_reduceMemoryResult; | 234 bool m_reduceMemoryResult; |
235 }; | 235 }; |
236 | 236 |
237 class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D
{ | 237 class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D
{ |
238 public: | 238 public: |
239 virtual bool makeContextCurrent() { return false; } | 239 virtual bool makeContextCurrent() { return false; } |
240 }; | 240 }; |
241 | 241 |
242 TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged) | 242 TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged) |
(...skipping 4433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4676 m_hostImpl->didDrawAllLayers(frame); | 4676 m_hostImpl->didDrawAllLayers(frame); |
4677 } | 4677 } |
4678 } | 4678 } |
4679 | 4679 |
4680 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4680 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4681 LayerTreeHostImplTest, | 4681 LayerTreeHostImplTest, |
4682 ::testing::Values(false, true)); | 4682 ::testing::Values(false, true)); |
4683 | 4683 |
4684 } // namespace | 4684 } // namespace |
4685 } // namespace cc | 4685 } // namespace cc |
OLD | NEW |