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

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

Issue 2847553003: Adding source_event_type to LatencyInfo mojom (Closed)
Patch Set: Updating unit test Created 3 years, 7 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 LatencyInfo latency; 79 LatencyInfo latency;
80 ASSERT_FALSE(latency.terminated()); 80 ASSERT_FALSE(latency.terminated());
81 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 0); 81 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 0);
82 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 100); 82 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 100);
83 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 83 latency.AddLatencyNumber(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT,
84 1234, 0); 84 1234, 0);
85 85
86 EXPECT_EQ(100, latency.trace_id()); 86 EXPECT_EQ(100, latency.trace_id());
87 EXPECT_TRUE(latency.terminated()); 87 EXPECT_TRUE(latency.terminated());
88 88
89 latency.set_source_event_type(ui::TOUCH);
90
89 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); 91 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
90 LatencyInfo output; 92 LatencyInfo output;
91 proxy->EchoLatencyInfo(latency, &output); 93 proxy->EchoLatencyInfo(latency, &output);
92 94
93 EXPECT_EQ(latency.trace_id(), output.trace_id()); 95 EXPECT_EQ(latency.trace_id(), output.trace_id());
94 EXPECT_EQ(latency.terminated(), output.terminated()); 96 EXPECT_EQ(latency.terminated(), output.terminated());
97 EXPECT_EQ(latency.source_event_type(), output.source_event_type());
95 98
96 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 99 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234,
97 nullptr)); 100 nullptr));
98 101
99 LatencyInfo::LatencyComponent rwh_comp; 102 LatencyInfo::LatencyComponent rwh_comp;
100 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 103 EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234,
101 &rwh_comp)); 104 &rwh_comp));
102 EXPECT_EQ(100, rwh_comp.sequence_number); 105 EXPECT_EQ(100, rwh_comp.sequence_number);
103 EXPECT_EQ(1u, rwh_comp.event_count); 106 EXPECT_EQ(1u, rwh_comp.event_count);
104 107
105 EXPECT_TRUE(output.FindLatency( 108 EXPECT_TRUE(output.FindLatency(
106 INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 1234, nullptr)); 109 INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 1234, nullptr));
107 } 110 }
108 111
109 } // namespace ui 112 } // namespace ui
OLDNEW
« ui/latency/mojo/latency_info.mojom ('K') | « 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