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

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

Issue 2953073002: LatencyInfo trace_id_ no longer dependent on sequence_number. (Closed)
Patch Set: Address nit. Created 3 years, 5 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 <utility> 5 #include <utility>
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "mojo/public/cpp/bindings/binding_set.h" 8 #include "mojo/public/cpp/bindings/binding_set.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/latency/mojo/latency_info_struct_traits.h" 10 #include "ui/latency/mojo/latency_info_struct_traits.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 std::pair<LatencyComponentType, int64_t> input(type, id); 73 std::pair<LatencyComponentType, int64_t> input(type, id);
74 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); 74 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
75 std::pair<LatencyComponentType, int64_t> output; 75 std::pair<LatencyComponentType, int64_t> output;
76 proxy->EchoLatencyComponentId(input, &output); 76 proxy->EchoLatencyComponentId(input, &output);
77 EXPECT_EQ(type, output.first); 77 EXPECT_EQ(type, output.first);
78 EXPECT_EQ(id, output.second); 78 EXPECT_EQ(id, output.second);
79 } 79 }
80 80
81 TEST_F(StructTraitsTest, LatencyInfo) { 81 TEST_F(StructTraitsTest, LatencyInfo) {
82 LatencyInfo latency; 82 LatencyInfo latency;
83 latency.set_trace_id(5);
83 ASSERT_FALSE(latency.terminated()); 84 ASSERT_FALSE(latency.terminated());
84 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 0); 85 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 0);
85 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 100); 86 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 100);
86 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 87 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT,
87 1234, 0); 88 1234, 0);
88 89
89 EXPECT_EQ(100, latency.trace_id()); 90 EXPECT_EQ(5, latency.trace_id());
90 EXPECT_TRUE(latency.terminated()); 91 EXPECT_TRUE(latency.terminated());
91 92
92 latency.set_source_event_type(ui::TOUCH); 93 latency.set_source_event_type(ui::TOUCH);
93 94
94 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); 95 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
95 LatencyInfo output; 96 LatencyInfo output;
96 proxy->EchoLatencyInfo(latency, &output); 97 proxy->EchoLatencyInfo(latency, &output);
97 98
98 EXPECT_EQ(latency.trace_id(), output.trace_id()); 99 EXPECT_EQ(latency.trace_id(), output.trace_id());
99 EXPECT_EQ(latency.terminated(), output.terminated()); 100 EXPECT_EQ(latency.terminated(), output.terminated());
100 EXPECT_EQ(latency.source_event_type(), output.source_event_type()); 101 EXPECT_EQ(latency.source_event_type(), output.source_event_type());
101 102
102 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 103 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234,
103 nullptr)); 104 nullptr));
104 105
105 LatencyInfo::LatencyComponent rwh_comp; 106 LatencyInfo::LatencyComponent rwh_comp;
106 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 107 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234,
107 &rwh_comp)); 108 &rwh_comp));
108 EXPECT_EQ(100, rwh_comp.sequence_number); 109 EXPECT_EQ(100, rwh_comp.sequence_number);
109 EXPECT_EQ(1u, rwh_comp.event_count); 110 EXPECT_EQ(1u, rwh_comp.event_count);
110 111
111 EXPECT_TRUE(output.FindLatency( 112 EXPECT_TRUE(output.FindLatency(
112 INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 1234, nullptr)); 113 INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 1234, nullptr));
113 } 114 }
114 115
115 } // namespace ui 116 } // 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