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

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

Issue 2493853002: cc/blimp: Proto Cleanup. (Closed)
Patch Set: Rebase 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
« no previous file with comments | « cc/trees/proxy_common.cc ('k') | cc/trees/scroll_node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/trees/proxy_common.h"
6
7 #include "cc/proto/begin_main_frame_and_commit_state.pb.h"
8 #include "cc/test/begin_frame_args_test.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace cc {
12 namespace {
13
14 TEST(ProxyCommonUnittest, SerializeBeginMainFrameAndCommitState) {
15 BeginMainFrameAndCommitState begin_main_frame_state;
16 begin_main_frame_state.begin_frame_id = 5;
17
18 begin_main_frame_state.begin_frame_args = BeginFrameArgs::Create(
19 BEGINFRAME_FROM_HERE, base::TimeTicks::FromInternalValue(4),
20 base::TimeTicks::FromInternalValue(7),
21 base::TimeDelta::FromInternalValue(9), BeginFrameArgs::NORMAL);
22 begin_main_frame_state.begin_frame_args.on_critical_path = false;
23
24 LayerTreeHostCommon::ScrollUpdateInfo scroll1;
25 scroll1.layer_id = 1;
26 scroll1.scroll_delta = gfx::Vector2d(5, 10);
27 LayerTreeHostCommon::ScrollUpdateInfo scroll2;
28 scroll2.layer_id = 2;
29 scroll2.scroll_delta = gfx::Vector2d(1, 5);
30 begin_main_frame_state.scroll_info.reset(new ScrollAndScaleSet());
31 begin_main_frame_state.scroll_info->scrolls.push_back(scroll1);
32 begin_main_frame_state.scroll_info->scrolls.push_back(scroll2);
33
34 begin_main_frame_state.scroll_info->page_scale_delta = 0.3f;
35 begin_main_frame_state.scroll_info->elastic_overscroll_delta =
36 gfx::Vector2dF(0.5f, 0.6f);
37 begin_main_frame_state.scroll_info->top_controls_delta = 0.9f;
38
39 begin_main_frame_state.evicted_ui_resources = false;
40
41 proto::BeginMainFrameAndCommitState proto;
42 begin_main_frame_state.ToProtobuf(&proto);
43
44 BeginMainFrameAndCommitState new_begin_main_frame_state;
45 new_begin_main_frame_state.FromProtobuf(proto);
46
47 EXPECT_EQ(new_begin_main_frame_state.begin_frame_id,
48 begin_main_frame_state.begin_frame_id);
49 EXPECT_EQ(new_begin_main_frame_state.begin_frame_args,
50 begin_main_frame_state.begin_frame_args);
51 EXPECT_TRUE(begin_main_frame_state.scroll_info->EqualsForTesting(
52 *new_begin_main_frame_state.scroll_info.get()));
53 EXPECT_EQ(new_begin_main_frame_state.evicted_ui_resources,
54 begin_main_frame_state.evicted_ui_resources);
55 }
56
57 } // namespace
58 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/proxy_common.cc ('k') | cc/trees/scroll_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698