Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / chromeos / input_method / mock_input_method_manager.h
blob7673045fdcf46d44e7cea180a39477206d7fd65e
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_util.h"
9 #include "ui/base/ime/chromeos/component_extension_ime_manager.h"
10 #include "ui/base/ime/chromeos/fake_ime_keyboard.h"
11 #include "ui/base/ime/chromeos/fake_input_method_delegate.h"
12 #include "ui/base/ime/chromeos/input_method_manager.h"
13 #include "ui/base/ime/chromeos/input_method_whitelist.h"
15 namespace chromeos {
16 namespace input_method {
18 // The mock implementation of InputMethodManager for testing.
19 class MockInputMethodManager : public InputMethodManager {
20 public:
21 class State : public InputMethodManager::State {
22 public:
23 explicit State(MockInputMethodManager* manager);
25 scoped_refptr<InputMethodManager::State> Clone() const override;
26 void AddInputMethodExtension(const std::string& extension_id,
27 const InputMethodDescriptors& descriptors,
28 InputMethodEngineInterface* instance) override;
29 void RemoveInputMethodExtension(const std::string& extension_id) override;
30 void ChangeInputMethod(const std::string& input_method_id,
31 bool show_message) override;
32 bool EnableInputMethod(
33 const std::string& new_active_input_method_id) override;
34 void EnableLoginLayouts(
35 const std::string& language_code,
36 const std::vector<std::string>& initial_layouts) override;
37 void EnableLockScreenLayouts() override;
38 void GetInputMethodExtensions(InputMethodDescriptors* result) override;
39 scoped_ptr<InputMethodDescriptors> GetActiveInputMethods() const override;
40 const std::vector<std::string>& GetActiveInputMethodIds() const override;
41 const InputMethodDescriptor* GetInputMethodFromId(
42 const std::string& input_method_id) const override;
43 size_t GetNumActiveInputMethods() const override;
44 void SetEnabledExtensionImes(std::vector<std::string>* ids) override;
45 void SetInputMethodLoginDefault() override;
46 void SetInputMethodLoginDefaultFromVPD(const std::string& locale,
47 const std::string& layout) override;
48 bool CanCycleInputMethod() override;
49 void SwitchToNextInputMethod() override;
50 void SwitchToPreviousInputMethod() override;
51 bool CanSwitchInputMethod(const ui::Accelerator& accelerator) override;
52 void SwitchInputMethod(const ui::Accelerator& accelerator) override;
53 InputMethodDescriptor GetCurrentInputMethod() const override;
54 bool ReplaceEnabledInputMethods(
55 const std::vector<std::string>& new_active_input_method_ids) override;
57 // The value GetCurrentInputMethod().id() will return.
58 std::string current_input_method_id;
60 // The active input method ids cache (actually default only)
61 std::vector<std::string> active_input_method_ids;
63 protected:
64 friend base::RefCounted<chromeos::input_method::InputMethodManager::State>;
65 ~State() override;
67 MockInputMethodManager* const manager_;
70 MockInputMethodManager();
71 ~MockInputMethodManager() override;
73 // InputMethodManager override:
74 UISessionState GetUISessionState() override;
75 void AddObserver(InputMethodManager::Observer* observer) override;
76 void AddCandidateWindowObserver(
77 InputMethodManager::CandidateWindowObserver* observer) override;
78 void RemoveObserver(InputMethodManager::Observer* observer) override;
79 void RemoveCandidateWindowObserver(
80 InputMethodManager::CandidateWindowObserver* observer) override;
81 scoped_ptr<InputMethodDescriptors> GetSupportedInputMethods() const override;
82 void ActivateInputMethodMenuItem(const std::string& key) override;
83 bool IsISOLevel5ShiftUsedByCurrentInputMethod() const override;
84 bool IsAltGrUsedByCurrentInputMethod() const override;
85 ImeKeyboard* GetImeKeyboard() override;
86 InputMethodUtil* GetInputMethodUtil() override;
87 ComponentExtensionIMEManager* GetComponentExtensionIMEManager() override;
88 bool IsLoginKeyboard(const std::string& layout) const override;
89 bool MigrateInputMethods(std::vector<std::string>* input_method_ids) override;
90 scoped_refptr<InputMethodManager::State> CreateNewState(
91 Profile* profile) override;
92 scoped_refptr<InputMethodManager::State> GetActiveIMEState() override;
93 void SetState(scoped_refptr<InputMethodManager::State> state) override;
95 // Sets an input method ID which will be returned by GetCurrentInputMethod().
96 void SetCurrentInputMethodId(const std::string& input_method_id);
98 void SetComponentExtensionIMEManager(
99 scoped_ptr<ComponentExtensionIMEManager> comp_ime_manager);
101 // Set values that will be provided to the InputMethodUtil.
102 void set_application_locale(const std::string& value);
104 // Set the value returned by IsISOLevel5ShiftUsedByCurrentInputMethod
105 void set_mod3_used(bool value) { mod3_used_ = value; }
107 // TODO(yusukes): Add more variables for counting the numbers of the API calls
108 int add_observer_count_;
109 int remove_observer_count_;
111 protected:
112 scoped_refptr<State> state_;
114 private:
115 FakeInputMethodDelegate delegate_; // used by util_
116 InputMethodUtil util_;
117 FakeImeKeyboard keyboard_;
118 bool mod3_used_;
119 scoped_ptr<ComponentExtensionIMEManager> comp_ime_manager_;
121 DISALLOW_COPY_AND_ASSIGN(MockInputMethodManager);
124 } // namespace input_method
125 } // namespace chromeos
127 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_