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

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

Issue 1356463002: Revert of cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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.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() : output_surface_(FakeOutputSurface::Create3d()) { 25 LayerTreeImplTest() {
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(output_surface_.get())); 30 EXPECT_TRUE(host_impl_->InitializeRenderer(FakeOutputSurface::Create3d()));
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_;
46 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; 45 scoped_ptr<FakeLayerTreeHostImpl> host_impl_;
47 }; 46 };
48 47
49 TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) { 48 TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) {
50 scoped_ptr<LayerImpl> root = 49 scoped_ptr<LayerImpl> root =
51 LayerImpl::Create(host_impl().active_tree(), 12345); 50 LayerImpl::Create(host_impl().active_tree(), 12345);
52 51
53 gfx::Transform identity_matrix; 52 gfx::Transform identity_matrix;
54 gfx::Point3F transform_origin; 53 gfx::Point3F transform_origin;
55 gfx::PointF position; 54 gfx::PointF position;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 EXPECT_EQ(12345, result_layer->id()); 90 EXPECT_EQ(12345, result_layer->id());
92 } 91 }
93 92
94 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) { 93 TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) {
95 // Ensures that the viewport rect is correctly updated by the clip tree. 94 // Ensures that the viewport rect is correctly updated by the clip tree.
96 TestSharedBitmapManager shared_bitmap_manager; 95 TestSharedBitmapManager shared_bitmap_manager;
97 TestTaskGraphRunner task_graph_runner; 96 TestTaskGraphRunner task_graph_runner;
98 FakeImplProxy proxy; 97 FakeImplProxy proxy;
99 LayerTreeSettings settings; 98 LayerTreeSettings settings;
100 settings.verify_property_trees = true; 99 settings.verify_property_trees = true;
101 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
102 scoped_ptr<FakeLayerTreeHostImpl> host_impl; 100 scoped_ptr<FakeLayerTreeHostImpl> host_impl;
103 host_impl.reset(new FakeLayerTreeHostImpl( 101 host_impl.reset(new FakeLayerTreeHostImpl(
104 settings, &proxy, &shared_bitmap_manager, &task_graph_runner)); 102 settings, &proxy, &shared_bitmap_manager, &task_graph_runner));
105 EXPECT_TRUE(host_impl->InitializeRenderer(output_surface.get())); 103 EXPECT_TRUE(host_impl->InitializeRenderer(FakeOutputSurface::Create3d()));
106 scoped_ptr<LayerImpl> root = 104 scoped_ptr<LayerImpl> root =
107 LayerImpl::Create(host_impl->active_tree(), 12345); 105 LayerImpl::Create(host_impl->active_tree(), 12345);
108 106
109 gfx::Transform identity_matrix; 107 gfx::Transform identity_matrix;
110 gfx::Point3F transform_origin; 108 gfx::Point3F transform_origin;
111 gfx::PointF position; 109 gfx::PointF position;
112 gfx::Size bounds(100, 100); 110 gfx::Size bounds(100, 100);
113 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, 111 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
114 position, bounds, true, false, true); 112 position, bounds, true, false, true);
115 root->SetDrawsContent(true); 113 root->SetDrawsContent(true);
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); 2015 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers());
2018 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); 2016 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2019 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); 2017 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2));
2020 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); 2018 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3));
2021 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); 2019 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4));
2022 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); 2020 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
2023 } 2021 }
2024 2022
2025 } // namespace 2023 } // namespace
2026 } // namespace cc 2024 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/occlusion_tracker_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698