Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos_unittest.cc

Issue 2957173004: Make DispatchKeyEventPostIME() asynchronous.
Patch Set: cleanup. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 run_loop_->Quit(); 80 run_loop_->Quit();
81 } 81 }
82 void InsertChar(std::unique_ptr<ui::Event> event) override { 82 void InsertChar(std::unique_ptr<ui::Event> event) override {
83 ASSERT_TRUE(event->IsKeyEvent()); 83 ASSERT_TRUE(event->IsKeyEvent());
84 CompositionEvent ev = {CompositionEventType::INSERT_CHAR, base::string16(), 84 CompositionEvent ev = {CompositionEventType::INSERT_CHAR, base::string16(),
85 event->AsKeyEvent()->GetCharacter()}; 85 event->AsKeyEvent()->GetCharacter()};
86 receieved_event_ = ev; 86 receieved_event_ = ev;
87 if (run_loop_) 87 if (run_loop_)
88 run_loop_->Quit(); 88 run_loop_->Quit();
89 } 89 }
90 void DispatchKeyEventPostIME(
91 std::unique_ptr<ui::Event> event,
92 const DispatchKeyEventPostIMECallback& callback) override {
93 callback.Run(false);
94 }
90 95
91 mojo::Binding<ui::mojom::TextInputClient> binding_; 96 mojo::Binding<ui::mojom::TextInputClient> binding_;
92 std::unique_ptr<base::RunLoop> run_loop_; 97 std::unique_ptr<base::RunLoop> run_loop_;
93 base::Optional<CompositionEvent> receieved_event_; 98 base::Optional<CompositionEvent> receieved_event_;
94 99
95 DISALLOW_COPY_AND_ASSIGN(TestTextInputClient); 100 DISALLOW_COPY_AND_ASSIGN(TestTextInputClient);
96 }; 101 };
97 102
98 class InputMethodBridgeChromeOSTest : public testing::Test { 103 class InputMethodBridgeChromeOSTest : public testing::Test {
99 public: 104 public:
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 201
197 // Test that Ctrl-C, Ctrl-X, and Ctrl-V are not handled. 202 // Test that Ctrl-C, Ctrl-X, and Ctrl-V are not handled.
198 TEST_F(InputMethodBridgeChromeOSTest, ClipboardAccelerators) { 203 TEST_F(InputMethodBridgeChromeOSTest, ClipboardAccelerators) {
199 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_C, ui::DomCode::US_C, 204 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_C, ui::DomCode::US_C,
200 ui::EF_CONTROL_DOWN, 'C'))); 205 ui::EF_CONTROL_DOWN, 'C')));
201 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_X, ui::DomCode::US_X, 206 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_X, ui::DomCode::US_X,
202 ui::EF_CONTROL_DOWN, 'X'))); 207 ui::EF_CONTROL_DOWN, 'X')));
203 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_V, ui::DomCode::US_V, 208 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_V, ui::DomCode::US_V,
204 ui::EF_CONTROL_DOWN, 'V'))); 209 ui::EF_CONTROL_DOWN, 'V')));
205 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698