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

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

Issue 1336733002: Re-land: cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix LayerTreeHostClientTakeAwayOutputSurface test. Content provider is always destroyed on the clie… Created 5 years, 2 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
« no previous file with comments | « cc/trees/layer_tree_host_unittest_context.cc ('k') | cc/trees/occlusion_tracker_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_proxy.h" 10 #include "cc/test/fake_impl_proxy.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/layer_tree_host_impl.h" 17 #include "cc/trees/layer_tree_host_impl.h"
18 #include "ui/gfx/geometry/size_conversions.h" 18 #include "ui/gfx/geometry/size_conversions.h"
19 19
20 namespace cc { 20 namespace cc {
21 namespace { 21 namespace {
22 22
23 class LayerTreeImplTest : public LayerTreeHostCommonTest { 23 class LayerTreeImplTest : public LayerTreeHostCommonTest {
24 public: 24 public:
25 LayerTreeImplTest() { 25 LayerTreeImplTest() : output_surface_(FakeOutputSurface::Create3d()) {
26 LayerTreeSettings settings; 26 LayerTreeSettings settings;
27 settings.layer_transforms_should_scale_layer_contents = true; 27 settings.layer_transforms_should_scale_layer_contents = true;
28 host_impl_.reset(new FakeLayerTreeHostImpl( 28 host_impl_.reset(new FakeLayerTreeHostImpl(
29 settings, &proxy_, &shared_bitmap_manager_, &task_graph_runner_)); 29 settings, &proxy_, &shared_bitmap_manager_, &task_graph_runner_));
30 EXPECT_TRUE(host_impl_->InitializeRenderer(FakeOutputSurface::Create3d())); 30 EXPECT_TRUE(host_impl_->InitializeRenderer(output_surface_.get()));
31 } 31 }
32 32
33 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; } 33 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; }
34 34
35 LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); } 35 LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); }
36 36
37 const LayerImplList& RenderSurfaceLayerList() const { 37 const LayerImplList& RenderSurfaceLayerList() const {
38 return host_impl_->active_tree()->RenderSurfaceLayerList(); 38 return host_impl_->active_tree()->RenderSurfaceLayerList();
39 } 39 }
40 40
41 private: 41 private:
42 TestSharedBitmapManager shared_bitmap_manager_; 42 TestSharedBitmapManager shared_bitmap_manager_;
43 TestTaskGraphRunner task_graph_runner_; 43 TestTaskGraphRunner task_graph_runner_;
44 FakeImplProxy proxy_; 44 FakeImplProxy proxy_;
45 scoped_ptr<OutputSurface> output_surface_;
45 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; 46 scoped_ptr<FakeLayerTreeHostImpl> host_impl_;
46 }; 47 };
47 48
48 TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) { 49 TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) {
49 scoped_ptr<LayerImpl> root = 50 scoped_ptr<LayerImpl> root =
50 LayerImpl::Create(host_impl().active_tree(), 12345); 51 LayerImpl::Create(host_impl().active_tree(), 12345);
51 52
52 gfx::Transform identity_matrix; 53 gfx::Transform identity_matrix;
53 gfx::Point3F transform_origin; 54 gfx::Point3F transform_origin;
54 gfx::PointF position; 55 gfx::PointF position;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 EXPECT_EQ(12345, result_layer->id()); 91 EXPECT_EQ(12345, result_layer->id());
91 } 92 }
92 93
93 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) { 94 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) {
94 // Ensures that the viewport rect is correctly updated by the clip tree. 95 // Ensures that the viewport rect is correctly updated by the clip tree.
95 TestSharedBitmapManager shared_bitmap_manager; 96 TestSharedBitmapManager shared_bitmap_manager;
96 TestTaskGraphRunner task_graph_runner; 97 TestTaskGraphRunner task_graph_runner;
97 FakeImplProxy proxy; 98 FakeImplProxy proxy;
98 LayerTreeSettings settings; 99 LayerTreeSettings settings;
99 settings.verify_property_trees = true; 100 settings.verify_property_trees = true;
101 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
100 scoped_ptr<FakeLayerTreeHostImpl> host_impl; 102 scoped_ptr<FakeLayerTreeHostImpl> host_impl;
101 host_impl.reset(new FakeLayerTreeHostImpl( 103 host_impl.reset(new FakeLayerTreeHostImpl(
102 settings, &proxy, &shared_bitmap_manager, &task_graph_runner)); 104 settings, &proxy, &shared_bitmap_manager, &task_graph_runner));
103 EXPECT_TRUE(host_impl->InitializeRenderer(FakeOutputSurface::Create3d())); 105 EXPECT_TRUE(host_impl->InitializeRenderer(output_surface.get()));
104 scoped_ptr<LayerImpl> root = 106 scoped_ptr<LayerImpl> root =
105 LayerImpl::Create(host_impl->active_tree(), 12345); 107 LayerImpl::Create(host_impl->active_tree(), 12345);
106 108
107 gfx::Transform identity_matrix; 109 gfx::Transform identity_matrix;
108 gfx::Point3F transform_origin; 110 gfx::Point3F transform_origin;
109 gfx::PointF position; 111 gfx::PointF position;
110 gfx::Size bounds(100, 100); 112 gfx::Size bounds(100, 100);
111 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, 113 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
112 position, bounds, true, false, true); 114 position, bounds, true, false, true);
113 root->SetDrawsContent(true); 115 root->SetDrawsContent(true);
(...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); 2080 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers());
2079 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); 2081 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2080 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); 2082 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2));
2081 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); 2083 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3));
2082 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); 2084 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4));
2083 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); 2085 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
2084 } 2086 }
2085 2087
2086 } // namespace 2088 } // namespace
2087 } // namespace cc 2089 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_context.cc ('k') | cc/trees/occlusion_tracker_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698