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

Unified Diff: ui/events/latency_info_unittest.cc

Issue 2783973002: Moving LatencyInfo into a separate component. (Closed)
Patch Set: Rebase again Created 3 years, 9 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
« no previous file with comments | « ui/events/latency_info.dot ('k') | ui/events/mojo/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/latency_info_unittest.cc
diff --git a/ui/events/latency_info_unittest.cc b/ui/events/latency_info_unittest.cc
deleted file mode 100644
index 51f328e4cbd2989b08f63b8e500e66c237a9d2c2..0000000000000000000000000000000000000000
--- a/ui/events/latency_info_unittest.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/events/latency_info.h"
-
-#include <stddef.h>
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace ui {
-
-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);
-
- EXPECT_EQ(info.latency_components().size(), 2u);
- LatencyInfo::LatencyComponent component;
- EXPECT_FALSE(
- info.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
- EXPECT_FALSE(
- 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);
-}
-
-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);
-
- EXPECT_EQ(info.latency_components().size(), 1u);
- LatencyInfo::LatencyComponent component;
- EXPECT_FALSE(
- info.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
- EXPECT_FALSE(
- 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.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));
-}
-
-} // namespace ui
« no previous file with comments | « ui/events/latency_info.dot ('k') | ui/events/mojo/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698