| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 DISALLOW_COPY_AND_ASSIGN(AcceleratorRegistrarTest); | 81 DISALLOW_COPY_AND_ASSIGN(AcceleratorRegistrarTest); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 TEST_F(AcceleratorRegistrarTest, AcceleratorRegistrarBasic) { | 84 TEST_F(AcceleratorRegistrarTest, AcceleratorRegistrarBasic) { |
| 85 AcceleratorRegistrarPtr registrar_first; | 85 AcceleratorRegistrarPtr registrar_first; |
| 86 ConnectToRegistrar(®istrar_first); | 86 ConnectToRegistrar(®istrar_first); |
| 87 TestAcceleratorHandler handler_first(std::move(registrar_first)); | 87 TestAcceleratorHandler handler_first(std::move(registrar_first)); |
| 88 EXPECT_TRUE(handler_first.AttemptToInstallAccelerator( | 88 EXPECT_TRUE(handler_first.AttemptToInstallAccelerator( |
| 89 1, ::mus::CreateKeyMatcher(::mus::mojom::KeyboardCode::T, | 89 1, ::mus::CreateKeyMatcher(ui::mojom::KeyboardCode::T, |
| 90 ::mus::mojom::kEventFlagShiftDown))); | 90 ui::mojom::kEventFlagShiftDown))); |
| 91 // Attempting to add an accelerator with the same accelerator id from the same | 91 // Attempting to add an accelerator with the same accelerator id from the same |
| 92 // registrar should fail. | 92 // registrar should fail. |
| 93 EXPECT_FALSE(handler_first.AttemptToInstallAccelerator( | 93 EXPECT_FALSE(handler_first.AttemptToInstallAccelerator( |
| 94 1, ::mus::CreateKeyMatcher(::mus::mojom::KeyboardCode::N, | 94 1, ::mus::CreateKeyMatcher(ui::mojom::KeyboardCode::N, |
| 95 ::mus::mojom::kEventFlagShiftDown))); | 95 ui::mojom::kEventFlagShiftDown))); |
| 96 | 96 |
| 97 // Attempting to add an accelerator with the same id from a different | 97 // Attempting to add an accelerator with the same id from a different |
| 98 // registrar should be OK. | 98 // registrar should be OK. |
| 99 AcceleratorRegistrarPtr registrar_second; | 99 AcceleratorRegistrarPtr registrar_second; |
| 100 ConnectToRegistrar(®istrar_second); | 100 ConnectToRegistrar(®istrar_second); |
| 101 TestAcceleratorHandler handler_second(std::move(registrar_second)); | 101 TestAcceleratorHandler handler_second(std::move(registrar_second)); |
| 102 EXPECT_TRUE(handler_second.AttemptToInstallAccelerator( | 102 EXPECT_TRUE(handler_second.AttemptToInstallAccelerator( |
| 103 1, ::mus::CreateKeyMatcher(::mus::mojom::KeyboardCode::N, | 103 1, ::mus::CreateKeyMatcher(ui::mojom::KeyboardCode::N, |
| 104 ::mus::mojom::kEventFlagShiftDown))); | 104 ui::mojom::kEventFlagShiftDown))); |
| 105 | 105 |
| 106 // But attempting to add an accelerator with the same matcher should fail. | 106 // But attempting to add an accelerator with the same matcher should fail. |
| 107 EXPECT_FALSE(handler_first.AttemptToInstallAccelerator( | 107 EXPECT_FALSE(handler_first.AttemptToInstallAccelerator( |
| 108 3, ::mus::CreateKeyMatcher(::mus::mojom::KeyboardCode::N, | 108 3, ::mus::CreateKeyMatcher(ui::mojom::KeyboardCode::N, |
| 109 ::mus::mojom::kEventFlagShiftDown))); | 109 ui::mojom::kEventFlagShiftDown))); |
| 110 EXPECT_FALSE(handler_second.AttemptToInstallAccelerator( | 110 EXPECT_FALSE(handler_second.AttemptToInstallAccelerator( |
| 111 3, ::mus::CreateKeyMatcher(::mus::mojom::KeyboardCode::N, | 111 3, ::mus::CreateKeyMatcher(ui::mojom::KeyboardCode::N, |
| 112 ::mus::mojom::kEventFlagShiftDown))); | 112 ui::mojom::kEventFlagShiftDown))); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace mus | 115 } // namespace mus |
| 116 } // namespace ash | 116 } // namespace ash |
| OLD | NEW |