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/mock_ibus_input_context_client.h"
9 MockIBusInputContextClient::MockIBusInputContextClient()
10 : initialize_call_count_(0),
11 is_initialized_(false),
12 is_xkb_layout_(false),
13 reset_object_proxy_call_caount_(0),
14 set_capabilities_call_count_(0),
15 focus_in_call_count_(0),
16 focus_out_call_count_(0),
18 set_cursor_location_call_count_(0),
19 process_key_event_call_count_(0),
20 set_surrounding_text_call_count_(0) {
23 MockIBusInputContextClient::~MockIBusInputContextClient() {}
25 void MockIBusInputContextClient::Initialize(
26 dbus::Bus
* bus
, const dbus::ObjectPath
& object_path
) {
27 initialize_call_count_
++;
28 is_initialized_
= true;
31 void MockIBusInputContextClient::SetInputContextHandler(
32 IBusInputContextHandlerInterface
* handler
) {
35 void MockIBusInputContextClient::SetSetCursorLocationHandler(
36 const SetCursorLocationHandler
& set_cursor_location_handler
) {
39 void MockIBusInputContextClient::UnsetSetCursorLocationHandler() {
42 void MockIBusInputContextClient::ResetObjectProxy() {
43 reset_object_proxy_call_caount_
++;
44 is_initialized_
= false;
47 bool MockIBusInputContextClient::IsObjectProxyReady() const {
54 void MockIBusInputContextClient::SetCapabilities(uint32 capabilities
) {
55 set_capabilities_call_count_
++;
58 void MockIBusInputContextClient::FocusIn() {
59 focus_in_call_count_
++;
62 void MockIBusInputContextClient::FocusOut() {
63 focus_out_call_count_
++;
66 void MockIBusInputContextClient::Reset() {
70 void MockIBusInputContextClient::SetCursorLocation(
71 const ibus::Rect
& cursor_location
,
72 const ibus::Rect
& composition_head
) {
73 set_cursor_location_call_count_
++;
76 void MockIBusInputContextClient::ProcessKeyEvent(
80 const ProcessKeyEventCallback
& callback
,
81 const ErrorCallback
& error_callback
) {
82 process_key_event_call_count_
++;
83 if (!process_key_event_handler_
.is_null()) {
84 process_key_event_handler_
.Run(keyval
, keycode
, state
, callback
,
89 void MockIBusInputContextClient::SetSurroundingText(
90 const std::string
& text
,
93 set_surrounding_text_call_count_
++;
94 set_surrounding_text_handler_
.Run(text
, cursor_pos
, anchor_pos
);
97 void MockIBusInputContextClient::PropertyActivate(
98 const std::string
& key
,
99 ibus::IBusPropertyState state
) {
102 bool MockIBusInputContextClient::IsXKBLayout() {
103 return is_xkb_layout_
;
106 void MockIBusInputContextClient::SetIsXKBLayout(bool is_xkb_layout
) {
107 is_xkb_layout_
= is_xkb_layout
;
110 } // namespace chromeos