| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/trees/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "cc/layers/layer_iterator.h" | 8 #include "cc/layers/layer_iterator.h" |
| 9 #include "cc/layers/solid_color_layer_impl.h" | 9 #include "cc/layers/solid_color_layer_impl.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl_client.h" | 10 #include "cc/test/fake_layer_tree_host_impl_client.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 FakeProxy proxy_; | 64 FakeProxy proxy_; |
| 65 DebugScopedSetImplThread impl_; | 65 DebugScopedSetImplThread impl_; |
| 66 FakeRenderingStatsInstrumentation stats_; | 66 FakeRenderingStatsInstrumentation stats_; |
| 67 scoped_ptr<LayerTreeHostImpl> host_impl_; | 67 scoped_ptr<LayerTreeHostImpl> host_impl_; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) { | 70 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) { |
| 71 SetTestName("unoccluded_content_rect_fully_occluded"); | 71 SetTestName("unoccluded_content_rect_fully_occluded"); |
| 72 | 72 |
| 73 gfx::Rect viewport_rect(768, 1038); | 73 gfx::Rect viewport_rect(768, 1038); |
| 74 OcclusionTracker<LayerImpl> tracker(viewport_rect, false); | 74 OcclusionTracker<LayerImpl> tracker(viewport_rect); |
| 75 | 75 |
| 76 CreateHost(); | 76 CreateHost(); |
| 77 host_impl_->SetViewportSize(viewport_rect.size()); | 77 host_impl_->SetViewportSize(viewport_rect.size()); |
| 78 | 78 |
| 79 scoped_ptr<SolidColorLayerImpl> opaque_layer = | 79 scoped_ptr<SolidColorLayerImpl> opaque_layer = |
| 80 SolidColorLayerImpl::Create(active_tree(), 2); | 80 SolidColorLayerImpl::Create(active_tree(), 2); |
| 81 opaque_layer->SetBackgroundColor(SK_ColorRED); | 81 opaque_layer->SetBackgroundColor(SK_ColorRED); |
| 82 opaque_layer->SetContentsOpaque(true); | 82 opaque_layer->SetContentsOpaque(true); |
| 83 opaque_layer->SetDrawsContent(true); | 83 opaque_layer->SetDrawsContent(true); |
| 84 opaque_layer->SetBounds(viewport_rect.size()); | 84 opaque_layer->SetBounds(viewport_rect.size()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 EXPECT_EQ(end, begin); | 130 EXPECT_EQ(end, begin); |
| 131 | 131 |
| 132 PrintResults(); | 132 PrintResults(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_10OpaqueLayers) { | 135 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_10OpaqueLayers) { |
| 136 static const int kNumOpaqueLayers = 10; | 136 static const int kNumOpaqueLayers = 10; |
| 137 SetTestName("unoccluded_content_rect_10_opaque_layers"); | 137 SetTestName("unoccluded_content_rect_10_opaque_layers"); |
| 138 | 138 |
| 139 gfx::Rect viewport_rect(768, 1038); | 139 gfx::Rect viewport_rect(768, 1038); |
| 140 OcclusionTracker<LayerImpl> tracker(viewport_rect, false); | 140 OcclusionTracker<LayerImpl> tracker(viewport_rect); |
| 141 | 141 |
| 142 CreateHost(); | 142 CreateHost(); |
| 143 host_impl_->SetViewportSize(viewport_rect.size()); | 143 host_impl_->SetViewportSize(viewport_rect.size()); |
| 144 | 144 |
| 145 for (int i = 0; i < kNumOpaqueLayers; ++i) { | 145 for (int i = 0; i < kNumOpaqueLayers; ++i) { |
| 146 scoped_ptr<SolidColorLayerImpl> opaque_layer = | 146 scoped_ptr<SolidColorLayerImpl> opaque_layer = |
| 147 SolidColorLayerImpl::Create(active_tree(), 2 + i); | 147 SolidColorLayerImpl::Create(active_tree(), 2 + i); |
| 148 opaque_layer->SetBackgroundColor(SK_ColorRED); | 148 opaque_layer->SetBackgroundColor(SK_ColorRED); |
| 149 opaque_layer->SetContentsOpaque(true); | 149 opaque_layer->SetContentsOpaque(true); |
| 150 opaque_layer->SetDrawsContent(true); | 150 opaque_layer->SetDrawsContent(true); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); | 198 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); |
| 199 | 199 |
| 200 ++begin; | 200 ++begin; |
| 201 EXPECT_EQ(end, begin); | 201 EXPECT_EQ(end, begin); |
| 202 | 202 |
| 203 PrintResults(); | 203 PrintResults(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace | 206 } // namespace |
| 207 } // namespace cc | 207 } // namespace cc |
| OLD | NEW |