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

Unified Diff: chrome/browser/chromeos/preferences_unittest.cc

Issue 419293002: IME refactoring: ChromeOS introduce input methods State. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test fixed. Re-sorted methods of StateImpl and IMM. Created 6 years, 4 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/preferences_unittest.cc
diff --git a/chrome/browser/chromeos/preferences_unittest.cc b/chrome/browser/chromeos/preferences_unittest.cc
index 62cc543d01a412e9457f930b2bd12fab87a541ce..b5e682bdfee563b53706867068a05de2bb7abb40 100644
--- a/chrome/browser/chromeos/preferences_unittest.cc
+++ b/chrome/browser/chromeos/preferences_unittest.cc
@@ -19,23 +19,38 @@ namespace {
class MyMockInputMethodManager : public input_method::MockInputMethodManager {
public:
+ class State : public MockInputMethodManager::State {
+ public:
+ explicit State(MyMockInputMethodManager* manager)
+ : MockInputMethodManager::State(manager), manager_(manager) {};
+
+ virtual void ChangeInputMethod(const std::string& input_method_id,
+ bool show_message) OVERRIDE {
+ manager_->last_input_method_id_ = input_method_id;
+ // Do the same thing as BrowserStateMonitor::UpdateUserPreferences.
+ const std::string current_input_method_on_pref =
+ manager_->current_->GetValue();
+ if (current_input_method_on_pref == input_method_id)
+ return;
+ manager_->previous_->SetValue(current_input_method_on_pref);
+ manager_->current_->SetValue(input_method_id);
+ }
+
+ protected:
+ virtual ~State() {};
+
+ private:
+ MyMockInputMethodManager* const manager_;
+ };
+
MyMockInputMethodManager(StringPrefMember* previous,
StringPrefMember* current)
: previous_(previous),
current_(current) {
- }
- virtual ~MyMockInputMethodManager() {
+ state_ = new State(this);
}
- virtual void ChangeInputMethod(const std::string& input_method_id) OVERRIDE {
- last_input_method_id_ = input_method_id;
- // Do the same thing as BrowserStateMonitor::UpdateUserPreferences.
- const std::string current_input_method_on_pref = current_->GetValue();
- if (current_input_method_on_pref == input_method_id)
- return;
- previous_->SetValue(current_input_method_on_pref);
- current_->SetValue(input_method_id);
- }
+ virtual ~MyMockInputMethodManager() {}
std::string last_input_method_id_;
@@ -72,7 +87,8 @@ TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) {
MyMockInputMethodManager mock_manager(&previous, &current);
Preferences testee(&mock_manager);
- testee.InitUserPrefsForTesting(&prefs, test_user);
+ testee.InitUserPrefsForTesting(
+ &prefs, test_user, mock_manager.GetActiveIMEState());
testee.SetInputMethodListForTesting();
// Confirm they're unchanged.
« no previous file with comments | « chrome/browser/chromeos/preferences_browsertest.cc ('k') | chrome/browser/extensions/api/input_ime/input_ime_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698