Chromium Code Reviews

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

Issue 1781093002: Add CONTEXT_TYPE_OPENGLES2_PEPPER (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move workaround to gpu::Capabilities Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 10152 matching lines...)
10163 settings.gpu_rasterization_forced = true; 10163 settings.gpu_rasterization_forced = true;
10164 EXPECT_TRUE(CreateHostImpl(settings, FakeOutputSurface::Create3d())); 10164 EXPECT_TRUE(CreateHostImpl(settings, FakeOutputSurface::Create3d()));
10165 10165
10166 host_impl_->SetHasGpuRasterizationTrigger(false); 10166 host_impl_->SetHasGpuRasterizationTrigger(false);
10167 host_impl_->SetContentIsSuitableForGpuRasterization(false); 10167 host_impl_->SetContentIsSuitableForGpuRasterization(false);
10168 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED, 10168 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED,
10169 host_impl_->gpu_rasterization_status()); 10169 host_impl_->gpu_rasterization_status());
10170 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); 10170 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
10171 } 10171 }
10172 10172
10173 class MsaaIsSlowLayerTreeHostImplTest : public LayerTreeHostImplTest {
10174 public:
10175 void CreateHostImplWithMsaaIsSlow(bool msaa_is_slow) {
10176 LayerTreeSettings settings = DefaultSettings();
10177 settings.gpu_rasterization_enabled = true;
10178 settings.gpu_rasterization_msaa_sample_count = 4;
10179 auto context_provider = TestContextProvider::Create();
10180 context_provider->UnboundTestContext3d()->SetMaxSamples(4);
10181 context_provider->UnboundTestContext3d()->set_msaa_is_slow(msaa_is_slow);
10182 auto msaa_is_normal_output_surface =
10183 FakeOutputSurface::Create3d(context_provider);
10184 EXPECT_TRUE(
10185 CreateHostImpl(settings, std::move(msaa_is_normal_output_surface)));
10186 }
10187 };
10188
10189 TEST_F(MsaaIsSlowLayerTreeHostImplTest, GpuRasterizationStatusMsaaIsSlow) {
10190 // Ensure that without the msaa_is_slow cap we raster unsuitable content with
10191 // msaa.
10192 CreateHostImplWithMsaaIsSlow(false);
10193 host_impl_->SetHasGpuRasterizationTrigger(true);
10194 host_impl_->SetContentIsSuitableForGpuRasterization(false);
10195 EXPECT_EQ(GpuRasterizationStatus::MSAA_CONTENT,
10196 host_impl_->gpu_rasterization_status());
10197 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
10198
10199 // Ensure that with the msaa_is_slow cap we don't raster unsuitable content
10200 // with msaa.
10201 CreateHostImplWithMsaaIsSlow(true);
10202 host_impl_->SetHasGpuRasterizationTrigger(true);
10203 host_impl_->SetContentIsSuitableForGpuRasterization(false);
10204 EXPECT_EQ(GpuRasterizationStatus::OFF_CONTENT,
10205 host_impl_->gpu_rasterization_status());
10206 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
10207 }
10208
10173 // A mock output surface which lets us detect calls to ForceReclaimResources. 10209 // A mock output surface which lets us detect calls to ForceReclaimResources.
10174 class MockReclaimResourcesOutputSurface : public FakeOutputSurface { 10210 class MockReclaimResourcesOutputSurface : public FakeOutputSurface {
10175 public: 10211 public:
10176 static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() { 10212 static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() {
10177 return make_scoped_ptr(new MockReclaimResourcesOutputSurface( 10213 return make_scoped_ptr(new MockReclaimResourcesOutputSurface(
10178 TestContextProvider::Create(), TestContextProvider::CreateWorker(), 10214 TestContextProvider::Create(), TestContextProvider::CreateWorker(),
10179 false)); 10215 false));
10180 } 10216 }
10181 10217
10182 MOCK_METHOD0(ForceReclaimResources, void()); 10218 MOCK_METHOD0(ForceReclaimResources, void());
(...skipping 153 matching lines...)
10336 // There should not be any jitter measured till we hit the fixed point hits 10372 // There should not be any jitter measured till we hit the fixed point hits
10337 // threshold. 10373 // threshold.
10338 float expected_jitter = 10374 float expected_jitter =
10339 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; 10375 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0;
10340 EXPECT_EQ(jitter, expected_jitter); 10376 EXPECT_EQ(jitter, expected_jitter);
10341 } 10377 }
10342 } 10378 }
10343 10379
10344 } // namespace 10380 } // namespace
10345 } // namespace cc 10381 } // namespace cc
OLDNEW

Powered by Google App Engine