Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
|
sky
2017/01/03 16:29:47
no (c)
Azure Wei
2017/01/04 09:13:27
Done.
| |
| 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_IMPL_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_IMPL_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" | |
| 12 #include "ui/base/ime/chromeos/fake_ime_keyboard.h" | |
| 13 #include "ui/base/ime/chromeos/fake_input_method_delegate.h" | |
| 14 #include "ui/base/ime/chromeos/input_method_manager.h" | |
| 15 #include "ui/base/ime/chromeos/input_method_whitelist.h" | |
| 16 #include "ui/base/ime/chromeos/mock_input_method_manager.h" | |
| 17 | |
| 18 namespace chromeos { | |
| 19 namespace input_method { | |
| 20 | |
| 21 // The mock implementation of InputMethodManager for testing. | |
| 22 class MockInputMethodManagerImpl : public MockInputMethodManager { | |
| 23 public: | |
| 24 class State : public MockInputMethodManager::State { | |
| 25 public: | |
| 26 explicit State(MockInputMethodManagerImpl* manager); | |
| 27 | |
| 28 scoped_refptr<InputMethodManager::State> Clone() const override; | |
|
sky
2017/01/03 16:29:46
Prefix overrides with where they are overriden fro
Azure Wei
2017/01/04 09:13:27
Done.
| |
| 29 std::unique_ptr<InputMethodDescriptors> GetActiveInputMethods() | |
| 30 const override; | |
| 31 const std::vector<std::string>& GetActiveInputMethodIds() const override; | |
| 32 const InputMethodDescriptor* GetInputMethodFromId( | |
| 33 const std::string& input_method_id) const override; | |
| 34 size_t GetNumActiveInputMethods() const override; | |
| 35 InputMethodDescriptor GetCurrentInputMethod() const override; | |
| 36 | |
| 37 // The value GetCurrentInputMethod().id() will return. | |
| 38 std::string current_input_method_id; | |
| 39 | |
| 40 protected: | |
| 41 friend base::RefCounted<InputMethodManager::State>; | |
| 42 ~State() override; | |
| 43 | |
| 44 MockInputMethodManager* const manager_; | |
|
sky
2017/01/03 16:29:47
Style guide says no protected members.
Azure Wei
2017/01/04 09:13:27
Made it private.
| |
| 45 }; | |
| 46 | |
| 47 MockInputMethodManagerImpl(); | |
| 48 ~MockInputMethodManagerImpl() override; | |
| 49 | |
| 50 // MockInputMethodManager: | |
| 51 void AddObserver(InputMethodManager::Observer* observer) override; | |
| 52 void RemoveObserver(InputMethodManager::Observer* observer) override; | |
| 53 std::unique_ptr<InputMethodDescriptors> GetSupportedInputMethods() | |
| 54 const override; | |
| 55 bool IsISOLevel5ShiftUsedByCurrentInputMethod() const override; | |
| 56 ImeKeyboard* GetImeKeyboard() override; | |
| 57 InputMethodUtil* GetInputMethodUtil() override; | |
| 58 ComponentExtensionIMEManager* GetComponentExtensionIMEManager() override; | |
| 59 scoped_refptr<InputMethodManager::State> CreateNewState( | |
| 60 Profile* profile) override; | |
| 61 scoped_refptr<InputMethodManager::State> GetActiveIMEState() override; | |
| 62 void SetState(scoped_refptr<InputMethodManager::State> state) override; | |
| 63 | |
| 64 // Sets an input method ID which will be returned by GetCurrentInputMethod(). | |
| 65 void SetCurrentInputMethodId(const std::string& input_method_id); | |
| 66 | |
| 67 void SetComponentExtensionIMEManager( | |
| 68 std::unique_ptr<ComponentExtensionIMEManager> comp_ime_manager); | |
| 69 | |
| 70 // Set values that will be provided to the InputMethodUtil. | |
| 71 void set_application_locale(const std::string& value); | |
| 72 | |
| 73 // Set the value returned by IsISOLevel5ShiftUsedByCurrentInputMethod | |
| 74 void set_mod3_used(bool value) { mod3_used_ = value; } | |
| 75 | |
| 76 // TODO(yusukes): Add more variables for counting the numbers of the API calls | |
| 77 int add_observer_count_; | |
|
sky
2017/01/03 16:29:47
No public/protected members.
Azure Wei
2017/01/04 09:13:27
Made them private.
| |
| 78 int remove_observer_count_; | |
| 79 | |
| 80 protected: | |
| 81 scoped_refptr<State> state_; | |
| 82 | |
| 83 private: | |
| 84 FakeInputMethodDelegate delegate_; // used by util_ | |
| 85 std::unique_ptr<InputMethodUtil> util_; | |
| 86 FakeImeKeyboard keyboard_; | |
| 87 bool mod3_used_; | |
| 88 std::unique_ptr<ComponentExtensionIMEManager> comp_ime_manager_; | |
| 89 | |
| 90 DISALLOW_COPY_AND_ASSIGN(MockInputMethodManagerImpl); | |
| 91 }; | |
| 92 | |
| 93 } // namespace input_method | |
| 94 } // namespace chromeos | |
| 95 | |
| 96 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_IMPL_H _ | |
| OLD | NEW |