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

Side by Side Diff: ui/latency/mojo/struct_traits_unittest.cc

Issue 2804693002: Remove coordinates from LatencyInfo objects. (Closed)
Patch Set: Fix mojo latencyInfo test Created 3 years, 8 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 | « ui/latency/mojo/latency_info_struct_traits.cc ('k') | no next file » | 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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "mojo/public/cpp/bindings/binding_set.h" 6 #include "mojo/public/cpp/bindings/binding_set.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/latency/mojo/latency_info_struct_traits.h" 8 #include "ui/latency/mojo/latency_info_struct_traits.h"
9 #include "ui/latency/mojo/traits_test_service.mojom.h" 9 #include "ui/latency/mojo/traits_test_service.mojom.h"
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); 71 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
72 std::pair<LatencyComponentType, int64_t> output; 72 std::pair<LatencyComponentType, int64_t> output;
73 proxy->EchoLatencyComponentId(input, &output); 73 proxy->EchoLatencyComponentId(input, &output);
74 EXPECT_EQ(type, output.first); 74 EXPECT_EQ(type, output.first);
75 EXPECT_EQ(id, output.second); 75 EXPECT_EQ(id, output.second);
76 } 76 }
77 77
78 TEST_F(StructTraitsTest, LatencyInfo) { 78 TEST_F(StructTraitsTest, LatencyInfo) {
79 LatencyInfo latency; 79 LatencyInfo latency;
80 ASSERT_FALSE(latency.terminated()); 80 ASSERT_FALSE(latency.terminated());
81 ASSERT_EQ(0u, latency.input_coordinates_size());
82 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 0); 81 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 0);
83 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 100); 82 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 100);
84 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 83 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT,
85 1234, 0); 84 1234, 0);
86 EXPECT_TRUE(latency.AddInputCoordinate(gfx::PointF(100, 200)));
87 EXPECT_TRUE(latency.AddInputCoordinate(gfx::PointF(101, 201)));
88 // Up to 2 InputCoordinate is allowed.
89 EXPECT_FALSE(latency.AddInputCoordinate(gfx::PointF(102, 202)));
90 85
91 EXPECT_EQ(100, latency.trace_id()); 86 EXPECT_EQ(100, latency.trace_id());
92 EXPECT_TRUE(latency.terminated()); 87 EXPECT_TRUE(latency.terminated());
93 EXPECT_EQ(2u, latency.input_coordinates_size());
94 88
95 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); 89 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
96 LatencyInfo output; 90 LatencyInfo output;
97 proxy->EchoLatencyInfo(latency, &output); 91 proxy->EchoLatencyInfo(latency, &output);
98 92
99 EXPECT_EQ(latency.trace_id(), output.trace_id()); 93 EXPECT_EQ(latency.trace_id(), output.trace_id());
100 EXPECT_EQ(latency.terminated(), output.terminated()); 94 EXPECT_EQ(latency.terminated(), output.terminated());
101 EXPECT_EQ(latency.input_coordinates_size(), output.input_coordinates_size());
102 for (size_t i = 0; i < latency.input_coordinates_size(); i++) {
103 EXPECT_EQ(latency.input_coordinates()[i].x(),
104 output.input_coordinates()[i].x());
105 EXPECT_EQ(latency.input_coordinates()[i].y(),
106 output.input_coordinates()[i].y());
107 }
108 95
109 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 96 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234,
110 nullptr)); 97 nullptr));
111 98
112 LatencyInfo::LatencyComponent rwh_comp; 99 LatencyInfo::LatencyComponent rwh_comp;
113 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 100 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234,
114 &rwh_comp)); 101 &rwh_comp));
115 EXPECT_EQ(100, rwh_comp.sequence_number); 102 EXPECT_EQ(100, rwh_comp.sequence_number);
116 EXPECT_EQ(1u, rwh_comp.event_count); 103 EXPECT_EQ(1u, rwh_comp.event_count);
117 104
118 EXPECT_TRUE(output.FindLatency( 105 EXPECT_TRUE(output.FindLatency(
119 INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 1234, nullptr)); 106 INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 1234, nullptr));
120 } 107 }
121 108
122 } // namespace ui 109 } // namespace ui
OLDNEW
« no previous file with comments | « ui/latency/mojo/latency_info_struct_traits.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698