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

Side by Side Diff: cc/blimp/layer_tree_host_remote_unittest.cc

Issue 2397843003: cc/blimp: Add (de)-serialization for PictureLayer and ScrollbarLayer. (Closed)
Patch Set: Addressed comments Created 4 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/blimp/layer_tree_host_remote.cc ('k') | cc/layers/layer.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/blimp/layer_tree_host_remote.h" 5 #include "cc/blimp/layer_tree_host_remote.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
11 #include "cc/layers/layer.h" 11 #include "cc/layers/layer.h"
12 #include "cc/output/begin_frame_args.h" 12 #include "cc/output/begin_frame_args.h"
13 #include "cc/test/fake_image_serialization_processor.h"
13 #include "cc/test/fake_remote_compositor_bridge.h" 14 #include "cc/test/fake_remote_compositor_bridge.h"
14 #include "cc/test/stub_layer_tree_host_client.h" 15 #include "cc/test/stub_layer_tree_host_client.h"
15 #include "cc/trees/layer_tree_settings.h" 16 #include "cc/trees/layer_tree_settings.h"
16 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 using testing::InSequence; 20 using testing::InSequence;
20 using testing::Mock; 21 using testing::Mock;
21 using testing::StrictMock; 22 using testing::StrictMock;
22 23
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 params.client = &mock_layer_tree_host_client_; 140 params.client = &mock_layer_tree_host_client_;
140 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner = 141 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner =
141 base::ThreadTaskRunnerHandle::Get(); 142 base::ThreadTaskRunnerHandle::Get();
142 params.main_task_runner = main_task_runner; 143 params.main_task_runner = main_task_runner;
143 std::unique_ptr<UpdateTrackingRemoteCompositorBridge> 144 std::unique_ptr<UpdateTrackingRemoteCompositorBridge>
144 remote_compositor_bridge = 145 remote_compositor_bridge =
145 base::MakeUnique<UpdateTrackingRemoteCompositorBridge>( 146 base::MakeUnique<UpdateTrackingRemoteCompositorBridge>(
146 main_task_runner); 147 main_task_runner);
147 remote_compositor_bridge_ = remote_compositor_bridge.get(); 148 remote_compositor_bridge_ = remote_compositor_bridge.get();
148 params.remote_compositor_bridge = std::move(remote_compositor_bridge); 149 params.remote_compositor_bridge = std::move(remote_compositor_bridge);
150 params.engine_picture_cache =
151 image_serialization_processor_.CreateEnginePictureCache();
149 LayerTreeSettings settings; 152 LayerTreeSettings settings;
150 params.settings = &settings; 153 params.settings = &settings;
151 154
152 layer_tree_host_ = base::MakeUnique<LayerTreeHostRemoteForTesting>(&params); 155 layer_tree_host_ = base::MakeUnique<LayerTreeHostRemoteForTesting>(&params);
153 root_layer_ = make_scoped_refptr(new MockLayer(false)); 156 root_layer_ = make_scoped_refptr(new MockLayer(false));
154 layer_tree_host_->GetLayerTree()->SetRootLayer(root_layer_); 157 layer_tree_host_->GetLayerTree()->SetRootLayer(root_layer_);
155 } 158 }
156 159
157 void TearDown() override { 160 void TearDown() override {
158 Mock::VerifyAndClearExpectations(&mock_layer_tree_host_client_); 161 Mock::VerifyAndClearExpectations(&mock_layer_tree_host_client_);
(...skipping 20 matching lines...) Expand all
179 182
180 void set_needs_commit_during_main_frame(bool needs) { 183 void set_needs_commit_during_main_frame(bool needs) {
181 needs_commit_during_main_frame_ = needs; 184 needs_commit_during_main_frame_ = needs;
182 } 185 }
183 186
184 protected: 187 protected:
185 std::unique_ptr<LayerTreeHostRemote> layer_tree_host_; 188 std::unique_ptr<LayerTreeHostRemote> layer_tree_host_;
186 StrictMock<MockLayerTreeHostClient> mock_layer_tree_host_client_; 189 StrictMock<MockLayerTreeHostClient> mock_layer_tree_host_client_;
187 UpdateTrackingRemoteCompositorBridge* remote_compositor_bridge_ = nullptr; 190 UpdateTrackingRemoteCompositorBridge* remote_compositor_bridge_ = nullptr;
188 scoped_refptr<MockLayer> root_layer_; 191 scoped_refptr<MockLayer> root_layer_;
192 FakeImageSerializationProcessor image_serialization_processor_;
189 193
190 bool needs_animate_during_main_frame_ = false; 194 bool needs_animate_during_main_frame_ = false;
191 bool needs_commit_during_main_frame_ = false; 195 bool needs_commit_during_main_frame_ = false;
192 196
193 private: 197 private:
194 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostRemoteTest); 198 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostRemoteTest);
195 }; 199 };
196 200
197 TEST_F(LayerTreeHostRemoteTest, BeginMainFrameAnimateOnly) { 201 TEST_F(LayerTreeHostRemoteTest, BeginMainFrameAnimateOnly) {
198 // The main frame should run until the animate step only. 202 // The main frame should run until the animate step only.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 342
339 layer_tree_host_->SetNeedsUpdateLayers(); 343 layer_tree_host_->SetNeedsUpdateLayers();
340 344
341 base::RunLoop().RunUntilIdle(); 345 base::RunLoop().RunUntilIdle();
342 EXPECT_TRUE(root_layer_->did_update()); 346 EXPECT_TRUE(root_layer_->did_update());
343 EXPECT_EQ(1, remote_compositor_bridge_->num_updates_received()); 347 EXPECT_EQ(1, remote_compositor_bridge_->num_updates_received());
344 } 348 }
345 349
346 } // namespace 350 } // namespace
347 } // namespace cc 351 } // namespace cc
OLDNEW
« no previous file with comments | « cc/blimp/layer_tree_host_remote.cc ('k') | cc/layers/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698