Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1016)

Unified Diff: chrome/browser/chromeos/input_method/mock_input_method_manager.h

Issue 9999018: chrome/browser/chromeos/input_method/ refactoring [part 6 of 6] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/input_method/mock_input_method_manager.h
diff --git a/chrome/browser/chromeos/input_method/mock_input_method_manager.h b/chrome/browser/chromeos/input_method/mock_input_method_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..5c9440d06650ca5a9aa69a572564e8ff6f1ffbfa
--- /dev/null
+++ b/chrome/browser/chromeos/input_method/mock_input_method_manager.h
@@ -0,0 +1,86 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// 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_H_
+#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_
+#pragma once
+
+#include "chrome/browser/chromeos/input_method/input_method_manager.h"
+#include "chrome/browser/chromeos/input_method/input_method_util.h"
+#include "chrome/browser/chromeos/input_method/input_method_whitelist.h"
+#include "chrome/browser/chromeos/input_method/mock_xkeyboard.h"
+
+namespace chromeos {
+namespace input_method {
+
+// The mock implementation of InputMethodManager for testing.
+class MockInputMethodManager : public InputMethodManager {
+ public:
+ MockInputMethodManager();
+ virtual ~MockInputMethodManager();
+
+ // InputMethodManager override:
+ virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE;
+ virtual void AddCandidateWindowObserver(
+ InputMethodManager::CandidateWindowObserver* observer) OVERRIDE;
+ virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE;
+ virtual void RemoveCandidateWindowObserver(
+ InputMethodManager::CandidateWindowObserver* observer) OVERRIDE;
+ virtual void SetState(State new_state) OVERRIDE;
+ virtual InputMethodDescriptors* GetSupportedInputMethods() const OVERRIDE;
+ virtual InputMethodDescriptors* GetActiveInputMethods() const OVERRIDE;
+ virtual size_t GetNumActiveInputMethods() const OVERRIDE;
+ virtual void EnableLayouts(const std::string& language_code,
+ const std::string& initial_layout) OVERRIDE;
+ virtual bool EnableInputMethods(
+ const std::vector<std::string>& new_active_input_method_ids) OVERRIDE;
+ virtual bool SetInputMethodConfig(
+ const std::string& section,
+ const std::string& config_name,
+ const InputMethodConfigValue& value) OVERRIDE;
+ virtual void ChangeInputMethod(const std::string& input_method_id) OVERRIDE;
+ virtual void ActivateInputMethodProperty(const std::string& key) OVERRIDE;
+ virtual void AddInputMethodExtension(
+ const std::string& id,
+ const std::string& name,
+ const std::vector<std::string>& layouts,
+ const std::string& language) OVERRIDE;
+ virtual void RemoveInputMethodExtension(const std::string& id) OVERRIDE;
+ virtual void EnableHotkeys() OVERRIDE;
+ virtual void DisableHotkeys() OVERRIDE;
+ virtual bool SwitchToNextInputMethod() OVERRIDE;
+ virtual bool SwitchToPreviousInputMethod() OVERRIDE;
+ virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) OVERRIDE;
+ virtual InputMethodDescriptor GetCurrentInputMethod() const OVERRIDE;
+ virtual InputMethodPropertyList
+ GetCurrentInputMethodProperties() const OVERRIDE;
+ virtual XKeyboard* GetXKeyboard() OVERRIDE;
+ virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE;
+
+ // Sets an input method ID which will be returned by GetCurrentInputMethod().
+ void SetCurrentInputMethodId(const std::string& input_method_id) {
+ current_input_method_id_ = input_method_id;
+ }
+
+ // TODO(yusukes): Add more variables for counting the numbers of the API calls
+ int add_observer_count_;
+ int remove_observer_count_;
+ int set_state_count_;
+ State last_state_;
+
+ private:
+ // The value GetCurrentInputMethod().id() will return.
+ std::string current_input_method_id_;
+
+ InputMethodWhitelist whitelist_;
+ InputMethodUtil util_;
+ MockXKeyboard xkeyboard_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockInputMethodManager);
+};
+
+} // namespace input_method
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698