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

Side by Side Diff: services/ui/ime/ime_unittest.cc

Issue 2804373002: Eliminate Connector::Connect(), Connection, etc. (Closed)
Patch Set: . Created 3 years, 8 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
« no previous file with comments | « services/ui/ime/ime_server_impl.cc ('k') | services/ui/input_devices/input_device_server.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 class IMEAppTest : public service_manager::test::ServiceTest { 50 class IMEAppTest : public service_manager::test::ServiceTest {
51 public: 51 public:
52 IMEAppTest() : ServiceTest("mus_ime_unittests") {} 52 IMEAppTest() : ServiceTest("mus_ime_unittests") {}
53 ~IMEAppTest() override {} 53 ~IMEAppTest() override {}
54 54
55 // service_manager::test::ServiceTest: 55 // service_manager::test::ServiceTest:
56 void SetUp() override { 56 void SetUp() override {
57 ServiceTest::SetUp(); 57 ServiceTest::SetUp();
58 // test_ime_driver will register itself as the current IMEDriver. 58 // test_ime_driver will register itself as the current IMEDriver.
59 connector()->Connect("test_ime_driver"); 59 connector()->StartService("test_ime_driver");
60 connector()->BindInterface(ui::mojom::kServiceName, &ime_server_); 60 connector()->BindInterface(ui::mojom::kServiceName, &ime_server_);
61 } 61 }
62 62
63 bool ProcessKeyEvent(ui::mojom::InputMethodPtr* input_method, 63 bool ProcessKeyEvent(ui::mojom::InputMethodPtr* input_method,
64 std::unique_ptr<ui::Event> event) { 64 std::unique_ptr<ui::Event> event) {
65 (*input_method) 65 (*input_method)
66 ->ProcessKeyEvent(std::move(event), 66 ->ProcessKeyEvent(std::move(event),
67 base::Bind(&IMEAppTest::ProcessKeyEventCallback, 67 base::Bind(&IMEAppTest::ProcessKeyEventCallback,
68 base::Unretained(this))); 68 base::Unretained(this)));
69 69
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 ui::KeyEvent* received_key_event = received_event->AsKeyEvent(); 109 ui::KeyEvent* received_key_event = received_event->AsKeyEvent();
110 EXPECT_EQ(ui::ET_KEY_PRESSED, received_key_event->type()); 110 EXPECT_EQ(ui::ET_KEY_PRESSED, received_key_event->type());
111 EXPECT_TRUE(received_key_event->is_char()); 111 EXPECT_TRUE(received_key_event->is_char());
112 EXPECT_EQ(char_event.GetCharacter(), received_key_event->GetCharacter()); 112 EXPECT_EQ(char_event.GetCharacter(), received_key_event->GetCharacter());
113 113
114 // Send non-character key event. 114 // Send non-character key event.
115 ui::KeyEvent nonchar_event(ui::ET_KEY_PRESSED, ui::VKEY_LEFT, 0); 115 ui::KeyEvent nonchar_event(ui::ET_KEY_PRESSED, ui::VKEY_LEFT, 0);
116 EXPECT_FALSE(ProcessKeyEvent(&input_method, ui::Event::Clone(nonchar_event))); 116 EXPECT_FALSE(ProcessKeyEvent(&input_method, ui::Event::Clone(nonchar_event)));
117 } 117 }
OLDNEW
« no previous file with comments | « services/ui/ime/ime_server_impl.cc ('k') | services/ui/input_devices/input_device_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698