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

Side by Side Diff: components/mus/ws/window_tree_unittest.cc

Issue 2089023002: Promotes remaining global window manager state into WindowManagerState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: override Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « components/mus/ws/window_tree.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/mus/ws/window_tree.h" 5 #include "components/mus/ws/window_tree.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 10 matching lines...) Expand all
21 #include "components/mus/ws/ids.h" 21 #include "components/mus/ws/ids.h"
22 #include "components/mus/ws/platform_display.h" 22 #include "components/mus/ws/platform_display.h"
23 #include "components/mus/ws/platform_display_factory.h" 23 #include "components/mus/ws/platform_display_factory.h"
24 #include "components/mus/ws/platform_display_init_params.h" 24 #include "components/mus/ws/platform_display_init_params.h"
25 #include "components/mus/ws/server_window.h" 25 #include "components/mus/ws/server_window.h"
26 #include "components/mus/ws/server_window_surface_manager_test_api.h" 26 #include "components/mus/ws/server_window_surface_manager_test_api.h"
27 #include "components/mus/ws/test_change_tracker.h" 27 #include "components/mus/ws/test_change_tracker.h"
28 #include "components/mus/ws/test_server_window_delegate.h" 28 #include "components/mus/ws/test_server_window_delegate.h"
29 #include "components/mus/ws/test_utils.h" 29 #include "components/mus/ws/test_utils.h"
30 #include "components/mus/ws/window_manager_access_policy.h" 30 #include "components/mus/ws/window_manager_access_policy.h"
31 #include "components/mus/ws/window_manager_display_root.h"
31 #include "components/mus/ws/window_server.h" 32 #include "components/mus/ws/window_server.h"
32 #include "components/mus/ws/window_server_delegate.h" 33 #include "components/mus/ws/window_server_delegate.h"
33 #include "components/mus/ws/window_tree_binding.h" 34 #include "components/mus/ws/window_tree_binding.h"
34 #include "services/shell/public/interfaces/connector.mojom.h" 35 #include "services/shell/public/interfaces/connector.mojom.h"
35 #include "testing/gtest/include/gtest/gtest.h" 36 #include "testing/gtest/include/gtest/gtest.h"
36 #include "ui/events/event.h" 37 #include "ui/events/event.h"
37 #include "ui/events/event_utils.h" 38 #include "ui/events/event_utils.h"
38 #include "ui/gfx/geometry/rect.h" 39 #include "ui/gfx/geometry/rect.h"
39 40
40 namespace mus { 41 namespace mus {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 78 }
78 79
79 ui::PointerEvent CreateMouseUpEvent(int x, int y) { 80 ui::PointerEvent CreateMouseUpEvent(int x, int y) {
80 return ui::PointerEvent( 81 return ui::PointerEvent(
81 ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::Point(x, y), gfx::Point(x, y), 82 ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::Point(x, y), gfx::Point(x, y),
82 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 83 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
83 ui::EF_LEFT_MOUSE_BUTTON)); 84 ui::EF_LEFT_MOUSE_BUTTON));
84 } 85 }
85 86
86 ServerWindow* GetCaptureWindow(Display* display) { 87 ServerWindow* GetCaptureWindow(Display* display) {
87 return display->GetActiveWindowManagerState()->capture_window(); 88 return display->GetActiveWindowManagerDisplayRoot()
89 ->window_manager_state()
90 ->capture_window();
88 } 91 }
89 92
90 mojom::EventMatcherPtr CreateEventMatcher(ui::mojom::EventType type) { 93 mojom::EventMatcherPtr CreateEventMatcher(ui::mojom::EventType type) {
91 mojom::EventMatcherPtr matcher = mojom::EventMatcher::New(); 94 mojom::EventMatcherPtr matcher = mojom::EventMatcher::New();
92 matcher->type_matcher = mojom::EventTypeMatcher::New(); 95 matcher->type_matcher = mojom::EventTypeMatcher::New();
93 matcher->type_matcher->type = type; 96 matcher->type_matcher->type = type;
94 return matcher; 97 return matcher;
95 } 98 }
96 99
97 } // namespace 100 } // namespace
(...skipping 30 matching lines...) Expand all
128 DisplayTestApi(display()).OnEvent(event); 131 DisplayTestApi(display()).OnEvent(event);
129 } 132 }
130 133
131 void set_window_manager_internal(WindowTree* tree, 134 void set_window_manager_internal(WindowTree* tree,
132 mojom::WindowManager* wm_internal) { 135 mojom::WindowManager* wm_internal) {
133 WindowTreeTestApi(tree).set_window_manager_internal(wm_internal); 136 WindowTreeTestApi(tree).set_window_manager_internal(wm_internal);
134 } 137 }
135 138
136 void AckPreviousEvent() { 139 void AckPreviousEvent() {
137 WindowManagerStateTestApi test_api( 140 WindowManagerStateTestApi test_api(
138 display()->GetActiveWindowManagerState()); 141 display()->GetActiveWindowManagerDisplayRoot()->window_manager_state());
139 while (test_api.tree_awaiting_input_ack()) { 142 while (test_api.tree_awaiting_input_ack()) {
140 test_api.tree_awaiting_input_ack()->OnWindowInputEventAck( 143 test_api.tree_awaiting_input_ack()->OnWindowInputEventAck(
141 0, mojom::EventResult::HANDLED); 144 0, mojom::EventResult::HANDLED);
142 } 145 }
143 } 146 }
144 147
145 void DispatchEventAndAckImmediately(const ui::Event& event) { 148 void DispatchEventAndAckImmediately(const ui::Event& event) {
146 DispatchEventWithoutAck(event); 149 DispatchEventWithoutAck(event);
147 AckPreviousEvent(); 150 AckPreviousEvent();
148 } 151 }
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 ServerWindow* window = window_event_targeting_helper_.CreatePrimaryTree( 993 ServerWindow* window = window_event_targeting_helper_.CreatePrimaryTree(
991 gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 50, 50)); 994 gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 50, 50));
992 WindowTree* owning_tree = 995 WindowTree* owning_tree =
993 window_server()->GetTreeWithId(window->id().client_id); 996 window_server()->GetTreeWithId(window->id().client_id);
994 WindowTree* embed_tree = window_server()->GetTreeWithRoot(window); 997 WindowTree* embed_tree = window_server()->GetTreeWithRoot(window);
995 ASSERT_NE(owning_tree, embed_tree); 998 ASSERT_NE(owning_tree, embed_tree);
996 ASSERT_TRUE( 999 ASSERT_TRUE(
997 owning_tree->SetCapture(ClientWindowIdForWindow(owning_tree, window))); 1000 owning_tree->SetCapture(ClientWindowIdForWindow(owning_tree, window)));
998 DispatchEventWithoutAck(CreateMouseMoveEvent(21, 22)); 1001 DispatchEventWithoutAck(CreateMouseMoveEvent(21, 22));
999 WindowManagerStateTestApi wm_state_test_api( 1002 WindowManagerStateTestApi wm_state_test_api(
1000 display()->GetActiveWindowManagerState()); 1003 display()->GetActiveWindowManagerDisplayRoot()->window_manager_state());
1001 EXPECT_EQ(owning_tree, wm_state_test_api.tree_awaiting_input_ack()); 1004 EXPECT_EQ(owning_tree, wm_state_test_api.tree_awaiting_input_ack());
1002 AckPreviousEvent(); 1005 AckPreviousEvent();
1003 1006
1004 // Set capture from the embedded client and make sure it gets the event. 1007 // Set capture from the embedded client and make sure it gets the event.
1005 ASSERT_TRUE( 1008 ASSERT_TRUE(
1006 embed_tree->SetCapture(ClientWindowIdForWindow(embed_tree, window))); 1009 embed_tree->SetCapture(ClientWindowIdForWindow(embed_tree, window)));
1007 DispatchEventWithoutAck(CreateMouseMoveEvent(22, 23)); 1010 DispatchEventWithoutAck(CreateMouseMoveEvent(22, 23));
1008 EXPECT_EQ(embed_tree, wm_state_test_api.tree_awaiting_input_ack()); 1011 EXPECT_EQ(embed_tree, wm_state_test_api.tree_awaiting_input_ack());
1009 } 1012 }
1010 1013
1011 } // namespace test 1014 } // namespace test
1012 } // namespace ws 1015 } // namespace ws
1013 } // namespace mus 1016 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_tree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698