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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2196023002: cc: Never make a DirectRenderer in LayerTreeHostImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@display-layertreetest
Patch Set: dcheck-delegating: blinktests Created 4 years, 4 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 // 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 10583 matching lines...) Expand 10 before | Expand all | Expand 10 after
10594 host_impl_->SetHasGpuRasterizationTrigger(true); 10594 host_impl_->SetHasGpuRasterizationTrigger(true);
10595 host_impl_->SetContentIsSuitableForGpuRasterization(false); 10595 host_impl_->SetContentIsSuitableForGpuRasterization(false);
10596 EXPECT_EQ(GpuRasterizationStatus::OFF_CONTENT, 10596 EXPECT_EQ(GpuRasterizationStatus::OFF_CONTENT,
10597 host_impl_->gpu_rasterization_status()); 10597 host_impl_->gpu_rasterization_status());
10598 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 10598 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
10599 } 10599 }
10600 10600
10601 // A mock output surface which lets us detect calls to ForceReclaimResources. 10601 // A mock output surface which lets us detect calls to ForceReclaimResources.
10602 class MockReclaimResourcesOutputSurface : public FakeOutputSurface { 10602 class MockReclaimResourcesOutputSurface : public FakeOutputSurface {
10603 public: 10603 public:
10604 static std::unique_ptr<MockReclaimResourcesOutputSurface> Create3d() { 10604 MockReclaimResourcesOutputSurface()
10605 return base::WrapUnique(new MockReclaimResourcesOutputSurface( 10605 : FakeOutputSurface(TestContextProvider::Create(),
10606 TestContextProvider::Create(), TestContextProvider::CreateWorker(), 10606 TestContextProvider::CreateWorker(),
10607 false)); 10607 true) {}
10608 }
10609 10608
10610 MOCK_METHOD0(ForceReclaimResources, void()); 10609 MOCK_METHOD0(ForceReclaimResources, void());
10611
10612 protected:
10613 MockReclaimResourcesOutputSurface(
10614 scoped_refptr<ContextProvider> context_provider,
10615 scoped_refptr<ContextProvider> worker_context_provider,
10616 bool delegated_rendering)
10617 : FakeOutputSurface(context_provider,
10618 worker_context_provider,
10619 delegated_rendering) {}
10620 }; 10610 };
10621 10611
10622 // Display::Draw (and the planned Display Scheduler) currently rely on resources 10612 // Display::Draw (and the planned Display Scheduler) currently rely on resources
10623 // being reclaimed to block drawing between BeginCommit / Swap. This test 10613 // being reclaimed to block drawing between BeginCommit / Swap. This test
10624 // ensures that BeginCommit triggers ForceReclaimResources. See 10614 // ensures that BeginCommit triggers ForceReclaimResources. See
10625 // crbug.com/489515. 10615 // crbug.com/489515.
10626 TEST_F(LayerTreeHostImplTest, BeginCommitReclaimsResources) { 10616 TEST_F(LayerTreeHostImplTest, BeginCommitReclaimsResources) {
10627 std::unique_ptr<MockReclaimResourcesOutputSurface> output_surface( 10617 auto output_surface = base::MakeUnique<MockReclaimResourcesOutputSurface>();
10628 MockReclaimResourcesOutputSurface::Create3d());
10629 // Hold an unowned pointer to the output surface to use for mock expectations. 10618 // Hold an unowned pointer to the output surface to use for mock expectations.
10630 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); 10619 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get();
10631 10620
10632 CreateHostImpl(DefaultSettings(), std::move(output_surface)); 10621 CreateHostImpl(DefaultSettings(), std::move(output_surface));
10633 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); 10622 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1);
10634 host_impl_->BeginCommit(); 10623 host_impl_->BeginCommit();
10635 } 10624 }
10636 10625
10637 TEST_F(LayerTreeHostImplTest, UpdatePageScaleFactorOnActiveTree) { 10626 TEST_F(LayerTreeHostImplTest, UpdatePageScaleFactorOnActiveTree) {
10638 // Check page scale factor update in property trees when an update is made 10627 // Check page scale factor update in property trees when an update is made
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
10799 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); 10788 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
10800 10789
10801 // Re-initialize with a software output surface. 10790 // Re-initialize with a software output surface.
10802 output_surface_ = FakeOutputSurface::CreateDelegatingSoftware(); 10791 output_surface_ = FakeOutputSurface::CreateDelegatingSoftware();
10803 host_impl_->InitializeRenderer(output_surface_.get()); 10792 host_impl_->InitializeRenderer(output_surface_.get());
10804 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 10793 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
10805 } 10794 }
10806 10795
10807 } // namespace 10796 } // namespace
10808 } // namespace cc 10797 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698