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

Side by Side Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 1126253005: cc: Add LayerTreeHost::InitParams for LayerTreeHost creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: all Created 5 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "base/containers/hash_tables.h" 5 #include "base/containers/hash_tables.h"
6 #include "base/thread_task_runner_handle.h" 6 #include "base/thread_task_runner_handle.h"
7 #include "cc/animation/scrollbar_animation_controller.h" 7 #include "cc/animation/scrollbar_animation_controller.h"
8 #include "cc/layers/append_quads_data.h" 8 #include "cc/layers/append_quads_data.h"
9 #include "cc/layers/painted_scrollbar_layer.h" 9 #include "cc/layers/painted_scrollbar_layer.h"
10 #include "cc/layers/painted_scrollbar_layer_impl.h" 10 #include "cc/layers/painted_scrollbar_layer_impl.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 child2->ToScrollbarLayer()->SetClipLayer(layer_tree_root->id()); 57 child2->ToScrollbarLayer()->SetClipLayer(layer_tree_root->id());
58 layer_tree_root->AddChild(child1); 58 layer_tree_root->AddChild(child1);
59 layer_tree_root->InsertChild(child2, reverse_order ? 0 : 1); 59 layer_tree_root->InsertChild(child2, reverse_order ? 0 : 1);
60 host->SetRootLayer(layer_tree_root); 60 host->SetRootLayer(layer_tree_root);
61 return host->CommitAndCreateLayerImplTree(); 61 return host->CommitAndCreateLayerImplTree();
62 } 62 }
63 63
64 class FakeResourceTrackingLayerTreeHost : public FakeLayerTreeHost { 64 class FakeResourceTrackingLayerTreeHost : public FakeLayerTreeHost {
65 public: 65 public:
66 FakeResourceTrackingLayerTreeHost(FakeLayerTreeHostClient* client, 66 FakeResourceTrackingLayerTreeHost(FakeLayerTreeHostClient* client,
67 const LayerTreeSettings& settings) 67 LayerTreeHost::InitParams* params)
68 : FakeLayerTreeHost(client, settings), 68 : FakeLayerTreeHost(client, params),
69 next_id_(1), 69 next_id_(1),
70 total_ui_resource_created_(0), 70 total_ui_resource_created_(0),
71 total_ui_resource_deleted_(0) { 71 total_ui_resource_deleted_(0) {
72 InitializeSingleThreaded(client, base::ThreadTaskRunnerHandle::Get(), 72 InitializeSingleThreaded(client, base::ThreadTaskRunnerHandle::Get(),
73 nullptr); 73 nullptr);
74 } 74 }
75 75
76 UIResourceId CreateUIResource(UIResourceClient* content) override { 76 UIResourceId CreateUIResource(UIResourceClient* content) override {
77 total_ui_resource_created_++; 77 total_ui_resource_created_++;
78 UIResourceId nid = next_id_++; 78 UIResourceId nid = next_id_++;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 int next_id_; 115 int next_id_;
116 int total_ui_resource_created_; 116 int total_ui_resource_created_;
117 int total_ui_resource_deleted_; 117 int total_ui_resource_deleted_;
118 }; 118 };
119 119
120 class ScrollbarLayerTest : public testing::Test { 120 class ScrollbarLayerTest : public testing::Test {
121 public: 121 public:
122 ScrollbarLayerTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) { 122 ScrollbarLayerTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {
123 layer_tree_settings_.single_thread_proxy_scheduler = false; 123 layer_tree_settings_.single_thread_proxy_scheduler = false;
124 layer_tree_host_.reset(new FakeResourceTrackingLayerTreeHost( 124
125 &fake_client_, layer_tree_settings_)); 125 LayerTreeHost::InitParams params;
126 params.client = &fake_client_;
127 params.settings = &layer_tree_settings_;
128
129 layer_tree_host_.reset(
130 new FakeResourceTrackingLayerTreeHost(&fake_client_, &params));
126 fake_client_.SetLayerTreeHost(layer_tree_host_.get()); 131 fake_client_.SetLayerTreeHost(layer_tree_host_.get());
127 // Force output surface creation for renderer capabilities. 132 // Force output surface creation for renderer capabilities.
128 layer_tree_host_->Composite(base::TimeTicks()); 133 layer_tree_host_->Composite(base::TimeTicks());
129 EXPECT_FALSE(layer_tree_host_->output_surface_lost()); 134 EXPECT_FALSE(layer_tree_host_->output_surface_lost());
130 } 135 }
131 136
132 protected: 137 protected:
133 FakeLayerTreeHostClient fake_client_; 138 FakeLayerTreeHostClient fake_client_;
134 LayerTreeSettings layer_tree_settings_; 139 LayerTreeSettings layer_tree_settings_;
135 scoped_ptr<FakeResourceTrackingLayerTreeHost> layer_tree_host_; 140 scoped_ptr<FakeResourceTrackingLayerTreeHost> layer_tree_host_;
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); 1066 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f);
1062 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); 1067 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f);
1063 1068
1064 // Horizontal Scrollbars. 1069 // Horizontal Scrollbars.
1065 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); 1070 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f);
1066 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); 1071 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f);
1067 } 1072 }
1068 1073
1069 } // namespace 1074 } // namespace
1070 } // namespace cc 1075 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698