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

Unified Diff: ui/aura/mus/window_tree_client_unittest.cc

Issue 2533213006: Fixes coordinates supplied to WindowTreeHost (Closed)
Patch Set: comment Created 4 years 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/aura/mus/window_tree_client_unittest.cc
diff --git a/ui/aura/mus/window_tree_client_unittest.cc b/ui/aura/mus/window_tree_client_unittest.cc
index 8daf7288b383ddbea6cc3685affab72c6c15c5d8..ef92a9a10e675c74a32816cda9d36d5c1ca4cab8 100644
--- a/ui/aura/mus/window_tree_client_unittest.cc
+++ b/ui/aura/mus/window_tree_client_unittest.cc
@@ -449,18 +449,22 @@ class InputEventBasicTestWindowDelegate : public test::TestWindowDelegate {
bool got_move() const { return got_move_; }
bool was_acked() const { return was_acked_; }
+ const gfx::Point& last_event_location() const { return last_event_location_; }
// TestWindowDelegate::
void OnMouseEvent(ui::MouseEvent* event) override {
was_acked_ = test_window_tree_->WasEventAcked(kEventId);
if (event->type() == ui::ET_MOUSE_MOVED)
got_move_ = true;
+ last_event_location_ = event->location();
+ event->SetHandled();
}
private:
TestWindowTree* test_window_tree_;
bool was_acked_ = false;
bool got_move_ = false;
+ gfx::Point last_event_location_;
DISALLOW_COPY_AND_ASSIGN(InputEventBasicTestWindowDelegate);
};
@@ -479,19 +483,25 @@ TEST_F(WindowTreeClientClientTest, InputEventBasic) {
Window child(&window_delegate);
child.Init(ui::LAYER_NOT_DRAWN);
top_level->AddChild(&child);
- child.SetBounds(gfx::Rect(0, 0, 100, 100));
+ child.SetBounds(gfx::Rect(10, 10, 100, 100));
child.Show();
EXPECT_FALSE(window_delegate.got_move());
EXPECT_FALSE(window_delegate.was_acked());
+ const gfx::Point event_location_in_child(2, 3);
std::unique_ptr<ui::Event> ui_event(
- new ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(),
- ui::EventTimeForNow(), ui::EF_NONE, 0));
+ new ui::MouseEvent(ui::ET_MOUSE_MOVED, event_location_in_child,
+ gfx::Point(), ui::EventTimeForNow(), ui::EF_NONE, 0));
window_tree_client()->OnWindowInputEvent(
- InputEventBasicTestWindowDelegate::kEventId, server_id(top_level),
+ InputEventBasicTestWindowDelegate::kEventId, server_id(&child),
ui::Event::Clone(*ui_event.get()), 0);
- EXPECT_TRUE(window_tree()->WasEventAcked(1));
+ EXPECT_TRUE(window_tree()->WasEventAcked(
+ InputEventBasicTestWindowDelegate::kEventId));
+ EXPECT_EQ(ui::mojom::EventResult::HANDLED,
+ window_tree()->GetEventResult(
+ InputEventBasicTestWindowDelegate::kEventId));
EXPECT_TRUE(window_delegate.got_move());
EXPECT_FALSE(window_delegate.was_acked());
+ EXPECT_EQ(event_location_in_child, window_delegate.last_event_location());
}
class WindowTreeClientPointerObserverTest : public WindowTreeClientClientTest {

Powered by Google App Engine
This is Rietveld 408576698