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

Unified Diff: ui/latency/latency_info_unittest.cc

Issue 2914023002: Remove LatencyInfo::sequence_number. (May break metrics).
Patch Set: Fix Windows. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/latency/latency_info_unittest.cc
diff --git a/ui/latency/latency_info_unittest.cc b/ui/latency/latency_info_unittest.cc
index eb0c1ae2c23c0e75b0446464f006058aca210988..5098e94824b37d9f7d8bba79ce854f714f064694 100644
--- a/ui/latency/latency_info_unittest.cc
+++ b/ui/latency/latency_info_unittest.cc
@@ -14,12 +14,10 @@ TEST(LatencyInfoTest, AddTwoSeparateEvent) {
LatencyInfo info;
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
0,
- 1,
base::TimeTicks::FromInternalValue(100),
1);
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
1,
- 5,
base::TimeTicks::FromInternalValue(1000),
2);
@@ -31,12 +29,10 @@ TEST(LatencyInfoTest, AddTwoSeparateEvent) {
info.FindLatency(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1, &component));
EXPECT_TRUE(
info.FindLatency(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, &component));
- EXPECT_EQ(component.sequence_number, 1);
EXPECT_EQ(component.event_count, 1u);
EXPECT_EQ(component.event_time.ToInternalValue(), 100);
EXPECT_TRUE(
info.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1, &component));
- EXPECT_EQ(component.sequence_number, 5);
EXPECT_EQ(component.event_count, 2u);
EXPECT_EQ(component.event_time.ToInternalValue(), 1000);
}
@@ -45,12 +41,10 @@ TEST(LatencyInfoTest, AddTwoSameEvent) {
LatencyInfo info;
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
0,
- 30,
base::TimeTicks::FromInternalValue(100),
2);
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
0,
- 13,
base::TimeTicks::FromInternalValue(200),
3);
@@ -62,22 +56,39 @@ TEST(LatencyInfoTest, AddTwoSameEvent) {
info.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1, &component));
EXPECT_TRUE(
info.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, &component));
- EXPECT_EQ(component.sequence_number, 30);
EXPECT_EQ(component.event_count, 5u);
EXPECT_EQ(component.event_time.ToInternalValue(), (100 * 2 + 200 * 3) / 5);
}
TEST(LatencyInfoTest, RemoveLatency) {
LatencyInfo info;
- info.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0);
- info.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1, 0);
- info.AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
+ info.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0);
+ info.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1);
+ info.AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0);
info.RemoveLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT);
- EXPECT_FALSE(info.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0));
- EXPECT_FALSE(info.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1, 0));
- EXPECT_TRUE(info.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0));
+ EXPECT_FALSE(
+ info.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, nullptr));
+ EXPECT_FALSE(
+ info.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, nullptr));
+ EXPECT_TRUE(info.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, nullptr));
+}
+
+TEST(LatencyInfoTest, TraceIdsIncrease) {
tdresser 2017/06/08 18:36:44 Real change.
+ LatencyInfo info1;
+ // ID should be -1 until a begin component has been added.
+ EXPECT_EQ(info1.trace_id(), -1);
+
+ info1.AddLatencyNumber(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0);
+ EXPECT_EQ(info1.trace_id(), 0);
+
+ LatencyInfo info2;
+ // ID should be -1 until a begin component has been added.
+ EXPECT_EQ(info2.trace_id(), -1);
+
+ info2.AddLatencyNumber(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0);
+ EXPECT_EQ(info2.trace_id(), 1);
}
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698