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

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

Issue 2494623002: cc: Remove client/engine LayerTreeHostInProcess. (Closed)
Patch Set: .. Created 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <memory>
6
7 #include "base/memory/ptr_util.h"
8 #include "base/threading/thread_task_runner_handle.h"
9 #include "cc/animation/animation_host.h"
10 #include "cc/test/fake_image_serialization_processor.h"
11 #include "cc/test/test_task_graph_runner.h"
12 #include "cc/trees/layer_tree_host_client.h"
13 #include "cc/trees/layer_tree_host_in_process.h"
14 #include "cc/trees/proxy_common.h"
15 #include "cc/trees/proxy_main.h"
16 #include "cc/trees/remote_proto_channel.h"
17 #include "testing/gtest/include/gtest/gtest.h"
18
19 namespace cc {
20 namespace {
21
22 class LayerTreeHostTestRemoteServer : public testing::Test,
23 public RemoteProtoChannel,
24 public LayerTreeHostClient {
25 public:
26 LayerTreeHostTestRemoteServer()
27 : calls_received_(0),
28 image_serialization_processor_(
29 base::WrapUnique(new FakeImageSerializationProcessor)) {
30 animation_host_ = AnimationHost::CreateForTesting(ThreadInstance::MAIN);
31
32 LayerTreeHostInProcess::InitParams params;
33 params.client = this;
34 params.task_graph_runner = &task_graph_runner_;
35 params.settings = &settings_;
36 params.main_task_runner = base::ThreadTaskRunnerHandle::Get();
37 params.image_serialization_processor = image_serialization_processor_.get();
38 params.mutator_host = animation_host_.get();
39 layer_tree_host_ =
40 LayerTreeHostInProcess::CreateRemoteServer(this, &params);
41 }
42
43 ~LayerTreeHostTestRemoteServer() override {
44 animation_host_->SetMutatorHostClient(nullptr);
45 }
46
47 // LayerTreeHostClient implementation
48 void WillBeginMainFrame() override {}
49 void BeginMainFrame(const BeginFrameArgs& args) override {}
50 void BeginMainFrameNotExpectedSoon() override {}
51 void DidBeginMainFrame() override {}
52 void UpdateLayerTreeHost() override {}
53 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
54 const gfx::Vector2dF& outer_delta,
55 const gfx::Vector2dF& elastic_overscroll_delta,
56 float page_scale,
57 float top_controls_delta) override {}
58 void RequestNewCompositorFrameSink() override { NOTREACHED(); }
59 void DidInitializeCompositorFrameSink() override { NOTREACHED(); }
60 void DidFailToInitializeCompositorFrameSink() override { NOTREACHED(); }
61 void WillCommit() override {}
62 void DidCommit() override {}
63 void DidCommitAndDrawFrame() override {}
64 void DidReceiveCompositorFrameAck() override {}
65 void DidCompletePageScaleAnimation() override {}
66
67 // RemoteProtoChannel implementation
68 void SetProtoReceiver(RemoteProtoChannel::ProtoReceiver* receiver) override {
69 receiver_ = receiver;
70 }
71 void SendCompositorProto(const proto::CompositorMessage& proto) override {}
72
73 int calls_received_;
74 TestTaskGraphRunner task_graph_runner_;
75 LayerTreeSettings settings_;
76 std::unique_ptr<AnimationHost> animation_host_;
77 std::unique_ptr<LayerTreeHostInProcess> layer_tree_host_;
78 RemoteProtoChannel::ProtoReceiver* receiver_;
79 std::unique_ptr<FakeImageSerializationProcessor>
80 image_serialization_processor_;
81
82 private:
83 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostTestRemoteServer);
84 };
85
86 class LayerTreeHostTestRemoteServerBeginMainFrame
87 : public LayerTreeHostTestRemoteServer {
88 protected:
89 void BeginMainFrame(const BeginFrameArgs& args) override {
90 calls_received_++;
91 }
92 };
93
94 // Makes sure that the BeginMainFrame call is not aborted on the server.
95 // See crbug.com/577301.
96 TEST_F(LayerTreeHostTestRemoteServerBeginMainFrame, BeginMainFrameNotAborted) {
97 layer_tree_host_->SetVisible(true);
98
99 std::unique_ptr<BeginMainFrameAndCommitState> begin_frame_state;
100 begin_frame_state.reset(new BeginMainFrameAndCommitState());
101 begin_frame_state->scroll_info.reset(new ScrollAndScaleSet());
102
103 static_cast<ProxyMain*>(layer_tree_host_->proxy())
104 ->BeginMainFrame(std::move(begin_frame_state));
105 EXPECT_EQ(calls_received_, 1);
106 }
107
108 } // namespace
109 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_in_process.cc ('k') | cc/trees/layer_tree_host_unittest_serialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698