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

Unified Diff: components/html_viewer/input_events_unittest.cc

Issue 1344223002: Revert of Overhaul Mandoline event transport code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « components/html_viewer/html_frame.cc ('k') | components/html_viewer/touch_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/html_viewer/input_events_unittest.cc
diff --git a/components/html_viewer/input_events_unittest.cc b/components/html_viewer/input_events_unittest.cc
deleted file mode 100644
index b5cdc50120afc6a2304fe99548e66ffec2f1611c..0000000000000000000000000000000000000000
--- a/components/html_viewer/input_events_unittest.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2015 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 "base/memory/scoped_ptr.h"
-#include "components/html_viewer/blink_input_events_type_converters.h"
-#include "mojo/converters/input_events/input_events_type_converters.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/public/web/WebInputEvent.h"
-#include "ui/events/event.h"
-#include "ui/events/event_utils.h"
-#include "ui/events/test/events_test_utils.h"
-
-using ui::EventTimeForNow;
-using blink::WebInputEvent;
-using blink::WebMouseEvent;
-using blink::WebMouseWheelEvent;
-
-namespace mojo {
-namespace {
-
-TEST(InputEventLibTest, MouseEventConversion) {
- scoped_ptr<ui::Event> mouseev(
- new ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(1, 2),
- gfx::Point(3, 4), EventTimeForNow(), 0, 0));
-
- mojo::EventPtr mojo_event(Event::From(*mouseev));
-
- EXPECT_EQ(EVENT_TYPE_POINTER_DOWN, mojo_event->action);
- EXPECT_EQ(POINTER_KIND_MOUSE, mojo_event->pointer_data->kind);
-
- scoped_ptr<blink::WebInputEvent> webevent =
- mojo_event.To<scoped_ptr<blink::WebInputEvent>>();
-
- ASSERT_TRUE(webevent);
- EXPECT_EQ(WebInputEvent::MouseDown, webevent->type);
-
- scoped_ptr<WebMouseEvent> web_mouse_event(
- static_cast<WebMouseEvent*>(webevent.release()));
-
- EXPECT_EQ(1, web_mouse_event->x);
- EXPECT_EQ(2, web_mouse_event->y);
- EXPECT_EQ(3, web_mouse_event->globalX);
- EXPECT_EQ(4, web_mouse_event->globalY);
-}
-
-TEST(InputEventLibTest, MouseWheelEventConversionNonPrecise) {
- scoped_ptr<ui::Event> original_wheel(new ui::MouseWheelEvent(
- gfx::Vector2d(-1.0 * 53, -2.0 * 53), gfx::PointF(1.0, 2.0),
- gfx::PointF(3.0, 4.0), EventTimeForNow(), 0, 0));
-
- mojo::EventPtr mojo_event(mojo::Event::From(*original_wheel));
-
- EXPECT_EQ(EVENT_TYPE_WHEEL, mojo_event->action);
-
- // Exercise the blink converter.
- scoped_ptr<blink::WebInputEvent> webevent =
- mojo_event.To<scoped_ptr<blink::WebInputEvent>>();
-
- ASSERT_TRUE(webevent);
- EXPECT_EQ(WebInputEvent::MouseWheel, webevent->type);
-
- scoped_ptr<WebMouseWheelEvent> web_wheel(
- static_cast<WebMouseWheelEvent*>(webevent.release()));
-
- EXPECT_EQ(1, web_wheel->x);
- EXPECT_EQ(2, web_wheel->y);
- EXPECT_EQ(3, web_wheel->globalX);
- EXPECT_EQ(4, web_wheel->globalY);
-
- EXPECT_EQ(-1.0 * ui::MouseWheelEvent::kWheelDelta, web_wheel->deltaX);
- EXPECT_EQ(-2.0 * ui::MouseWheelEvent::kWheelDelta, web_wheel->deltaY);
-
- EXPECT_EQ(-1.0, web_wheel->wheelTicksX);
- EXPECT_EQ(-2.0, web_wheel->wheelTicksY);
-
- EXPECT_FALSE(web_wheel->scrollByPage);
- EXPECT_FALSE(web_wheel->hasPreciseScrollingDeltas);
- EXPECT_TRUE(web_wheel->canScroll);
-
- // Exercise the round-trip converter.
- mojo::EventPtr mojo_other_event(mojo::Event::From(*original_wheel));
- scoped_ptr<ui::Event> new_event =
- mojo_other_event.To<scoped_ptr<ui::Event>>();
- EXPECT_EQ(ui::ET_MOUSEWHEEL, new_event->type());
-
- scoped_ptr<ui::MouseWheelEvent> ui_wheel(
- static_cast<ui::MouseWheelEvent*>(new_event.release()));
-
- EXPECT_EQ(-1 * ui::MouseWheelEvent::kWheelDelta, ui_wheel->x_offset());
- EXPECT_EQ(-2 * ui::MouseWheelEvent::kWheelDelta, ui_wheel->y_offset());
-}
-
-} // namespace
-} // namespace mojo
« no previous file with comments | « components/html_viewer/html_frame.cc ('k') | components/html_viewer/touch_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698