| OLD | NEW |
| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "components/mus/common/types.h" | 13 #include "components/mus/common/types.h" |
| 14 #include "components/mus/common/util.h" | 14 #include "components/mus/common/util.h" |
| 15 #include "components/mus/public/interfaces/window_tree.mojom.h" | 15 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 16 #include "components/mus/surfaces/surfaces_state.h" | 16 #include "components/mus/surfaces/surfaces_state.h" |
| 17 #include "components/mus/ws/connection_manager.h" | 17 #include "components/mus/ws/connection_manager.h" |
| 18 #include "components/mus/ws/connection_manager_delegate.h" | 18 #include "components/mus/ws/connection_manager_delegate.h" |
| 19 #include "components/mus/ws/default_access_policy.h" |
| 19 #include "components/mus/ws/display_binding.h" | 20 #include "components/mus/ws/display_binding.h" |
| 20 #include "components/mus/ws/ids.h" | 21 #include "components/mus/ws/ids.h" |
| 21 #include "components/mus/ws/platform_display.h" | 22 #include "components/mus/ws/platform_display.h" |
| 22 #include "components/mus/ws/platform_display_factory.h" | 23 #include "components/mus/ws/platform_display_factory.h" |
| 23 #include "components/mus/ws/platform_display_init_params.h" | 24 #include "components/mus/ws/platform_display_init_params.h" |
| 24 #include "components/mus/ws/server_window.h" | 25 #include "components/mus/ws/server_window.h" |
| 25 #include "components/mus/ws/server_window_surface_manager_test_api.h" | 26 #include "components/mus/ws/server_window_surface_manager_test_api.h" |
| 26 #include "components/mus/ws/test_change_tracker.h" | 27 #include "components/mus/ws/test_change_tracker.h" |
| 27 #include "components/mus/ws/test_utils.h" | 28 #include "components/mus/ws/test_utils.h" |
| 29 #include "components/mus/ws/window_manager_access_policy.h" |
| 28 #include "components/mus/ws/window_tree.h" | 30 #include "components/mus/ws/window_tree.h" |
| 29 #include "components/mus/ws/window_tree_binding.h" | 31 #include "components/mus/ws/window_tree_binding.h" |
| 30 #include "mojo/converters/geometry/geometry_type_converters.h" | 32 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 31 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 33 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| 32 #include "mojo/shell/public/interfaces/connector.mojom.h" | 34 #include "mojo/shell/public/interfaces/connector.mojom.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 34 #include "ui/events/event.h" | 36 #include "ui/events/event.h" |
| 35 #include "ui/events/event_utils.h" | 37 #include "ui/events/event_utils.h" |
| 36 #include "ui/gfx/geometry/rect.h" | 38 #include "ui/gfx/geometry/rect.h" |
| 37 | 39 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 public: | 102 public: |
| 101 TestDisplayBinding(Display* display, ConnectionManager* manager) | 103 TestDisplayBinding(Display* display, ConnectionManager* manager) |
| 102 : display_(display), connection_manager_(manager) {} | 104 : display_(display), connection_manager_(manager) {} |
| 103 ~TestDisplayBinding() override {} | 105 ~TestDisplayBinding() override {} |
| 104 | 106 |
| 105 private: | 107 private: |
| 106 // DisplayBinding: | 108 // DisplayBinding: |
| 107 WindowTree* CreateWindowTree(ServerWindow* root) override { | 109 WindowTree* CreateWindowTree(ServerWindow* root) override { |
| 108 return connection_manager_->EmbedAtWindow( | 110 return connection_manager_->EmbedAtWindow( |
| 109 root, mojo::shell::mojom::kRootUserID, | 111 root, mojo::shell::mojom::kRootUserID, |
| 110 mus::mojom::WindowTreeClientPtr()); | 112 mus::mojom::WindowTreeClientPtr(), |
| 113 make_scoped_ptr(new WindowManagerAccessPolicy)); |
| 111 } | 114 } |
| 112 | 115 |
| 113 Display* display_; | 116 Display* display_; |
| 114 ConnectionManager* connection_manager_; | 117 ConnectionManager* connection_manager_; |
| 115 | 118 |
| 116 DISALLOW_COPY_AND_ASSIGN(TestDisplayBinding); | 119 DISALLOW_COPY_AND_ASSIGN(TestDisplayBinding); |
| 117 }; | 120 }; |
| 118 | 121 |
| 119 ui::PointerEvent CreatePointerDownEvent(int x, int y) { | 122 ui::PointerEvent CreatePointerDownEvent(int x, int y) { |
| 120 return ui::PointerEvent(ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(x, y), | 123 return ui::PointerEvent(ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(x, y), |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // it. | 220 // it. |
| 218 void SetupEventTargeting(TestWindowTreeClient** out_client, | 221 void SetupEventTargeting(TestWindowTreeClient** out_client, |
| 219 WindowTree** window_tree, | 222 WindowTree** window_tree, |
| 220 ServerWindow** window); | 223 ServerWindow** window); |
| 221 | 224 |
| 222 // Creates a new tree as the specified user. This does what creation via | 225 // Creates a new tree as the specified user. This does what creation via |
| 223 // a WindowTreeFactory does. | 226 // a WindowTreeFactory does. |
| 224 WindowTree* CreateNewTree(const UserId& user_id, | 227 WindowTree* CreateNewTree(const UserId& user_id, |
| 225 TestWindowTreeBinding** binding) { | 228 TestWindowTreeBinding** binding) { |
| 226 WindowTree* tree = | 229 WindowTree* tree = |
| 227 new WindowTree(connection_manager_.get(), user_id, nullptr); | 230 new WindowTree(connection_manager_.get(), user_id, nullptr, |
| 231 make_scoped_ptr(new DefaultAccessPolicy)); |
| 228 *binding = new TestWindowTreeBinding; | 232 *binding = new TestWindowTreeBinding; |
| 229 connection_manager_->AddTree(make_scoped_ptr(tree), | 233 connection_manager_->AddTree(make_scoped_ptr(tree), |
| 230 make_scoped_ptr(*binding), nullptr); | 234 make_scoped_ptr(*binding), nullptr); |
| 231 return tree; | 235 return tree; |
| 232 } | 236 } |
| 233 | 237 |
| 234 protected: | 238 protected: |
| 235 // testing::Test: | 239 // testing::Test: |
| 236 void SetUp() override { | 240 void SetUp() override { |
| 237 PlatformDisplay::set_factory_for_testing(&platform_display_factory_); | 241 PlatformDisplay::set_factory_for_testing(&platform_display_factory_); |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 | 895 |
| 892 // Make |w3| child of |w1|. This should release capture as |w3| is now blocked | 896 // Make |w3| child of |w1|. This should release capture as |w3| is now blocked |
| 893 // by a modal window. | 897 // by a modal window. |
| 894 ASSERT_TRUE(tree->AddWindow(w1_id, w3_id)); | 898 ASSERT_TRUE(tree->AddWindow(w1_id, w3_id)); |
| 895 EXPECT_EQ(nullptr, GetCaptureWindow(display)); | 899 EXPECT_EQ(nullptr, GetCaptureWindow(display)); |
| 896 } | 900 } |
| 897 | 901 |
| 898 } // namespace test | 902 } // namespace test |
| 899 } // namespace ws | 903 } // namespace ws |
| 900 } // namespace mus | 904 } // namespace mus |
| OLD | NEW |