1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromeos/dbus/ibus/ibus_input_context_client.h"
9 #include "base/message_loop.h"
10 #include "chromeos/dbus/ibus/ibus_constants.h"
11 #include "chromeos/dbus/ibus/ibus_text.h"
12 #include "dbus/message.h"
13 #include "dbus/mock_bus.h"
14 #include "dbus/mock_object_proxy.h"
15 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h"
18 using ::testing::Invoke
;
19 using ::testing::Return
;
24 // TODO(nona): Remove after complete libibus removal.
25 using chromeos::IBusText
;
28 const char kObjectPath
[] = "/org/freedesktop/IBus/InputContext_1010";
30 // Following variables are used in callback expectations.
31 const uint32 kCapabilities
= 12345;
32 const int32 kCursorX
= 30;
33 const int32 kCursorY
= 31;
34 const int32 kCursorWidth
= 32;
35 const int32 kCursorHeight
= 33;
36 const uint32 kKeyval
= 34;
37 const uint32 kKeycode
= 35;
38 const uint32 kState
= 36;
39 const int32 kCompositionX
= 37;
40 const int32 kCompositionY
= 38;
41 const int32 kCompositionWidth
= 39;
42 const int32 kCompositionHeight
= 40;
43 const bool kIsKeyHandled
= false;
44 const char kSurroundingText
[] = "Surrounding Text";
45 const uint32 kCursorPos
= 2;
46 const uint32 kAnchorPos
= 7;
47 const char kPropertyKey
[] = "Property Key";
48 const ibus::IBusPropertyState kPropertyState
=
49 ibus::IBUS_PROPERTY_STATE_CHECKED
;
51 class MockInputContextHandler
: public IBusInputContextHandlerInterface
{
53 MOCK_METHOD1(CommitText
, void(const IBusText
& text
));
54 MOCK_METHOD3(ForwardKeyEvent
,
55 void(uint32 keyval
, uint32 keycode
, uint32 state
));
56 MOCK_METHOD0(ShowPreeditText
, void());
57 MOCK_METHOD0(HidePreeditText
, void());
58 MOCK_METHOD3(UpdatePreeditText
,
59 void(const IBusText
& text
, uint32 cursor_pos
, bool visible
));
62 class MockProcessKeyEventHandler
{
64 MOCK_METHOD1(Run
, void(bool is_key_handled
));
67 class MockProcessKeyEventErrorHandler
{
69 MOCK_METHOD0(Run
, void());
72 MATCHER_P(IBusTextEq
, expected_text
, "The expected IBusText does not match") {
73 // TODO(nona): Check attributes.
74 return (arg
.text() == expected_text
->text());
79 class IBusInputContextClientTest
: public testing::Test
{
81 IBusInputContextClientTest()
83 on_set_cursor_location_call_count_(0) {}
85 virtual void SetUp() OVERRIDE
{
87 dbus::Bus::Options options
;
88 options
.bus_type
= dbus::Bus::SYSTEM
;
89 mock_bus_
= new dbus::MockBus(options
);
91 // Create a mock proxy.
92 mock_proxy_
= new dbus::MockObjectProxy(mock_bus_
.get(),
94 dbus::ObjectPath(kObjectPath
));
97 client_
.reset(IBusInputContextClient::Create(
98 REAL_DBUS_CLIENT_IMPLEMENTATION
));
100 // Set an expectation so mock_bus's GetObjectProxy() for the given service
101 // name and the object path will return mock_proxy_. The GetObjectProxy
102 // function is called in Initialized function.
103 EXPECT_CALL(*mock_bus_
, GetObjectProxy(ibus::kServiceName
,
104 dbus::ObjectPath(kObjectPath
)))
105 .WillOnce(Return(mock_proxy_
.get()));
107 // Set expectations so mock_proxy's ConnectToSignal will use
108 // OnConnectToSignal() to run the callback. The ConnectToSignal is called in
109 // Initialize function.
110 EXPECT_CALL(*mock_proxy_
, ConnectToSignal(
111 ibus::input_context::kServiceInterface
,
112 ibus::input_context::kCommitTextSignal
, _
, _
))
114 Invoke(this, &IBusInputContextClientTest::OnConnectToSignal
));
115 EXPECT_CALL(*mock_proxy_
, ConnectToSignal(
116 ibus::input_context::kServiceInterface
,
117 ibus::input_context::kForwardKeyEventSignal
, _
, _
))
119 Invoke(this, &IBusInputContextClientTest::OnConnectToSignal
));
120 EXPECT_CALL(*mock_proxy_
, ConnectToSignal(
121 ibus::input_context::kServiceInterface
,
122 ibus::input_context::kHidePreeditTextSignal
, _
, _
))
124 Invoke(this, &IBusInputContextClientTest::OnConnectToSignal
));
125 EXPECT_CALL(*mock_proxy_
, ConnectToSignal(
126 ibus::input_context::kServiceInterface
,
127 ibus::input_context::kShowPreeditTextSignal
, _
, _
))
129 Invoke(this, &IBusInputContextClientTest::OnConnectToSignal
));
130 EXPECT_CALL(*mock_proxy_
, ConnectToSignal(
131 ibus::input_context::kServiceInterface
,
132 ibus::input_context::kUpdatePreeditTextSignal
, _
, _
))
134 Invoke(this, &IBusInputContextClientTest::OnConnectToSignal
));
136 // Call Initialize to create object proxy and connect signals.
137 client_
->Initialize(mock_bus_
.get(), dbus::ObjectPath(kObjectPath
));
140 virtual void TearDown() OVERRIDE
{
141 EXPECT_TRUE(client_
->IsObjectProxyReady());
142 client_
->ResetObjectProxy();
143 EXPECT_FALSE(client_
->IsObjectProxyReady());
146 // Handles FocusIn method call.
147 void OnFocusIn(dbus::MethodCall
* method_call
,
149 const dbus::ObjectProxy::ResponseCallback
& callback
,
150 const dbus::ObjectProxy::ErrorCallback
& error_callback
) {
151 EXPECT_EQ(ibus::input_context::kServiceInterface
,
152 method_call
->GetInterface());
153 EXPECT_EQ(ibus::input_context::kFocusInMethod
, method_call
->GetMember());
154 dbus::MessageReader
reader(method_call
);
155 EXPECT_FALSE(reader
.HasMoreData());
157 message_loop_
.PostTask(FROM_HERE
, base::Bind(callback
, response_
));
160 // Handles FocusOut method call.
161 void OnFocusOut(dbus::MethodCall
* method_call
,
163 const dbus::ObjectProxy::ResponseCallback
& callback
,
164 const dbus::ObjectProxy::ErrorCallback
& error_callback
) {
165 EXPECT_EQ(ibus::input_context::kServiceInterface
,
166 method_call
->GetInterface());
167 EXPECT_EQ(ibus::input_context::kFocusOutMethod
, method_call
->GetMember());
168 dbus::MessageReader
reader(method_call
);
169 EXPECT_FALSE(reader
.HasMoreData());
171 message_loop_
.PostTask(FROM_HERE
, base::Bind(callback
, response_
));
174 // Handles Reset method call.
175 void OnReset(dbus::MethodCall
* method_call
,
177 const dbus::ObjectProxy::ResponseCallback
& callback
,
178 const dbus::ObjectProxy::ErrorCallback
& error_callback
) {
179 EXPECT_EQ(ibus::input_context::kServiceInterface
,
180 method_call
->GetInterface());
181 EXPECT_EQ(ibus::input_context::kResetMethod
, method_call
->GetMember());
182 dbus::MessageReader
reader(method_call
);
183 EXPECT_FALSE(reader
.HasMoreData());
185 message_loop_
.PostTask(FROM_HERE
, base::Bind(callback
, response_
));
188 // Handles SetCursorLocation method call.
189 void OnSetCursorLocation(const ibus::Rect
& cursor_location
,
190 const ibus::Rect
& composition_head
) {
191 ++on_set_cursor_location_call_count_
;
194 // Handles SetCapabilities method call.
195 void OnSetCapabilities(
196 dbus::MethodCall
* method_call
,
198 const dbus::ObjectProxy::ResponseCallback
& callback
,
199 const dbus::ObjectProxy::ErrorCallback
& error_callback
) {
200 EXPECT_EQ(ibus::input_context::kServiceInterface
,
201 method_call
->GetInterface());
202 EXPECT_EQ(ibus::input_context::kSetCapabilitiesMethod
,
203 method_call
->GetMember());
205 dbus::MessageReader
reader(method_call
);
206 EXPECT_TRUE(reader
.PopUint32(&capabilities
));
207 EXPECT_EQ(kCapabilities
, capabilities
);
208 EXPECT_FALSE(reader
.HasMoreData());
210 message_loop_
.PostTask(FROM_HERE
, base::Bind(callback
, response_
));
213 // Handles ProcessKeyEvent method call.
214 void OnProcessKeyEvent(
215 dbus::MethodCall
* method_call
,
217 const dbus::ObjectProxy::ResponseCallback
& callback
,
218 const dbus::ObjectProxy::ErrorCallback
& error_callback
) {
219 EXPECT_EQ(ibus::input_context::kServiceInterface
,
220 method_call
->GetInterface());
221 EXPECT_EQ(ibus::input_context::kProcessKeyEventMethod
,
222 method_call
->GetMember());
223 uint32 keyval
, keycode
, state
;
224 dbus::MessageReader
reader(method_call
);
225 EXPECT_TRUE(reader
.PopUint32(&keyval
));
226 EXPECT_TRUE(reader
.PopUint32(&keycode
));
227 EXPECT_TRUE(reader
.PopUint32(&state
));
228 EXPECT_FALSE(reader
.HasMoreData());
230 message_loop_
.PostTask(FROM_HERE
, base::Bind(callback
, response_
));
233 void OnProcessKeyEventFail(
234 dbus::MethodCall
* method_call
,
236 const dbus::ObjectProxy::ResponseCallback
& callback
,
237 const dbus::ObjectProxy::ErrorCallback
& error_callback
) {
238 EXPECT_EQ(ibus::input_context::kServiceInterface
,
239 method_call
->GetInterface());
240 EXPECT_EQ(ibus::input_context::kProcessKeyEventMethod
,
241 method_call
->GetMember());
242 uint32 keyval
, keycode
, state
;
243 dbus::MessageReader
reader(method_call
);
244 EXPECT_TRUE(reader
.PopUint32(&keyval
));
245 EXPECT_TRUE(reader
.PopUint32(&keycode
));
246 EXPECT_TRUE(reader
.PopUint32(&state
));
247 EXPECT_FALSE(reader
.HasMoreData());
249 message_loop_
.PostTask(FROM_HERE
, base::Bind(error_callback
,
253 // Handles SetSurroudingText method call.
254 void OnSetSurroundingText(
255 dbus::MethodCall
* method_call
,
257 const dbus::ObjectProxy::ResponseCallback
& callback
,
258 const dbus::ObjectProxy::ErrorCallback
& error_callback
) {
259 EXPECT_EQ(ibus::input_context::kServiceInterface
,
260 method_call
->GetInterface());
261 EXPECT_EQ(ibus::input_context::kSetSurroundingTextMethod
,
262 method_call
->GetMember());
263 dbus::MessageReader
reader(method_call
);
265 uint32 cursor_pos
= 0;
266 uint32 anchor_pos
= 0;
268 EXPECT_TRUE(PopStringFromIBusText(&reader
, &text
));
269 EXPECT_TRUE(reader
.PopUint32(&cursor_pos
));
270 EXPECT_TRUE(reader
.PopUint32(&anchor_pos
));
271 EXPECT_FALSE(reader
.HasMoreData());
273 EXPECT_EQ(kSurroundingText
, text
);
274 EXPECT_EQ(kCursorPos
, cursor_pos
);
275 EXPECT_EQ(kAnchorPos
, anchor_pos
);
277 message_loop_
.PostTask(FROM_HERE
, base::Bind(callback
, response_
));
280 // Handles PropertyActivate method call.
281 void OnPropertyActivate(
282 dbus::MethodCall
* method_call
,
284 const dbus::ObjectProxy::ResponseCallback
& callback
,
285 const dbus::ObjectProxy::ErrorCallback
& error_callback
) {
286 EXPECT_EQ(ibus::input_context::kServiceInterface
,
287 method_call
->GetInterface());
288 EXPECT_EQ(ibus::input_context::kPropertyActivateMethod
,
289 method_call
->GetMember());
290 dbus::MessageReader
reader(method_call
);
294 EXPECT_TRUE(reader
.PopString(&key
));
295 EXPECT_TRUE(reader
.PopUint32(&state
));
296 EXPECT_FALSE(reader
.HasMoreData());
298 EXPECT_EQ(kPropertyKey
, key
);
299 EXPECT_EQ(kPropertyState
, static_cast<ibus::IBusPropertyState
>(state
));
301 message_loop_
.PostTask(FROM_HERE
, base::Bind(callback
, response_
));
305 // The client to be tested.
306 scoped_ptr
<IBusInputContextClient
> client_
;
308 scoped_refptr
<dbus::MockBus
> mock_bus_
;
309 // The mock object proxy.
310 scoped_refptr
<dbus::MockObjectProxy
> mock_proxy_
;
311 // Response returned by mock methods.
312 dbus::Response
* response_
;
313 dbus::ErrorResponse
* error_response_
;
314 // A message loop to emulate asynchronous behavior.
315 MessageLoop message_loop_
;
316 // The map from signal to signal handler.
317 std::map
<std::string
, dbus::ObjectProxy::SignalCallback
> signal_callback_map_
;
318 // Call count of OnSetCursorLocation.
319 int on_set_cursor_location_call_count_
;
322 // Used to implement the mock proxy.
323 void OnConnectToSignal(
324 const std::string
& interface_name
,
325 const std::string
& signal_name
,
326 const dbus::ObjectProxy::SignalCallback
& signal_callback
,
327 const dbus::ObjectProxy::OnConnectedCallback
& on_connected_callback
) {
328 signal_callback_map_
[signal_name
] = signal_callback
;
329 const bool success
= true;
330 message_loop_
.PostTask(FROM_HERE
, base::Bind(on_connected_callback
,
337 TEST_F(IBusInputContextClientTest
, CommitTextHandler
) {
338 const char kSampleText
[] = "Sample Text";
340 ibus_text
.set_text(kSampleText
);
342 // Set handler expectations.
343 MockInputContextHandler mock_handler
;
344 EXPECT_CALL(mock_handler
, CommitText(IBusTextEq(&ibus_text
)));
345 client_
->SetInputContextHandler(&mock_handler
);
346 message_loop_
.RunUntilIdle();
349 dbus::Signal
signal(ibus::input_context::kServiceInterface
,
350 ibus::input_context::kCommitTextSignal
);
351 dbus::MessageWriter
writer(&signal
);
352 AppendIBusText(ibus_text
, &writer
);
354 signal_callback_map_
[ibus::input_context::kCommitTextSignal
].is_null());
355 signal_callback_map_
[ibus::input_context::kCommitTextSignal
].Run(&signal
);
357 // Unset the handler so expect not calling handler.
358 client_
->SetInputContextHandler(NULL
);
359 signal_callback_map_
[ibus::input_context::kCommitTextSignal
].Run(&signal
);
362 TEST_F(IBusInputContextClientTest
, ForwardKeyEventHandlerTest
) {
363 // Set handler expectations.
364 MockInputContextHandler mock_handler
;
365 EXPECT_CALL(mock_handler
, ForwardKeyEvent(kKeyval
, kKeycode
, kState
));
366 client_
->SetInputContextHandler(&mock_handler
);
367 message_loop_
.RunUntilIdle();
370 dbus::Signal
signal(ibus::input_context::kServiceInterface
,
371 ibus::input_context::kForwardKeyEventSignal
);
372 dbus::MessageWriter
writer(&signal
);
373 writer
.AppendUint32(kKeyval
);
374 writer
.AppendUint32(kKeycode
);
375 writer
.AppendUint32(kState
);
377 signal_callback_map_
[ibus::input_context::kForwardKeyEventSignal
]
379 signal_callback_map_
[ibus::input_context::kForwardKeyEventSignal
].Run(
382 // Unset the handler so expect not calling handler.
383 client_
->SetInputContextHandler(NULL
);
384 signal_callback_map_
[ibus::input_context::kForwardKeyEventSignal
].Run(
388 TEST_F(IBusInputContextClientTest
, HidePreeditTextHandlerTest
) {
389 // Set handler expectations.
390 MockInputContextHandler mock_handler
;
391 EXPECT_CALL(mock_handler
, HidePreeditText());
392 client_
->SetInputContextHandler(&mock_handler
);
393 message_loop_
.RunUntilIdle();
396 dbus::Signal
signal(ibus::input_context::kServiceInterface
,
397 ibus::input_context::kHidePreeditTextSignal
);
399 signal_callback_map_
[ibus::input_context::kHidePreeditTextSignal
]
401 signal_callback_map_
[ibus::input_context::kHidePreeditTextSignal
].Run(
404 // Unset the handler so expect not calling handler.
405 client_
->SetInputContextHandler(NULL
);
406 signal_callback_map_
[ibus::input_context::kHidePreeditTextSignal
].Run(
410 TEST_F(IBusInputContextClientTest
, ShowPreeditTextHandlerTest
) {
411 // Set handler expectations.
412 MockInputContextHandler mock_handler
;
413 EXPECT_CALL(mock_handler
, ShowPreeditText());
414 client_
->SetInputContextHandler(&mock_handler
);
415 message_loop_
.RunUntilIdle();
418 dbus::Signal
signal(ibus::input_context::kServiceInterface
,
419 ibus::input_context::kShowPreeditTextSignal
);
421 signal_callback_map_
[ibus::input_context::kShowPreeditTextSignal
]
423 signal_callback_map_
[ibus::input_context::kShowPreeditTextSignal
].Run(
426 // Unset the handler so expect not calling handler.
427 client_
->SetInputContextHandler(NULL
);
428 signal_callback_map_
[ibus::input_context::kShowPreeditTextSignal
].Run(
432 TEST_F(IBusInputContextClientTest
, UpdatePreeditTextHandlerTest
) {
433 const uint32 kCursorPos
= 20;
434 const bool kVisible
= false;
435 const char kSampleText
[] = "Sample Text";
437 ibus_text
.set_text(kSampleText
);
439 // Set handler expectations.
440 MockInputContextHandler mock_handler
;
441 EXPECT_CALL(mock_handler
,
442 UpdatePreeditText(IBusTextEq(&ibus_text
), kCursorPos
, kVisible
));
443 client_
->SetInputContextHandler(&mock_handler
);
444 message_loop_
.RunUntilIdle();
447 dbus::Signal
signal(ibus::input_context::kServiceInterface
,
448 ibus::input_context::kUpdatePreeditTextSignal
);
449 dbus::MessageWriter
writer(&signal
);
450 AppendIBusText(ibus_text
, &writer
);
451 writer
.AppendUint32(kCursorPos
);
452 writer
.AppendBool(kVisible
);
454 signal_callback_map_
[ibus::input_context::kUpdatePreeditTextSignal
]
456 signal_callback_map_
[ibus::input_context::kUpdatePreeditTextSignal
].Run(
459 // Unset the handler so expect not calling handler.
460 client_
->SetInputContextHandler(NULL
);
461 signal_callback_map_
[ibus::input_context::kUpdatePreeditTextSignal
].Run(
465 TEST_F(IBusInputContextClientTest
, FocusInTest
) {
467 EXPECT_CALL(*mock_proxy_
, CallMethodWithErrorCallback(_
, _
, _
, _
))
468 .WillOnce(Invoke(this, &IBusInputContextClientTest::OnFocusIn
));
470 scoped_ptr
<dbus::Response
> response(dbus::Response::CreateEmpty());
471 response_
= response
.get();
475 // Run the message loop.
476 message_loop_
.RunUntilIdle();
479 TEST_F(IBusInputContextClientTest
, FocusOutTest
) {
481 EXPECT_CALL(*mock_proxy_
, CallMethodWithErrorCallback(_
, _
, _
, _
))
482 .WillOnce(Invoke(this, &IBusInputContextClientTest::OnFocusOut
));
484 scoped_ptr
<dbus::Response
> response(dbus::Response::CreateEmpty());
485 response_
= response
.get();
489 // Run the message loop.
490 message_loop_
.RunUntilIdle();
493 TEST_F(IBusInputContextClientTest
, ResetTest
) {
495 EXPECT_CALL(*mock_proxy_
, CallMethodWithErrorCallback(_
, _
, _
, _
))
496 .WillOnce(Invoke(this, &IBusInputContextClientTest::OnReset
));
498 scoped_ptr
<dbus::Response
> response(dbus::Response::CreateEmpty());
499 response_
= response
.get();
503 // Run the message loop.
504 message_loop_
.RunUntilIdle();
507 TEST_F(IBusInputContextClientTest
, SetCapabilitiesTest
) {
509 EXPECT_CALL(*mock_proxy_
, CallMethodWithErrorCallback(_
, _
, _
, _
))
510 .WillOnce(Invoke(this, &IBusInputContextClientTest::OnSetCapabilities
));
512 scoped_ptr
<dbus::Response
> response(dbus::Response::CreateEmpty());
513 response_
= response
.get();
515 // Call SetCapabilities.
516 client_
->SetCapabilities(kCapabilities
);
517 // Run the message loop.
518 message_loop_
.RunUntilIdle();
521 TEST_F(IBusInputContextClientTest
, SetCursorLocationTest
) {
522 on_set_cursor_location_call_count_
= 0;
523 client_
->SetSetCursorLocationHandler(
524 base::Bind(&IBusInputContextClientTest::OnSetCursorLocation
,
525 base::Unretained(this)));
526 const ibus::Rect
cursor_location(kCursorX
,
530 const ibus::Rect
composition_location(kCompositionX
,
534 // Call SetCursorLocation.
535 client_
->SetCursorLocation(cursor_location
, composition_location
);
537 EXPECT_EQ(1, on_set_cursor_location_call_count_
);
538 client_
->UnsetSetCursorLocationHandler();
541 TEST_F(IBusInputContextClientTest
, OnProcessKeyEvent
) {
543 EXPECT_CALL(*mock_proxy_
, CallMethodWithErrorCallback(_
, _
, _
, _
))
544 .WillOnce(Invoke(this, &IBusInputContextClientTest::OnProcessKeyEvent
));
545 MockProcessKeyEventHandler callback
;
546 MockProcessKeyEventErrorHandler error_callback
;
548 EXPECT_CALL(callback
, Run(kIsKeyHandled
));
549 EXPECT_CALL(error_callback
, Run()).Times(0);
551 scoped_ptr
<dbus::Response
> response(dbus::Response::CreateEmpty());
552 dbus::MessageWriter
writer(response
.get());
553 writer
.AppendBool(kIsKeyHandled
);
554 response_
= response
.get();
556 // Call ProcessKeyEvent.
557 client_
->ProcessKeyEvent(kKeyval
,
560 base::Bind(&MockProcessKeyEventHandler::Run
,
561 base::Unretained(&callback
)),
562 base::Bind(&MockProcessKeyEventErrorHandler::Run
,
563 base::Unretained(&error_callback
)));
564 // Run the message loop.
565 message_loop_
.RunUntilIdle();
568 TEST_F(IBusInputContextClientTest
, OnProcessKeyEventFail
) {
570 EXPECT_CALL(*mock_proxy_
, CallMethodWithErrorCallback(_
, _
, _
, _
))
571 .WillOnce(Invoke(this,
572 &IBusInputContextClientTest::OnProcessKeyEventFail
));
573 MockProcessKeyEventHandler callback
;
574 MockProcessKeyEventErrorHandler error_callback
;
576 EXPECT_CALL(callback
, Run(_
)).Times(0);
577 EXPECT_CALL(error_callback
, Run());
579 scoped_ptr
<dbus::Response
> response(dbus::Response::CreateEmpty());
580 dbus::MessageWriter
writer(response
.get());
581 writer
.AppendBool(kIsKeyHandled
);
582 response_
= response
.get();
584 // Call ProcessKeyEvent.
585 client_
->ProcessKeyEvent(kKeyval
,
588 base::Bind(&MockProcessKeyEventHandler::Run
,
589 base::Unretained(&callback
)),
590 base::Bind(&MockProcessKeyEventErrorHandler::Run
,
591 base::Unretained(&error_callback
)));
592 // Run the message loop.
593 message_loop_
.RunUntilIdle();
596 TEST_F(IBusInputContextClientTest
, SetSurroundingTextTest
) {
598 EXPECT_CALL(*mock_proxy_
, CallMethodWithErrorCallback(_
, _
, _
, _
))
599 .WillOnce(Invoke(this,
600 &IBusInputContextClientTest::OnSetSurroundingText
));
602 scoped_ptr
<dbus::Response
> response(dbus::Response::CreateEmpty());
603 response_
= response
.get();
605 // Call SetCursorLocation.
606 client_
->SetSurroundingText(kSurroundingText
, kCursorPos
, kAnchorPos
);
607 // Run the message loop.
608 message_loop_
.RunUntilIdle();
611 TEST_F(IBusInputContextClientTest
, PropertyActivateTest
) {
613 EXPECT_CALL(*mock_proxy_
, CallMethodWithErrorCallback(_
, _
, _
, _
))
614 .WillOnce(Invoke(this,
615 &IBusInputContextClientTest::OnPropertyActivate
));
617 scoped_ptr
<dbus::Response
> response(dbus::Response::CreateEmpty());
618 response_
= response
.get();
620 // Call SetCursorLocation.
621 client_
->PropertyActivate(kPropertyKey
, kPropertyState
);
622 // Run the message loop.
623 message_loop_
.RunUntilIdle();
625 } // namespace chromeos