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

Side by Side Diff: ui/latency/ipc/latency_info_param_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/ipc/latency_info_param_traits.cc ('k') | ui/latency/latency_info.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "ipc/ipc_message_macros.h" 8 #include "ipc/ipc_message_macros.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/ipc/geometry/gfx_param_traits.h" 10 #include "ui/gfx/ipc/geometry/gfx_param_traits.h"
11 #include "ui/latency/ipc/latency_info_param_traits.h" 11 #include "ui/latency/ipc/latency_info_param_traits.h"
12 #include "ui/latency/ipc/latency_info_param_traits_macros.h" 12 #include "ui/latency/ipc/latency_info_param_traits_macros.h"
13 13
14 namespace ui { 14 namespace ui {
15 15
16 TEST(LatencyInfoParamTraitsTest, Basic) { 16 TEST(LatencyInfoParamTraitsTest, Basic) {
17 LatencyInfo latency; 17 LatencyInfo latency;
18 latency.set_trace_id(5);
18 ASSERT_FALSE(latency.terminated()); 19 ASSERT_FALSE(latency.terminated());
19 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 0); 20 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 0);
20 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 100); 21 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 100);
21 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 22 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT,
22 1234, 0); 23 1234, 0);
23 24
24 EXPECT_EQ(100, latency.trace_id()); 25 EXPECT_EQ(5, latency.trace_id());
25 EXPECT_TRUE(latency.terminated()); 26 EXPECT_TRUE(latency.terminated());
26 27
27 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); 28 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
28 IPC::WriteParam(&msg, latency); 29 IPC::WriteParam(&msg, latency);
29 base::PickleIterator iter(msg); 30 base::PickleIterator iter(msg);
30 LatencyInfo output; 31 LatencyInfo output;
31 EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); 32 EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output));
32 33
33 EXPECT_EQ(latency.trace_id(), output.trace_id()); 34 EXPECT_EQ(latency.trace_id(), output.trace_id());
34 EXPECT_EQ(latency.terminated(), output.terminated()); 35 EXPECT_EQ(latency.terminated(), output.terminated());
(...skipping 20 matching lines...) Expand all
55 IPC::WriteParam(&msg, components); 56 IPC::WriteParam(&msg, components);
56 IPC::WriteParam(&msg, static_cast<int64_t>(1234)); 57 IPC::WriteParam(&msg, static_cast<int64_t>(1234));
57 IPC::WriteParam(&msg, true); 58 IPC::WriteParam(&msg, true);
58 59
59 base::PickleIterator iter(msg); 60 base::PickleIterator iter(msg);
60 LatencyInfo output; 61 LatencyInfo output;
61 EXPECT_FALSE(IPC::ReadParam(&msg, &iter, &output)); 62 EXPECT_FALSE(IPC::ReadParam(&msg, &iter, &output));
62 } 63 }
63 64
64 } // namespace ui 65 } // namespace ui
OLDNEW
« no previous file with comments | « ui/latency/ipc/latency_info_param_traits.cc ('k') | ui/latency/latency_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698