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