| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_manager_state.h" | 5 #include "components/mus/ws/window_manager_state.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/test/test_simple_task_runner.h" | 12 #include "base/test/test_simple_task_runner.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "components/mus/common/event_matcher_util.h" | 14 #include "components/mus/common/event_matcher_util.h" |
| 15 #include "components/mus/surfaces/surfaces_state.h" | 15 #include "components/mus/surfaces/surfaces_state.h" |
| 16 #include "components/mus/ws/accelerator.h" | 16 #include "components/mus/ws/accelerator.h" |
| 17 #include "components/mus/ws/display.h" |
| 17 #include "components/mus/ws/display_binding.h" | 18 #include "components/mus/ws/display_binding.h" |
| 18 #include "components/mus/ws/platform_display.h" | 19 #include "components/mus/ws/platform_display.h" |
| 19 #include "components/mus/ws/platform_display_init_params.h" | 20 #include "components/mus/ws/platform_display_init_params.h" |
| 20 #include "components/mus/ws/server_window_surface_manager_test_api.h" | 21 #include "components/mus/ws/server_window_surface_manager_test_api.h" |
| 21 #include "components/mus/ws/test_change_tracker.h" | 22 #include "components/mus/ws/test_change_tracker.h" |
| 22 #include "components/mus/ws/test_server_window_delegate.h" | 23 #include "components/mus/ws/test_server_window_delegate.h" |
| 23 #include "components/mus/ws/test_utils.h" | 24 #include "components/mus/ws/test_utils.h" |
| 24 #include "components/mus/ws/window_manager_access_policy.h" | 25 #include "components/mus/ws/window_manager_access_policy.h" |
| 26 #include "components/mus/ws/window_manager_display_root.h" |
| 25 #include "components/mus/ws/window_manager_state.h" | 27 #include "components/mus/ws/window_manager_state.h" |
| 26 #include "components/mus/ws/window_server.h" | 28 #include "components/mus/ws/window_server.h" |
| 27 #include "components/mus/ws/window_tree.h" | 29 #include "components/mus/ws/window_tree.h" |
| 28 #include "services/shell/public/interfaces/connector.mojom.h" | 30 #include "services/shell/public/interfaces/connector.mojom.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
| 30 #include "ui/events/event.h" | 32 #include "ui/events/event.h" |
| 31 | 33 |
| 32 namespace mus { | 34 namespace mus { |
| 33 namespace ws { | 35 namespace ws { |
| 34 namespace test { | 36 namespace test { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 115 } |
| 114 | 116 |
| 115 void WindowManagerStateTest::OnEventAckTimeout( | 117 void WindowManagerStateTest::OnEventAckTimeout( |
| 116 ClientSpecificId client_id) { | 118 ClientSpecificId client_id) { |
| 117 WindowManagerStateTestApi test_api(window_manager_state_); | 119 WindowManagerStateTestApi test_api(window_manager_state_); |
| 118 test_api.OnEventAckTimeout(client_id); | 120 test_api.OnEventAckTimeout(client_id); |
| 119 } | 121 } |
| 120 | 122 |
| 121 void WindowManagerStateTest::SetUp() { | 123 void WindowManagerStateTest::SetUp() { |
| 122 window_event_targeting_helper_.SetTaskRunner(task_runner_); | 124 window_event_targeting_helper_.SetTaskRunner(task_runner_); |
| 123 window_manager_state_ = | 125 window_manager_state_ = window_event_targeting_helper_.display() |
| 124 window_event_targeting_helper_.display()->GetActiveWindowManagerState(); | 126 ->GetActiveWindowManagerDisplayRoot() |
| 127 ->window_manager_state(); |
| 125 window_ = window_event_targeting_helper_.CreatePrimaryTree( | 128 window_ = window_event_targeting_helper_.CreatePrimaryTree( |
| 126 gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 50, 50)); | 129 gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 50, 50)); |
| 127 window_tree_ = window_event_targeting_helper_.last_binding()->tree(); | 130 window_tree_ = window_event_targeting_helper_.last_binding()->tree(); |
| 128 window_tree_client_ = | 131 window_tree_client_ = |
| 129 window_event_targeting_helper_.last_window_tree_client(); | 132 window_event_targeting_helper_.last_window_tree_client(); |
| 130 DCHECK(window_tree_->HasRoot(window_)); | 133 DCHECK(window_tree_->HasRoot(window_)); |
| 131 | 134 |
| 132 WindowTreeTestApi(tree()).set_window_manager_internal(&window_manager_); | 135 WindowTreeTestApi(tree()).set_window_manager_internal(&window_manager_); |
| 133 wm_client()->tracker()->changes()->clear(); | 136 wm_client()->tracker()->changes()->clear(); |
| 134 window_tree_client_->tracker()->changes()->clear(); | 137 window_tree_client_->tracker()->changes()->clear(); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 ChangesToDescription1(*tracker->changes())[0]); | 293 ChangesToDescription1(*tracker->changes())[0]); |
| 291 | 294 |
| 292 OnEventAckTimeout(window()->id().client_id); | 295 OnEventAckTimeout(window()->id().client_id); |
| 293 EXPECT_TRUE(window_manager()->on_accelerator_called()); | 296 EXPECT_TRUE(window_manager()->on_accelerator_called()); |
| 294 EXPECT_EQ(accelerator->id(), window_manager()->on_accelerator_id()); | 297 EXPECT_EQ(accelerator->id(), window_manager()->on_accelerator_id()); |
| 295 } | 298 } |
| 296 | 299 |
| 297 } // namespace test | 300 } // namespace test |
| 298 } // namespace ws | 301 } // namespace ws |
| 299 } // namespace mus | 302 } // namespace mus |
| OLD | NEW |