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

Unified Diff: ui/events/mojo/struct_traits_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/mojo/latency_info_struct_traits.cc ('k') | ui/events/mojo/traits_test_service.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/mojo/struct_traits_unittest.cc
diff --git a/ui/events/mojo/struct_traits_unittest.cc b/ui/events/mojo/struct_traits_unittest.cc
index 766c61b0a16cd0a665f3362383f1987135dc2304..a0e79f1ebdee0f78bb5b80feeb7ba73954fd671b 100644
--- a/ui/events/mojo/struct_traits_unittest.cc
+++ b/ui/events/mojo/struct_traits_unittest.cc
@@ -9,8 +9,6 @@
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/mojo/event.mojom.h"
#include "ui/events/mojo/event_struct_traits.h"
-#include "ui/events/mojo/latency_info_struct_traits.h"
-#include "ui/events/mojo/traits_test_service.mojom.h"
namespace ui {
@@ -32,23 +30,6 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
callback.Run(std::move(e));
}
- void EchoLatencyComponent(
- const LatencyInfo::LatencyComponent& l,
- const EchoLatencyComponentCallback& callback) override {
- callback.Run(l);
- }
-
- void EchoLatencyComponentId(
- const std::pair<LatencyComponentType, int64_t>& id,
- const EchoLatencyComponentIdCallback& callback) override {
- callback.Run(id);
- }
-
- void EchoLatencyInfo(const LatencyInfo& info,
- const EchoLatencyInfoCallback& callback) override {
- callback.Run(info);
- }
-
base::MessageLoop loop_;
mojo::BindingSet<TraitsTestService> traits_test_bindings_;
DISALLOW_COPY_AND_ASSIGN(StructTraitsTest);
@@ -56,78 +37,6 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
} // namespace
-TEST_F(StructTraitsTest, LatencyComponent) {
- const int64_t sequence_number = 13371337;
- const base::TimeTicks event_time = base::TimeTicks::Now();
- const uint32_t event_count = 1234;
- LatencyInfo::LatencyComponent input;
- input.sequence_number = sequence_number;
- input.event_time = event_time;
- input.event_count = event_count;
- mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
- LatencyInfo::LatencyComponent output;
- proxy->EchoLatencyComponent(input, &output);
- EXPECT_EQ(sequence_number, output.sequence_number);
- EXPECT_EQ(event_time, output.event_time);
- EXPECT_EQ(event_count, output.event_count);
-}
-
-TEST_F(StructTraitsTest, LatencyComponentId) {
- const LatencyComponentType type =
- INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT;
- const int64_t id = 1337;
- std::pair<LatencyComponentType, int64_t> input(type, id);
- mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
- std::pair<LatencyComponentType, int64_t> output;
- proxy->EchoLatencyComponentId(input, &output);
- EXPECT_EQ(type, output.first);
- EXPECT_EQ(id, output.second);
-}
-
-TEST_F(StructTraitsTest, LatencyInfo) {
- LatencyInfo latency;
- ASSERT_FALSE(latency.terminated());
- ASSERT_EQ(0u, latency.input_coordinates_size());
- latency.AddLatencyNumber(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234, 0);
- latency.AddLatencyNumber(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234, 100);
- latency.AddLatencyNumber(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT,
- 1234, 0);
- EXPECT_TRUE(latency.AddInputCoordinate(gfx::PointF(100, 200)));
- EXPECT_TRUE(latency.AddInputCoordinate(gfx::PointF(101, 201)));
- // Up to 2 InputCoordinate is allowed.
- EXPECT_FALSE(latency.AddInputCoordinate(gfx::PointF(102, 202)));
-
- EXPECT_EQ(100, latency.trace_id());
- EXPECT_TRUE(latency.terminated());
- EXPECT_EQ(2u, latency.input_coordinates_size());
-
- mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
- LatencyInfo output;
- proxy->EchoLatencyInfo(latency, &output);
-
- EXPECT_EQ(latency.trace_id(), output.trace_id());
- EXPECT_EQ(latency.terminated(), output.terminated());
- EXPECT_EQ(latency.input_coordinates_size(), output.input_coordinates_size());
- for (size_t i = 0; i < latency.input_coordinates_size(); i++) {
- EXPECT_EQ(latency.input_coordinates()[i].x(),
- output.input_coordinates()[i].x());
- EXPECT_EQ(latency.input_coordinates()[i].y(),
- output.input_coordinates()[i].y());
- }
-
- EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1234,
- nullptr));
-
- LatencyInfo::LatencyComponent rwh_comp;
- EXPECT_TRUE(output.FindLatency(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1234,
- &rwh_comp));
- EXPECT_EQ(100, rwh_comp.sequence_number);
- EXPECT_EQ(1u, rwh_comp.event_count);
-
- EXPECT_TRUE(output.FindLatency(
- INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 1234, nullptr));
-}
-
TEST_F(StructTraitsTest, KeyEvent) {
KeyEvent kTestData[] = {
{ET_KEY_PRESSED, VKEY_RETURN, EF_CONTROL_DOWN},
« no previous file with comments | « ui/events/mojo/latency_info_struct_traits.cc ('k') | ui/events/mojo/traits_test_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698