| 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" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 ServerWindow* window_; | 76 ServerWindow* window_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(WindowManagerStateTest); | 78 DISALLOW_COPY_AND_ASSIGN(WindowManagerStateTest); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 WindowManagerStateTest::WindowManagerStateTest() | 81 WindowManagerStateTest::WindowManagerStateTest() |
| 82 : task_runner_(new base::TestSimpleTaskRunner), window_(nullptr) {} | 82 : task_runner_(new base::TestSimpleTaskRunner), window_(nullptr) {} |
| 83 | 83 |
| 84 std::unique_ptr<Accelerator> WindowManagerStateTest::CreateAccelerator() { | 84 std::unique_ptr<Accelerator> WindowManagerStateTest::CreateAccelerator() { |
| 85 mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher( | 85 mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher( |
| 86 mus::mojom::KeyboardCode::W, mus::mojom::kEventFlagControlDown); | 86 ui::mojom::KeyboardCode::W, ui::mojom::kEventFlagControlDown); |
| 87 matcher->accelerator_phase = mojom::AcceleratorPhase::POST_TARGET; | 87 matcher->accelerator_phase = ui::mojom::AcceleratorPhase::POST_TARGET; |
| 88 uint32_t accelerator_id = 1; | 88 uint32_t accelerator_id = 1; |
| 89 std::unique_ptr<Accelerator> accelerator( | 89 std::unique_ptr<Accelerator> accelerator( |
| 90 new Accelerator(accelerator_id, *matcher)); | 90 new Accelerator(accelerator_id, *matcher)); |
| 91 return accelerator; | 91 return accelerator; |
| 92 } | 92 } |
| 93 | 93 |
| 94 void WindowManagerStateTest::CreateSecondaryTree( | 94 void WindowManagerStateTest::CreateSecondaryTree( |
| 95 TestWindowTreeClient** test_client, | 95 TestWindowTreeClient** test_client, |
| 96 WindowTree** window_tree, | 96 WindowTree** window_tree, |
| 97 ServerWindow** server_window) { | 97 ServerWindow** server_window) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 ServerWindow* target = window(); | 210 ServerWindow* target = window(); |
| 211 DispatchInputEventToWindow(target, true, key, accelerator.get()); | 211 DispatchInputEventToWindow(target, true, key, accelerator.get()); |
| 212 TestChangeTracker* tracker = wm_client()->tracker(); | 212 TestChangeTracker* tracker = wm_client()->tracker(); |
| 213 EXPECT_EQ(1u, tracker->changes()->size()); | 213 EXPECT_EQ(1u, tracker->changes()->size()); |
| 214 EXPECT_EQ("InputEvent window=1,1 event_action=7", | 214 EXPECT_EQ("InputEvent window=1,1 event_action=7", |
| 215 ChangesToDescription1(*tracker->changes())[0]); | 215 ChangesToDescription1(*tracker->changes())[0]); |
| 216 | 216 |
| 217 tracker->changes()->clear(); | 217 tracker->changes()->clear(); |
| 218 ui::KeyEvent key2(ui::ET_KEY_PRESSED, ui::VKEY_Y, ui::EF_CONTROL_DOWN); | 218 ui::KeyEvent key2(ui::ET_KEY_PRESSED, ui::VKEY_Y, ui::EF_CONTROL_DOWN); |
| 219 mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher( | 219 mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher( |
| 220 mus::mojom::KeyboardCode::Y, mus::mojom::kEventFlagControlDown); | 220 ui::mojom::KeyboardCode::Y, ui::mojom::kEventFlagControlDown); |
| 221 matcher->accelerator_phase = mojom::AcceleratorPhase::POST_TARGET; | 221 matcher->accelerator_phase = ui::mojom::AcceleratorPhase::POST_TARGET; |
| 222 uint32_t accelerator_id = 2; | 222 uint32_t accelerator_id = 2; |
| 223 std::unique_ptr<Accelerator> accelerator2( | 223 std::unique_ptr<Accelerator> accelerator2( |
| 224 new Accelerator(accelerator_id, *matcher)); | 224 new Accelerator(accelerator_id, *matcher)); |
| 225 DispatchInputEventToWindow(target, true, key2, accelerator2.get()); | 225 DispatchInputEventToWindow(target, true, key2, accelerator2.get()); |
| 226 EXPECT_TRUE(tracker->changes()->empty()); | 226 EXPECT_TRUE(tracker->changes()->empty()); |
| 227 | 227 |
| 228 WindowTree* target_tree = tree(); | 228 WindowTree* target_tree = tree(); |
| 229 WindowTreeTestApi(target_tree).ClearAck(); | 229 WindowTreeTestApi(target_tree).ClearAck(); |
| 230 state->OnEventAck(target_tree, mojom::EventResult::UNHANDLED); | 230 state->OnEventAck(target_tree, mojom::EventResult::UNHANDLED); |
| 231 EXPECT_EQ(1u, tracker->changes()->size()); | 231 EXPECT_EQ(1u, tracker->changes()->size()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 ChangesToDescription1(*tracker->changes())[0]); | 287 ChangesToDescription1(*tracker->changes())[0]); |
| 288 | 288 |
| 289 OnEventAckTimeout(window()->id().client_id); | 289 OnEventAckTimeout(window()->id().client_id); |
| 290 EXPECT_TRUE(window_manager()->on_accelerator_called()); | 290 EXPECT_TRUE(window_manager()->on_accelerator_called()); |
| 291 EXPECT_EQ(accelerator->id(), window_manager()->on_accelerator_id()); | 291 EXPECT_EQ(accelerator->id(), window_manager()->on_accelerator_id()); |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace test | 294 } // namespace test |
| 295 } // namespace ws | 295 } // namespace ws |
| 296 } // namespace mus | 296 } // namespace mus |
| OLD | NEW |