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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 current_limit_bytes_(0), | 76 current_limit_bytes_(0), |
77 current_priority_cutoff_value_(0) { | 77 current_priority_cutoff_value_(0) { |
78 media::InitializeMediaLibraryForTesting(); | 78 media::InitializeMediaLibraryForTesting(); |
79 } | 79 } |
80 | 80 |
81 virtual void SetUp() OVERRIDE { | 81 virtual void SetUp() OVERRIDE { |
82 LayerTreeSettings settings; | 82 LayerTreeSettings settings; |
83 settings.minimum_occlusion_tracking_size = gfx::Size(); | 83 settings.minimum_occlusion_tracking_size = gfx::Size(); |
84 settings.impl_side_painting = true; | 84 settings.impl_side_painting = true; |
85 settings.solid_color_scrollbars = true; | 85 settings.solid_color_scrollbars = true; |
| 86 settings.max_bytes_pending_upload = 16 * 1024 * 1024; |
86 | 87 |
87 host_impl_ = LayerTreeHostImpl::Create(settings, | 88 host_impl_ = LayerTreeHostImpl::Create(settings, |
88 this, | 89 this, |
89 &proxy_, | 90 &proxy_, |
90 &stats_instrumentation_); | 91 &stats_instrumentation_); |
91 host_impl_->InitializeRenderer(CreateOutputSurface()); | 92 host_impl_->InitializeRenderer(CreateOutputSurface()); |
92 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 93 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
93 } | 94 } |
94 | 95 |
95 virtual void TearDown() OVERRIDE {} | 96 virtual void TearDown() OVERRIDE {} |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 }; | 365 }; |
365 | 366 |
366 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { | 367 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { |
367 bool always_draw = false; | 368 bool always_draw = false; |
368 CheckNotifyCalledIfCanDrawChanged(always_draw); | 369 CheckNotifyCalledIfCanDrawChanged(always_draw); |
369 } | 370 } |
370 | 371 |
371 TEST_F(LayerTreeHostImplTest, CanDrawIncompleteFrames) { | 372 TEST_F(LayerTreeHostImplTest, CanDrawIncompleteFrames) { |
372 LayerTreeSettings settings; | 373 LayerTreeSettings settings; |
373 settings.impl_side_painting = true; | 374 settings.impl_side_painting = true; |
| 375 settings.max_bytes_pending_upload = 16 * 1024 * 1024; |
374 host_impl_ = LayerTreeHostImpl::Create( | 376 host_impl_ = LayerTreeHostImpl::Create( |
375 settings, this, &proxy_, &stats_instrumentation_); | 377 settings, this, &proxy_, &stats_instrumentation_); |
376 | 378 |
377 scoped_ptr<FakeOutputSurface> output_surface( | 379 scoped_ptr<FakeOutputSurface> output_surface( |
378 FakeOutputSurface::CreateAlwaysDrawAndSwap3d()); | 380 FakeOutputSurface::CreateAlwaysDrawAndSwap3d()); |
379 | 381 |
380 host_impl_->InitializeRenderer( | 382 host_impl_->InitializeRenderer( |
381 output_surface.PassAs<OutputSurface>()); | 383 output_surface.PassAs<OutputSurface>()); |
382 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 384 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
383 | 385 |
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2843 EXPECT_TRUE(layer1->quads_appended()); | 2845 EXPECT_TRUE(layer1->quads_appended()); |
2844 host_impl_->DidDrawAllLayers(frame); | 2846 host_impl_->DidDrawAllLayers(frame); |
2845 } | 2847 } |
2846 | 2848 |
2847 class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest { | 2849 class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest { |
2848 public: | 2850 public: |
2849 void CreateLayerTreeHostImpl(bool always_draw) { | 2851 void CreateLayerTreeHostImpl(bool always_draw) { |
2850 LayerTreeSettings settings; | 2852 LayerTreeSettings settings; |
2851 settings.minimum_occlusion_tracking_size = gfx::Size(); | 2853 settings.minimum_occlusion_tracking_size = gfx::Size(); |
2852 settings.impl_side_painting = true; | 2854 settings.impl_side_painting = true; |
| 2855 settings.max_bytes_pending_upload = 16 * 1024 * 1024; |
2853 host_impl_ = LayerTreeHostImpl::Create( | 2856 host_impl_ = LayerTreeHostImpl::Create( |
2854 settings, this, &proxy_, &stats_instrumentation_); | 2857 settings, this, &proxy_, &stats_instrumentation_); |
2855 | 2858 |
2856 scoped_ptr<FakeOutputSurface> output_surface; | 2859 scoped_ptr<FakeOutputSurface> output_surface; |
2857 if (always_draw) | 2860 if (always_draw) |
2858 output_surface = FakeOutputSurface::CreateAlwaysDrawAndSwap3d().Pass(); | 2861 output_surface = FakeOutputSurface::CreateAlwaysDrawAndSwap3d().Pass(); |
2859 else | 2862 else |
2860 output_surface = FakeOutputSurface::Create3d().Pass(); | 2863 output_surface = FakeOutputSurface::Create3d().Pass(); |
2861 | 2864 |
2862 host_impl_->InitializeRenderer(output_surface.PassAs<OutputSurface>()); | 2865 host_impl_->InitializeRenderer(output_surface.PassAs<OutputSurface>()); |
(...skipping 3448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6311 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); | 6314 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); |
6312 EXPECT_EQ(0u, context3d->NumTextures()); | 6315 EXPECT_EQ(0u, context3d->NumTextures()); |
6313 | 6316 |
6314 // Should not change state for multiple deletion on one UIResourceId | 6317 // Should not change state for multiple deletion on one UIResourceId |
6315 host_impl_->DeleteUIResource(ui_resource_id); | 6318 host_impl_->DeleteUIResource(ui_resource_id); |
6316 EXPECT_EQ(0u, context3d->NumTextures()); | 6319 EXPECT_EQ(0u, context3d->NumTextures()); |
6317 } | 6320 } |
6318 | 6321 |
6319 } // namespace | 6322 } // namespace |
6320 } // namespace cc | 6323 } // namespace cc |
OLD | NEW |