Home | History | Annotate | Download | only in ibus
      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.
      4 
      5 #include "chromeos/dbus/ibus/mock_ibus_client.h"
      6 
      7 namespace chromeos {
      8 
      9 MockIBusClient::MockIBusClient()
     10     : create_input_context_call_count_(0),
     11       register_component_call_count_(0),
     12       set_global_engine_call_count_(0) {
     13 }
     14 
     15 MockIBusClient::~MockIBusClient() {}
     16 
     17 void MockIBusClient::CreateInputContext(
     18     const std::string& client_name,
     19     const CreateInputContextCallback& callback,
     20     const ErrorCallback& error_callback) {
     21   create_input_context_call_count_++;
     22   if (!create_input_context_handler_.is_null())
     23     create_input_context_handler_.Run(client_name, callback, error_callback);
     24 }
     25 
     26 void MockIBusClient::RegisterComponent(
     27     const IBusComponent& ibus_component,
     28     const RegisterComponentCallback& callback,
     29     const ErrorCallback& error_callback) {
     30   register_component_call_count_++;
     31   if (!register_component_handler_.is_null())
     32     register_component_handler_.Run(ibus_component, callback, error_callback);
     33 }
     34 
     35 void MockIBusClient::SetGlobalEngine(const std::string& engine_name,
     36                                      const ErrorCallback& error_callback) {
     37   ++set_global_engine_call_count_;
     38   latest_global_engine_name_ = engine_name;
     39 }
     40 
     41 void MockIBusClient::Exit(ExitOption option,
     42                           const ErrorCallback& error_callback) {
     43 }
     44 
     45 }  // namespace chromeos
     46