OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROMEOS_DBUS_IBUS_MOCK_IBUS_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_IBUS_MOCK_IBUS_CLIENT_H_ |
6 #define CHROMEOS_DBUS_IBUS_MOCK_IBUS_CLIENT_H_ | 6 #define CHROMEOS_DBUS_IBUS_MOCK_IBUS_CLIENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "chromeos/dbus/ibus/ibus_client.h" | 11 #include "chromeos/dbus/ibus/ibus_client.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 class MockIBusClient : public IBusClient { | 15 class MockIBusClient : public IBusClient { |
16 public: | 16 public: |
17 MockIBusClient(); | 17 MockIBusClient(); |
18 virtual ~MockIBusClient(); | 18 virtual ~MockIBusClient(); |
19 | 19 |
20 typedef base::Callback<void(const std::string& client_name, | 20 typedef base::Callback<void(const std::string& client_name, |
21 const CreateInputContextCallback& callback, | 21 const CreateInputContextCallback& callback, |
22 const ErrorCallback& error_callback)> | 22 const ErrorCallback& error_callback)> |
23 CreateInputContextHandler; | 23 CreateInputContextHandler; |
24 typedef base::Callback<void(const ibus::IBusComponent& ibus_component, | |
25 const RegisterComponentCallback& callback, | |
26 const ErrorCallback& error_callback)> | |
27 RegisterComponentHandler; | |
24 | 28 |
25 virtual void CreateInputContext(const std::string& client_name, | 29 virtual void CreateInputContext(const std::string& client_name, |
satorux1
2012/07/09 16:44:00
Please add:
// IBusClient overrides:
Seigo Nonaka
2012/07/09 16:51:16
Done.
| |
26 const CreateInputContextCallback& callback, | 30 const CreateInputContextCallback& callback, |
27 const ErrorCallback& error_callback) OVERRIDE; | 31 const ErrorCallback& error_callback) OVERRIDE; |
28 | 32 |
33 virtual void RegisterComponent(const ibus::IBusComponent& ibus_component, | |
34 const RegisterComponentCallback& callback, | |
35 const ErrorCallback& error_callback) OVERRIDE; | |
36 | |
29 // Function handler for CreateInputContext. The CreateInputContext function | 37 // Function handler for CreateInputContext. The CreateInputContext function |
30 // invokes |create_input_context_handler_| unless it's not null. | 38 // invokes |create_input_context_handler_| unless it's not null. |
31 void set_create_input_context_handler( | 39 void set_create_input_context_handler( |
32 const CreateInputContextHandler& handler) { | 40 const CreateInputContextHandler& handler) { |
33 create_input_context_handler_ = handler; | 41 create_input_context_handler_ = handler; |
34 } | 42 } |
35 | 43 |
36 // Represents call count of CreateInputContext. | 44 // Function handler for RegisterComponent. The RegisterComponent function |
45 // invokes |register_component_handler_| unless it's not null. | |
46 void set_register_component_handler( | |
47 const RegisterComponentHandler& handler) { | |
48 register_component_handler_ = handler; | |
49 } | |
50 | |
51 // Call count of CreateInputContext(). | |
37 int create_input_context_call_count() const { | 52 int create_input_context_call_count() const { |
38 return create_input_context_call_count_; | 53 return create_input_context_call_count_; |
39 } | 54 } |
40 | 55 |
56 // Call count of RegisterComponent(). | |
57 int register_component_call_count() const { | |
58 return register_component_call_count_; | |
59 } | |
60 | |
41 private: | 61 private: |
42 CreateInputContextHandler create_input_context_handler_; | 62 CreateInputContextHandler create_input_context_handler_; |
63 RegisterComponentHandler register_component_handler_; | |
43 int create_input_context_call_count_; | 64 int create_input_context_call_count_; |
65 int register_component_call_count_; | |
44 | 66 |
45 DISALLOW_COPY_AND_ASSIGN(MockIBusClient); | 67 DISALLOW_COPY_AND_ASSIGN(MockIBusClient); |
46 }; | 68 }; |
47 | 69 |
48 } // namespace chromeos | 70 } // namespace chromeos |
49 | 71 |
50 #endif // CHROMEOS_DBUS_IBUS_MOCK_IBUS_CLIENT_H_ | 72 #endif // CHROMEOS_DBUS_IBUS_MOCK_IBUS_CLIENT_H_ |
OLD | NEW |