| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 private: | 32 private: |
| 33 void SetCompositionText(const ui::CompositionText& composition) override {} | 33 void SetCompositionText(const ui::CompositionText& composition) override {} |
| 34 void ConfirmCompositionText() override {} | 34 void ConfirmCompositionText() override {} |
| 35 void ClearCompositionText() override {} | 35 void ClearCompositionText() override {} |
| 36 void InsertText(const std::string& text) override {} | 36 void InsertText(const std::string& text) override {} |
| 37 void InsertChar(std::unique_ptr<ui::Event> event) override { | 37 void InsertChar(std::unique_ptr<ui::Event> event) override { |
| 38 receieved_event_ = std::move(event); | 38 receieved_event_ = std::move(event); |
| 39 if (run_loop_) | 39 if (run_loop_) |
| 40 run_loop_->Quit(); | 40 run_loop_->Quit(); |
| 41 } | 41 } |
| 42 void DispatchKeyEventPostIME( |
| 43 std::unique_ptr<ui::Event> event, |
| 44 const DispatchKeyEventPostIMECallback& callback) override { |
| 45 callback.Run(false); |
| 46 } |
| 42 | 47 |
| 43 mojo::Binding<ui::mojom::TextInputClient> binding_; | 48 mojo::Binding<ui::mojom::TextInputClient> binding_; |
| 44 std::unique_ptr<base::RunLoop> run_loop_; | 49 std::unique_ptr<base::RunLoop> run_loop_; |
| 45 std::unique_ptr<ui::Event> receieved_event_; | 50 std::unique_ptr<ui::Event> receieved_event_; |
| 46 | 51 |
| 47 DISALLOW_COPY_AND_ASSIGN(TestTextInputClient); | 52 DISALLOW_COPY_AND_ASSIGN(TestTextInputClient); |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 class IMEAppTest : public service_manager::test::ServiceTest { | 55 class IMEAppTest : public service_manager::test::ServiceTest { |
| 51 public: | 56 public: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 113 |
| 109 ui::KeyEvent* received_key_event = received_event->AsKeyEvent(); | 114 ui::KeyEvent* received_key_event = received_event->AsKeyEvent(); |
| 110 EXPECT_EQ(ui::ET_KEY_PRESSED, received_key_event->type()); | 115 EXPECT_EQ(ui::ET_KEY_PRESSED, received_key_event->type()); |
| 111 EXPECT_TRUE(received_key_event->is_char()); | 116 EXPECT_TRUE(received_key_event->is_char()); |
| 112 EXPECT_EQ(char_event.GetCharacter(), received_key_event->GetCharacter()); | 117 EXPECT_EQ(char_event.GetCharacter(), received_key_event->GetCharacter()); |
| 113 | 118 |
| 114 // Send non-character key event. | 119 // Send non-character key event. |
| 115 ui::KeyEvent nonchar_event(ui::ET_KEY_PRESSED, ui::VKEY_LEFT, 0); | 120 ui::KeyEvent nonchar_event(ui::ET_KEY_PRESSED, ui::VKEY_LEFT, 0); |
| 116 EXPECT_FALSE(ProcessKeyEvent(&input_method, ui::Event::Clone(nonchar_event))); | 121 EXPECT_FALSE(ProcessKeyEvent(&input_method, ui::Event::Clone(nonchar_event))); |
| 117 } | 122 } |
| OLD | NEW |