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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "components/mus/public/cpp/event_matcher.h" | 10 #include "components/mus/public/cpp/event_matcher.h" |
11 #include "components/mus/public/cpp/window.h" | 11 #include "components/mus/public/cpp/window.h" |
12 #include "components/mus/public/interfaces/accelerator_registrar.mojom.h" | 12 #include "components/mus/public/interfaces/accelerator_registrar.mojom.h" |
13 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
14 #include "mojo/shell/public/cpp/application_test_base.h" | 14 #include "mojo/shell/public/cpp/shell_test.h" |
15 | 15 |
16 using mus::mojom::AcceleratorHandler; | 16 using mus::mojom::AcceleratorHandler; |
17 using mus::mojom::AcceleratorHandlerPtr; | 17 using mus::mojom::AcceleratorHandlerPtr; |
18 using mus::mojom::AcceleratorRegistrar; | 18 using mus::mojom::AcceleratorRegistrar; |
19 using mus::mojom::AcceleratorRegistrarPtr; | 19 using mus::mojom::AcceleratorRegistrarPtr; |
20 | 20 |
21 namespace mash { | 21 namespace mash { |
22 namespace wm { | 22 namespace wm { |
23 | 23 |
24 class TestAcceleratorHandler : public AcceleratorHandler { | 24 class TestAcceleratorHandler : public AcceleratorHandler { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 std::set<uint32_t> installed_accelerators_; | 59 std::set<uint32_t> installed_accelerators_; |
60 scoped_ptr<base::RunLoop> run_loop_; | 60 scoped_ptr<base::RunLoop> run_loop_; |
61 mojo::Binding<AcceleratorHandler> binding_; | 61 mojo::Binding<AcceleratorHandler> binding_; |
62 AcceleratorRegistrarPtr registrar_; | 62 AcceleratorRegistrarPtr registrar_; |
63 bool add_accelerator_result_; | 63 bool add_accelerator_result_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(TestAcceleratorHandler); | 65 DISALLOW_COPY_AND_ASSIGN(TestAcceleratorHandler); |
66 }; | 66 }; |
67 | 67 |
68 class AcceleratorRegistrarTest : public mojo::test::ApplicationTestBase { | 68 class AcceleratorRegistrarTest : public mojo::test::ShellTest { |
69 public: | 69 public: |
70 AcceleratorRegistrarTest() {} | 70 AcceleratorRegistrarTest() : mojo::test::ShellTest("exe:mash_unittests") {} |
71 ~AcceleratorRegistrarTest() override {} | 71 ~AcceleratorRegistrarTest() override {} |
72 | 72 |
73 protected: | 73 protected: |
74 void ConnectToRegistrar(AcceleratorRegistrarPtr* registrar) { | 74 void ConnectToRegistrar(AcceleratorRegistrarPtr* registrar) { |
75 connector()->ConnectToInterface("mojo:desktop_wm", registrar); | 75 connector()->ConnectToInterface("mojo:desktop_wm", registrar); |
76 } | 76 } |
77 | 77 |
78 private: | 78 private: |
79 DISALLOW_COPY_AND_ASSIGN(AcceleratorRegistrarTest); | 79 DISALLOW_COPY_AND_ASSIGN(AcceleratorRegistrarTest); |
80 }; | 80 }; |
(...skipping 24 matching lines...) Expand all Loading... |
105 EXPECT_FALSE(handler_first.AttemptToInstallAccelerator( | 105 EXPECT_FALSE(handler_first.AttemptToInstallAccelerator( |
106 3, mus::CreateKeyMatcher(mus::mojom::KeyboardCode::N, | 106 3, mus::CreateKeyMatcher(mus::mojom::KeyboardCode::N, |
107 mus::mojom::kEventFlagShiftDown))); | 107 mus::mojom::kEventFlagShiftDown))); |
108 EXPECT_FALSE(handler_second.AttemptToInstallAccelerator( | 108 EXPECT_FALSE(handler_second.AttemptToInstallAccelerator( |
109 3, mus::CreateKeyMatcher(mus::mojom::KeyboardCode::N, | 109 3, mus::CreateKeyMatcher(mus::mojom::KeyboardCode::N, |
110 mus::mojom::kEventFlagShiftDown))); | 110 mus::mojom::kEventFlagShiftDown))); |
111 } | 111 } |
112 | 112 |
113 } // namespace wm | 113 } // namespace wm |
114 } // namespace mash | 114 } // namespace mash |
OLD | NEW |