Chromium Code Reviews| Index: chrome/browser/chromeos/input_method/mock_input_method_manager_impl.h |
| diff --git a/chrome/browser/chromeos/input_method/mock_input_method_manager_impl.h b/chrome/browser/chromeos/input_method/mock_input_method_manager_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..34df79c877b1efe0c767440e9a922234deba1380 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/input_method/mock_input_method_manager_impl.h |
| @@ -0,0 +1,96 @@ |
| +// 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.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_IMPL_H_ |
| +#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_IMPL_H_ |
| + |
| +#include <stddef.h> |
| + |
| +#include "base/macros.h" |
| +#include "ui/base/ime/chromeos/component_extension_ime_manager.h" |
| +#include "ui/base/ime/chromeos/fake_ime_keyboard.h" |
| +#include "ui/base/ime/chromeos/fake_input_method_delegate.h" |
| +#include "ui/base/ime/chromeos/input_method_manager.h" |
| +#include "ui/base/ime/chromeos/input_method_whitelist.h" |
| +#include "ui/base/ime/chromeos/mock_input_method_manager.h" |
| + |
| +namespace chromeos { |
| +namespace input_method { |
| + |
| +// The mock implementation of InputMethodManager for testing. |
| +class MockInputMethodManagerImpl : public MockInputMethodManager { |
| + public: |
| + class State : public MockInputMethodManager::State { |
| + public: |
| + explicit State(MockInputMethodManagerImpl* manager); |
| + |
| + 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.
|
| + std::unique_ptr<InputMethodDescriptors> GetActiveInputMethods() |
| + const override; |
| + const std::vector<std::string>& GetActiveInputMethodIds() const override; |
| + const InputMethodDescriptor* GetInputMethodFromId( |
| + const std::string& input_method_id) const override; |
| + size_t GetNumActiveInputMethods() const override; |
| + InputMethodDescriptor GetCurrentInputMethod() const override; |
| + |
| + // The value GetCurrentInputMethod().id() will return. |
| + std::string current_input_method_id; |
| + |
| + protected: |
| + friend base::RefCounted<InputMethodManager::State>; |
| + ~State() override; |
| + |
| + 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.
|
| + }; |
| + |
| + MockInputMethodManagerImpl(); |
| + ~MockInputMethodManagerImpl() override; |
| + |
| + // MockInputMethodManager: |
| + void AddObserver(InputMethodManager::Observer* observer) override; |
| + void RemoveObserver(InputMethodManager::Observer* observer) override; |
| + std::unique_ptr<InputMethodDescriptors> GetSupportedInputMethods() |
| + const override; |
| + bool IsISOLevel5ShiftUsedByCurrentInputMethod() const override; |
| + ImeKeyboard* GetImeKeyboard() override; |
| + InputMethodUtil* GetInputMethodUtil() override; |
| + ComponentExtensionIMEManager* GetComponentExtensionIMEManager() override; |
| + scoped_refptr<InputMethodManager::State> CreateNewState( |
| + Profile* profile) override; |
| + scoped_refptr<InputMethodManager::State> GetActiveIMEState() override; |
| + void SetState(scoped_refptr<InputMethodManager::State> state) override; |
| + |
| + // Sets an input method ID which will be returned by GetCurrentInputMethod(). |
| + void SetCurrentInputMethodId(const std::string& input_method_id); |
| + |
| + void SetComponentExtensionIMEManager( |
| + std::unique_ptr<ComponentExtensionIMEManager> comp_ime_manager); |
| + |
| + // Set values that will be provided to the InputMethodUtil. |
| + void set_application_locale(const std::string& value); |
| + |
| + // Set the value returned by IsISOLevel5ShiftUsedByCurrentInputMethod |
| + void set_mod3_used(bool value) { mod3_used_ = value; } |
| + |
| + // TODO(yusukes): Add more variables for counting the numbers of the API calls |
| + 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.
|
| + int remove_observer_count_; |
| + |
| + protected: |
| + scoped_refptr<State> state_; |
| + |
| + private: |
| + FakeInputMethodDelegate delegate_; // used by util_ |
| + std::unique_ptr<InputMethodUtil> util_; |
| + FakeImeKeyboard keyboard_; |
| + bool mod3_used_; |
| + std::unique_ptr<ComponentExtensionIMEManager> comp_ime_manager_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MockInputMethodManagerImpl); |
| +}; |
| + |
| +} // namespace input_method |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_IMPL_H_ |