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

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

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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_pixeltest_synchronous.cc ('k') | cc/trees/single_thread_proxy.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 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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 4142 matching lines...) Expand 10 before | Expand all | Expand 10 after
4153 int num_impl_commits_; 4153 int num_impl_commits_;
4154 }; 4154 };
4155 4155
4156 // Commits can only be aborted when using the thread proxy. 4156 // Commits can only be aborted when using the thread proxy.
4157 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortEvictedTextures); 4157 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortEvictedTextures);
4158 4158
4159 class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest { 4159 class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest {
4160 protected: 4160 protected:
4161 void InitializeSettings(LayerTreeSettings* settings) override { 4161 void InitializeSettings(LayerTreeSettings* settings) override {
4162 settings->impl_side_painting = true; 4162 settings->impl_side_painting = true;
4163 settings->use_zero_copy = false;
4164 settings->use_one_copy = false;
4163 } 4165 }
4164 4166
4165 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface( 4167 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(
4166 bool fallback) override { 4168 bool fallback) override {
4167 scoped_refptr<TestContextProvider> context_provider = 4169 scoped_refptr<TestContextProvider> context_provider =
4168 TestContextProvider::Create(); 4170 TestContextProvider::Create();
4169 context_provider->SetMaxTransferBufferUsageBytes(1024 * 1024); 4171 context_provider->SetMaxTransferBufferUsageBytes(1024 * 1024);
4170 if (delegating_renderer()) 4172 if (delegating_renderer())
4171 return FakeOutputSurface::CreateDelegating3d(context_provider); 4173 return FakeOutputSurface::CreateDelegating3d(context_provider);
4172 else 4174 else
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
5121 } 5123 }
5122 } 5124 }
5123 5125
5124 int commit_count_; 5126 int commit_count_;
5125 TestSwapPromiseResult swap_promise_result_[3]; 5127 TestSwapPromiseResult swap_promise_result_[3];
5126 }; 5128 };
5127 5129
5128 // Impl-side painting is not supported for synchronous compositing. 5130 // Impl-side painting is not supported for synchronous compositing.
5129 SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostTestSynchronousCompositeSwapPromise); 5131 SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostTestSynchronousCompositeSwapPromise);
5130 5132
5133 // Make sure page scale and top control deltas are applied to the client even
5134 // when the LayerTreeHost doesn't have a root layer.
5135 class LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer
5136 : public LayerTreeHostTest {
5137 public:
5138 LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer()
5139 : deltas_sent_to_client_(false) {}
5140
5141 void BeginTest() override {
5142 layer_tree_host()->SetRootLayer(nullptr);
5143 info_.page_scale_delta = 3.14f;
5144 info_.top_controls_delta = 2.73f;
5145
5146 PostSetNeedsCommitToMainThread();
5147 }
5148
5149 void BeginMainFrame(const BeginFrameArgs& args) override {
5150 EXPECT_EQ(nullptr, layer_tree_host()->root_layer());
5151
5152 layer_tree_host()->ApplyScrollAndScale(&info_);
5153 EndTest();
5154 }
5155
5156 void ApplyViewportDeltas(
5157 const gfx::Vector2d& inner,
5158 const gfx::Vector2d& outer,
5159 float scale_delta,
5160 float top_controls_delta) override {
5161 EXPECT_EQ(info_.page_scale_delta, scale_delta);
5162 EXPECT_EQ(info_.top_controls_delta, top_controls_delta);
5163 deltas_sent_to_client_ = true;
5164 }
5165
5166 void ApplyViewportDeltas(
5167 const gfx::Vector2d& scroll,
5168 float scale_delta,
5169 float top_controls_delta) override {
5170 EXPECT_EQ(info_.page_scale_delta, scale_delta);
5171 EXPECT_EQ(info_.top_controls_delta, top_controls_delta);
5172 deltas_sent_to_client_ = true;
5173 }
5174
5175 void AfterTest() override {
5176 EXPECT_TRUE(deltas_sent_to_client_);
5177 }
5178
5179 ScrollAndScaleSet info_;
5180 bool deltas_sent_to_client_;
5181 };
5182
5183 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer);
5131 } // namespace cc 5184 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_pixeltest_synchronous.cc ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698