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

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

Issue 2171143002: cc: Get rid of non-delegated rendering in most cc unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@killdirecttests
Patch Set: fakeoutputsurface: no-constructor Created 4 years, 5 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 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/layer_tree_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include "cc/layers/heads_up_display_layer_impl.h" 7 #include "cc/layers/heads_up_display_layer_impl.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
10 #include "cc/test/fake_impl_task_runner_provider.h" 10 #include "cc/test/fake_impl_task_runner_provider.h"
11 #include "cc/test/fake_layer_tree_host_impl.h" 11 #include "cc/test/fake_layer_tree_host_impl.h"
12 #include "cc/test/fake_output_surface.h" 12 #include "cc/test/fake_output_surface.h"
13 #include "cc/test/geometry_test_utils.h" 13 #include "cc/test/geometry_test_utils.h"
14 #include "cc/test/layer_tree_host_common_test.h" 14 #include "cc/test/layer_tree_host_common_test.h"
15 #include "cc/test/test_shared_bitmap_manager.h" 15 #include "cc/test/test_shared_bitmap_manager.h"
16 #include "cc/test/test_task_graph_runner.h" 16 #include "cc/test/test_task_graph_runner.h"
17 #include "cc/trees/clip_node.h" 17 #include "cc/trees/clip_node.h"
18 #include "cc/trees/draw_property_utils.h" 18 #include "cc/trees/draw_property_utils.h"
19 #include "cc/trees/layer_tree_host_impl.h" 19 #include "cc/trees/layer_tree_host_impl.h"
20 #include "ui/gfx/geometry/size_conversions.h" 20 #include "ui/gfx/geometry/size_conversions.h"
21 21
22 namespace cc { 22 namespace cc {
23 namespace { 23 namespace {
24 24
25 class LayerTreeImplTest : public LayerTreeHostCommonTest { 25 class LayerTreeImplTest : public LayerTreeHostCommonTest {
26 public: 26 public:
27 LayerTreeImplTest() : output_surface_(FakeOutputSurface::Create3d()) { 27 LayerTreeImplTest()
28 : output_surface_(FakeOutputSurface::CreateDelegating3d()) {
28 LayerTreeSettings settings; 29 LayerTreeSettings settings;
29 settings.layer_transforms_should_scale_layer_contents = true; 30 settings.layer_transforms_should_scale_layer_contents = true;
30 settings.verify_clip_tree_calculations = true; 31 settings.verify_clip_tree_calculations = true;
31 settings.verify_transform_tree_calculations = true; 32 settings.verify_transform_tree_calculations = true;
32 host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_, 33 host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_,
33 &shared_bitmap_manager_, 34 &shared_bitmap_manager_,
34 &task_graph_runner_)); 35 &task_graph_runner_));
35 host_impl_->SetVisible(true); 36 host_impl_->SetVisible(true);
36 EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get())); 37 EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get()));
37 } 38 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 110 }
110 111
111 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) { 112 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) {
112 // Ensures that the viewport rect is correctly updated by the clip tree. 113 // Ensures that the viewport rect is correctly updated by the clip tree.
113 TestSharedBitmapManager shared_bitmap_manager; 114 TestSharedBitmapManager shared_bitmap_manager;
114 TestTaskGraphRunner task_graph_runner; 115 TestTaskGraphRunner task_graph_runner;
115 FakeImplTaskRunnerProvider task_runner_provider; 116 FakeImplTaskRunnerProvider task_runner_provider;
116 LayerTreeSettings settings; 117 LayerTreeSettings settings;
117 settings.verify_clip_tree_calculations = true; 118 settings.verify_clip_tree_calculations = true;
118 settings.verify_transform_tree_calculations = true; 119 settings.verify_transform_tree_calculations = true;
119 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); 120 std::unique_ptr<OutputSurface> output_surface =
121 FakeOutputSurface::CreateDelegating3d();
120 std::unique_ptr<FakeLayerTreeHostImpl> host_impl; 122 std::unique_ptr<FakeLayerTreeHostImpl> host_impl;
121 host_impl.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider, 123 host_impl.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider,
122 &shared_bitmap_manager, 124 &shared_bitmap_manager,
123 &task_graph_runner)); 125 &task_graph_runner));
124 host_impl->SetVisible(true); 126 host_impl->SetVisible(true);
125 EXPECT_TRUE(host_impl->InitializeRenderer(output_surface.get())); 127 EXPECT_TRUE(host_impl->InitializeRenderer(output_surface.get()));
126 std::unique_ptr<LayerImpl> root = 128 std::unique_ptr<LayerImpl> root =
127 LayerImpl::Create(host_impl->active_tree(), 12345); 129 LayerImpl::Create(host_impl->active_tree(), 12345);
128 130
129 gfx::Transform identity_matrix; 131 gfx::Transform identity_matrix;
(...skipping 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 gfx::PointF test_point = gfx::PointF(1.f, 1.f); 2569 gfx::PointF test_point = gfx::PointF(1.f, 1.f);
2568 LayerImpl* result_layer = 2570 LayerImpl* result_layer =
2569 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 2571 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
2570 2572
2571 CHECK(result_layer); 2573 CHECK(result_layer);
2572 EXPECT_EQ(2, result_layer->id()); 2574 EXPECT_EQ(2, result_layer->id());
2573 } 2575 }
2574 2576
2575 } // namespace 2577 } // namespace
2576 } // namespace cc 2578 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_serialization.cc ('k') | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698