| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |