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 <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 "mojo/public/cpp/bindings/interface_request.h" | 10 #include "mojo/public/cpp/bindings/interface_request.h" |
11 #include "services/shell/public/cpp/service_context.h" | 11 #include "services/service_manager/public/cpp/service_context.h" |
12 #include "services/shell/public/cpp/service_test.h" | 12 #include "services/service_manager/public/cpp/service_test.h" |
13 #include "services/ui/public/interfaces/ime.mojom.h" | 13 #include "services/ui/public/interfaces/ime.mojom.h" |
14 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
15 | 15 |
16 class TestTextInputClient : public ui::mojom::TextInputClient { | 16 class TestTextInputClient : public ui::mojom::TextInputClient { |
17 public: | 17 public: |
18 explicit TestTextInputClient(ui::mojom::TextInputClientRequest request) | 18 explicit TestTextInputClient(ui::mojom::TextInputClientRequest request) |
19 : binding_(this, std::move(request)) {} | 19 : binding_(this, std::move(request)) {} |
20 | 20 |
21 ui::mojom::CompositionEventPtr WaitUntilCompositionEvent() { | 21 ui::mojom::CompositionEventPtr WaitUntilCompositionEvent() { |
22 run_loop_.reset(new base::RunLoop); | 22 run_loop_.reset(new base::RunLoop); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 input_method->ProcessKeyEvent(ui::Event::Clone(nonchar_event)); | 102 input_method->ProcessKeyEvent(ui::Event::Clone(nonchar_event)); |
103 | 103 |
104 ui::Event* unhandled_event = client.WaitUntilUnhandledEvent(); | 104 ui::Event* unhandled_event = client.WaitUntilUnhandledEvent(); |
105 EXPECT_TRUE(unhandled_event); | 105 EXPECT_TRUE(unhandled_event); |
106 EXPECT_TRUE(unhandled_event->IsKeyEvent()); | 106 EXPECT_TRUE(unhandled_event->IsKeyEvent()); |
107 EXPECT_FALSE(unhandled_event->AsKeyEvent()->is_char()); | 107 EXPECT_FALSE(unhandled_event->AsKeyEvent()->is_char()); |
108 EXPECT_EQ(ui::ET_KEY_PRESSED, unhandled_event->type()); | 108 EXPECT_EQ(ui::ET_KEY_PRESSED, unhandled_event->type()); |
109 EXPECT_EQ(nonchar_event.key_code(), | 109 EXPECT_EQ(nonchar_event.key_code(), |
110 unhandled_event->AsKeyEvent()->key_code()); | 110 unhandled_event->AsKeyEvent()->key_code()); |
111 } | 111 } |
OLD | NEW |