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

Unified Diff: ui/base/ime/chromeos/mock_input_method_manager.cc

Issue 2605843002: Add MockInputMethodManager under ui/base/ime/chromeos/ (Closed)
Patch Set: Created 3 years, 11 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
« ui/base/BUILD.gn ('K') | « ui/base/ime/chromeos/mock_input_method_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/ime/chromeos/mock_input_method_manager.cc
diff --git a/chrome/browser/chromeos/input_method/mock_input_method_manager.cc b/ui/base/ime/chromeos/mock_input_method_manager.cc
similarity index 51%
rename from chrome/browser/chromeos/input_method/mock_input_method_manager.cc
rename to ui/base/ime/chromeos/mock_input_method_manager.cc
index 7dc9f219169ad80f87be174c127581246fded470..482f603d8fb38ee084f9a076920b5c8e7fdd7e92 100644
--- a/chrome/browser/chromeos/input_method/mock_input_method_manager.cc
+++ b/ui/base/ime/chromeos/mock_input_method_manager.cc
@@ -1,75 +1,22 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
sky 2017/01/04 16:35:52 2017, or don't change. If you do change, remove th
Azure Wei 2017/01/05 15:41:29 Reverted this change.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/input_method/mock_input_method_manager.h"
+#include "ui/base/ime/chromeos/mock_input_method_manager.h"
#include <utility>
namespace chromeos {
namespace input_method {
+MockInputMethodManager::State::State() {}
sky 2017/01/04 16:35:52 I would expect all the State functions to be group
Azure Wei 2017/01/05 15:41:29 Reordered these method definitions.
-MockInputMethodManager::State::State(MockInputMethodManager* manager)
- : manager_(manager) {
- active_input_method_ids.push_back("xkb:us::eng");
-}
-
-MockInputMethodManager::State::~State() {
-}
-
-MockInputMethodManager::MockInputMethodManager()
- : add_observer_count_(0),
- remove_observer_count_(0),
- state_(new State(this)),
- util_(&delegate_),
- mod3_used_(false) {
-}
-
-MockInputMethodManager::~MockInputMethodManager() {
-}
-
-InputMethodManager::UISessionState MockInputMethodManager::GetUISessionState() {
- return InputMethodManager::STATE_BROWSER_SCREEN;
-}
+MockInputMethodManager::MockInputMethodManager() {}
-void MockInputMethodManager::AddObserver(
- InputMethodManager::Observer* observer) {
- ++add_observer_count_;
-}
-
-void MockInputMethodManager::AddCandidateWindowObserver(
- InputMethodManager::CandidateWindowObserver* observer) {
-}
-
-void MockInputMethodManager::AddImeMenuObserver(
- InputMethodManager::ImeMenuObserver* observer) {}
-
-void MockInputMethodManager::RemoveObserver(
- InputMethodManager::Observer* observer) {
- ++remove_observer_count_;
-}
-
-void MockInputMethodManager::RemoveCandidateWindowObserver(
- InputMethodManager::CandidateWindowObserver* observer) {
-}
-
-void MockInputMethodManager::RemoveImeMenuObserver(
- InputMethodManager::ImeMenuObserver* observer) {}
-
-std::unique_ptr<InputMethodDescriptors>
-MockInputMethodManager::GetSupportedInputMethods() const {
- std::unique_ptr<InputMethodDescriptors> result(new InputMethodDescriptors);
- result->push_back(
- InputMethodUtil::GetFallbackInputMethodDescriptor());
- return result;
-}
+MockInputMethodManager::~MockInputMethodManager() {}
std::unique_ptr<InputMethodDescriptors>
MockInputMethodManager::State::GetActiveInputMethods() const {
- std::unique_ptr<InputMethodDescriptors> result(new InputMethodDescriptors);
- result->push_back(
- InputMethodUtil::GetFallbackInputMethodDescriptor());
- return result;
+ return nullptr;
}
const std::vector<std::string>&
@@ -78,29 +25,20 @@ MockInputMethodManager::State::GetActiveInputMethodIds() const {
}
size_t MockInputMethodManager::State::GetNumActiveInputMethods() const {
- return 1;
+ return active_input_method_ids.size();
}
const InputMethodDescriptor*
MockInputMethodManager::State::GetInputMethodFromId(
const std::string& input_method_id) const {
- static const InputMethodDescriptor defaultInputMethod =
- InputMethodUtil::GetFallbackInputMethodDescriptor();
- for (size_t i = 0; i < active_input_method_ids.size(); i++) {
- if (input_method_id == active_input_method_ids[i]) {
- return &defaultInputMethod;
- }
- }
- return NULL;
+ return nullptr;
}
void MockInputMethodManager::State::EnableLoginLayouts(
const std::string& language_code,
- const std::vector<std::string>& initial_layout) {
-}
+ const std::vector<std::string>& initial_layout) {}
-void MockInputMethodManager::State::EnableLockScreenLayouts() {
-}
+void MockInputMethodManager::State::EnableLockScreenLayouts() {}
bool MockInputMethodManager::State::ReplaceEnabledInputMethods(
const std::vector<std::string>& new_active_input_method_ids) {
@@ -114,12 +52,7 @@ bool MockInputMethodManager::State::EnableInputMethod(
void MockInputMethodManager::State::ChangeInputMethod(
const std::string& input_method_id,
- bool show_message) {
-}
-
-void MockInputMethodManager::ActivateInputMethodMenuItem(
- const std::string& key) {
-}
+ bool show_message) {}
void MockInputMethodManager::State::AddInputMethodExtension(
const std::string& extension_id,
@@ -127,34 +60,27 @@ void MockInputMethodManager::State::AddInputMethodExtension(
ui::IMEEngineHandlerInterface* instance) {}
void MockInputMethodManager::State::RemoveInputMethodExtension(
- const std::string& extension_id) {
-}
+ const std::string& extension_id) {}
void MockInputMethodManager::State::GetInputMethodExtensions(
- InputMethodDescriptors* result) {
-}
+ InputMethodDescriptors* result) {}
void MockInputMethodManager::State::SetEnabledExtensionImes(
- std::vector<std::string>* ids) {
-}
+ std::vector<std::string>* ids) {}
-void MockInputMethodManager::State::SetInputMethodLoginDefault() {
-}
+void MockInputMethodManager::State::SetInputMethodLoginDefault() {}
void MockInputMethodManager::State::SetInputMethodLoginDefaultFromVPD(
const std::string& locale,
- const std::string& layout) {
-}
+ const std::string& layout) {}
bool MockInputMethodManager::State::CanCycleInputMethod() {
return true;
}
-void MockInputMethodManager::State::SwitchToNextInputMethod() {
-}
+void MockInputMethodManager::State::SwitchToNextInputMethod() {}
-void MockInputMethodManager::State::SwitchToPreviousInputMethod() {
-}
+void MockInputMethodManager::State::SwitchToPreviousInputMethod() {}
bool MockInputMethodManager::State::CanSwitchInputMethod(
const ui::Accelerator& accelerator) {
@@ -162,56 +88,68 @@ bool MockInputMethodManager::State::CanSwitchInputMethod(
}
void MockInputMethodManager::State::SwitchInputMethod(
- const ui::Accelerator& accelerator) {
-}
+ const ui::Accelerator& accelerator) {}
+
+MockInputMethodManager::State::~State() {}
InputMethodDescriptor MockInputMethodManager::State::GetCurrentInputMethod()
const {
- InputMethodDescriptor descriptor =
- InputMethodUtil::GetFallbackInputMethodDescriptor();
- if (!current_input_method_id.empty()) {
- return InputMethodDescriptor(current_input_method_id,
- descriptor.name(),
- descriptor.indicator(),
- descriptor.keyboard_layouts(),
- descriptor.language_codes(),
- true,
- GURL(), // options page url.
- GURL()); // input view page url.
- }
+ InputMethodDescriptor descriptor;
return descriptor;
}
+InputMethodManager::UISessionState MockInputMethodManager::GetUISessionState() {
+ return InputMethodManager::STATE_BROWSER_SCREEN;
+}
+
+void MockInputMethodManager::AddObserver(
+ InputMethodManager::Observer* observer) {}
+
+void MockInputMethodManager::AddCandidateWindowObserver(
+ InputMethodManager::CandidateWindowObserver* observer) {}
+
+void MockInputMethodManager::AddImeMenuObserver(
+ InputMethodManager::ImeMenuObserver* observer) {}
+
+void MockInputMethodManager::RemoveObserver(
+ InputMethodManager::Observer* observer) {}
+
+void MockInputMethodManager::RemoveCandidateWindowObserver(
+ InputMethodManager::CandidateWindowObserver* observer) {}
+
+void MockInputMethodManager::RemoveImeMenuObserver(
+ InputMethodManager::ImeMenuObserver* observer) {}
+
+std::unique_ptr<InputMethodDescriptors>
+MockInputMethodManager::GetSupportedInputMethods() const {
+ return nullptr;
+}
+
+void MockInputMethodManager::ActivateInputMethodMenuItem(
+ const std::string& key) {}
+
bool MockInputMethodManager::IsISOLevel5ShiftUsedByCurrentInputMethod() const {
- return mod3_used_;
+ return false;
}
bool MockInputMethodManager::IsAltGrUsedByCurrentInputMethod() const {
return false;
}
-ImeKeyboard* MockInputMethodManager::GetImeKeyboard() { return &keyboard_; }
+ImeKeyboard* MockInputMethodManager::GetImeKeyboard() {
+ return nullptr;
+}
InputMethodUtil* MockInputMethodManager::GetInputMethodUtil() {
- return &util_;
+ return nullptr;
}
ComponentExtensionIMEManager*
- MockInputMethodManager::GetComponentExtensionIMEManager() {
- return comp_ime_manager_.get();
-}
-
-void MockInputMethodManager::SetComponentExtensionIMEManager(
- std::unique_ptr<ComponentExtensionIMEManager> comp_ime_manager) {
- comp_ime_manager_ = std::move(comp_ime_manager);
+MockInputMethodManager::GetComponentExtensionIMEManager() {
+ return nullptr;
}
-void MockInputMethodManager::set_application_locale(const std::string& value) {
- delegate_.set_active_locale(value);
-}
-
-bool MockInputMethodManager::IsLoginKeyboard(
- const std::string& layout) const {
+bool MockInputMethodManager::IsLoginKeyboard(const std::string& layout) const {
return true;
}
@@ -221,31 +159,16 @@ bool MockInputMethodManager::MigrateInputMethods(
}
scoped_refptr<InputMethodManager::State> MockInputMethodManager::CreateNewState(
Profile* profile) {
- NOTIMPLEMENTED();
- return state_;
+ return nullptr;
}
scoped_refptr<InputMethodManager::State>
MockInputMethodManager::GetActiveIMEState() {
- return scoped_refptr<InputMethodManager::State>(state_.get());
-}
-
-scoped_refptr<InputMethodManager::State> MockInputMethodManager::State::Clone()
- const {
- NOTIMPLEMENTED();
- return manager_->GetActiveIMEState();
+ return nullptr;
}
void MockInputMethodManager::SetState(
- scoped_refptr<InputMethodManager::State> state) {
- state_ = scoped_refptr<MockInputMethodManager::State>(
- static_cast<MockInputMethodManager::State*>(state.get()));
-}
-
-void MockInputMethodManager::SetCurrentInputMethodId(
- const std::string& input_method_id) {
- state_->current_input_method_id = input_method_id;
-}
+ scoped_refptr<InputMethodManager::State> state) {}
void MockInputMethodManager::ImeMenuActivationChanged(bool is_active) {}
@@ -259,7 +182,7 @@ void MockInputMethodManager::OverrideKeyboardUrlRef(const std::string& keyset) {
}
bool MockInputMethodManager::IsEmojiHandwritingVoiceOnImeMenuEnabled() {
- return false;
+ return true;
}
} // namespace input_method
« ui/base/BUILD.gn ('K') | « ui/base/ime/chromeos/mock_input_method_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698