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 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_
8 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
9 #include "chrome/browser/chromeos/input_method/input_method_util.h"
10 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h"
11 #include "chrome/browser/chromeos/input_method/mock_xkeyboard.h"
14 namespace input_method
{
16 // The mock implementation of InputMethodManager for testing.
17 class MockInputMethodManager
: public InputMethodManager
{
19 MockInputMethodManager();
20 virtual ~MockInputMethodManager();
22 // InputMethodManager override:
23 virtual void AddObserver(InputMethodManager::Observer
* observer
) OVERRIDE
;
24 virtual void AddCandidateWindowObserver(
25 InputMethodManager::CandidateWindowObserver
* observer
) OVERRIDE
;
26 virtual void RemoveObserver(InputMethodManager::Observer
* observer
) OVERRIDE
;
27 virtual void RemoveCandidateWindowObserver(
28 InputMethodManager::CandidateWindowObserver
* observer
) OVERRIDE
;
29 virtual void SetState(State new_state
) OVERRIDE
;
30 virtual InputMethodDescriptors
* GetSupportedInputMethods() const OVERRIDE
;
31 virtual InputMethodDescriptors
* GetActiveInputMethods() const OVERRIDE
;
32 virtual size_t GetNumActiveInputMethods() const OVERRIDE
;
33 virtual void EnableLayouts(const std::string
& language_code
,
34 const std::string
& initial_layout
) OVERRIDE
;
35 virtual bool EnableInputMethods(
36 const std::vector
<std::string
>& new_active_input_method_ids
) OVERRIDE
;
37 virtual bool SetInputMethodConfig(
38 const std::string
& section
,
39 const std::string
& config_name
,
40 const InputMethodConfigValue
& value
) OVERRIDE
;
41 virtual void ChangeInputMethod(const std::string
& input_method_id
) OVERRIDE
;
42 virtual void ActivateInputMethodProperty(const std::string
& key
) OVERRIDE
;
43 virtual void AddInputMethodExtension(
44 const std::string
& id
,
45 const std::string
& name
,
46 const std::vector
<std::string
>& layouts
,
47 const std::string
& language
,
48 InputMethodEngine
* instance
) OVERRIDE
;
49 virtual void RemoveInputMethodExtension(const std::string
& id
) OVERRIDE
;
50 virtual void GetInputMethodExtensions(
51 InputMethodDescriptors
* result
) OVERRIDE
;
52 virtual void SetFilteredExtensionImes(std::vector
<std::string
>* ids
) OVERRIDE
;
53 virtual bool SwitchToNextInputMethod() OVERRIDE
;
54 virtual bool SwitchToPreviousInputMethod() OVERRIDE
;
55 virtual bool SwitchInputMethod(const ui::Accelerator
& accelerator
) OVERRIDE
;
56 virtual InputMethodDescriptor
GetCurrentInputMethod() const OVERRIDE
;
57 virtual InputMethodPropertyList
58 GetCurrentInputMethodProperties() const OVERRIDE
;
59 virtual XKeyboard
* GetXKeyboard() OVERRIDE
;
60 virtual InputMethodUtil
* GetInputMethodUtil() OVERRIDE
;
62 // Sets an input method ID which will be returned by GetCurrentInputMethod().
63 void SetCurrentInputMethodId(const std::string
& input_method_id
) {
64 current_input_method_id_
= input_method_id
;
67 // TODO(yusukes): Add more variables for counting the numbers of the API calls
68 int add_observer_count_
;
69 int remove_observer_count_
;
74 // The value GetCurrentInputMethod().id() will return.
75 std::string current_input_method_id_
;
77 InputMethodWhitelist whitelist_
;
78 InputMethodUtil util_
;
79 MockXKeyboard xkeyboard_
;
81 DISALLOW_COPY_AND_ASSIGN(MockInputMethodManager
);
84 } // namespace input_method
85 } // namespace chromeos
87 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_