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

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

Issue 2696873002: Change OnWindowInputEvent to use display_id to find the host and update event root_location in WS. (Closed)
Patch Set: helper function Created 3 years, 10 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
« ui/aura/mus/window_tree_client.cc ('K') | « ui/aura/mus/window_tree_client.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 76dcf10e58846047070855359b207796cb78cc4d..85edd7b13b7bc1c3b7baeee0b95600f408eaabbc 100644
--- a/ui/aura/mus/window_tree_client_unittest.cc
+++ b/ui/aura/mus/window_tree_client_unittest.cc
@@ -22,6 +22,7 @@
#include "ui/aura/client/focus_client.h"
#include "ui/aura/client/transient_window_client.h"
#include "ui/aura/mus/capture_synchronizer.h"
+#include "ui/aura/mus/mus_types.h"
#include "ui/aura/mus/property_converter.h"
#include "ui/aura/mus/window_mus.h"
#include "ui/aura/mus/window_tree_client_delegate.h"
@@ -557,6 +558,43 @@ TEST_F(WindowTreeClientClientTest, InputEventBasic) {
EXPECT_EQ(event_location_in_child, window_delegate.last_event_location());
}
+TEST_F(WindowTreeClientClientTest, InputEventNoWindow) {
+ InputEventBasicTestWindowDelegate window_delegate(window_tree());
+ WindowTreeHostMus window_tree_host(window_tree_client_impl());
+ Window* top_level = window_tree_host.window();
+ const gfx::Rect bounds(0, 0, 100, 100);
+ window_tree_host.SetBoundsInPixels(bounds);
+ window_tree_host.InitHost();
+ window_tree_host.Show();
+ EXPECT_EQ(bounds, top_level->bounds());
+ EXPECT_EQ(bounds, window_tree_host.GetBoundsInPixels());
+ Window child(&window_delegate);
+ child.Init(ui::LAYER_NOT_DRAWN);
+ top_level->AddChild(&child);
+ 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(20, 30);
+ std::unique_ptr<ui::Event> ui_event(
+ 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, kInvalidServerId,
+ window_tree_host.display_id(), ui::Event::Clone(*ui_event.get()), 0);
+ // WindowTreeClient::OnWindowInputEvent cannot find a target window with
+ // kInvalidServerId but should fall back to use the display_id to find the
+ // window_tree_host for event dispatching. child should still get the event.
+ 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(gfx::Point(10, 20), window_delegate.last_event_location());
+}
+
class WindowTreeClientPointerObserverTest : public WindowTreeClientClientTest {
public:
WindowTreeClientPointerObserverTest() {}
« ui/aura/mus/window_tree_client.cc ('K') | « ui/aura/mus/window_tree_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698