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

Unified Diff: chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc

Issue 2920883002: chromeos: Make ash system tray directly observe IME state changes (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « ash/system/tray/system_tray_notifier.cc ('k') | chrome/browser/ui/ash/system_tray_delegate_chromeos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc
index a74dc0daacf22a87bd595d093cc19385b00fe2df..d2d9e20593a175f959a1ae71ae191871c8d077ea 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc
@@ -136,8 +136,9 @@ class InputMethodManagerImplTest : public BrowserWithTestWindowTest {
ui::InitializeInputMethodForTesting();
delegate_ = new FakeInputMethodDelegate();
- manager_.reset(new InputMethodManagerImpl(
- std::unique_ptr<InputMethodDelegate>(delegate_), false));
+ manager_ = new InputMethodManagerImpl(
+ std::unique_ptr<InputMethodDelegate>(delegate_), false);
+ InputMethodManager::Initialize(manager_); // Takes ownership.
manager_->GetInputMethodUtil()->UpdateHardwareLayoutCache();
candidate_window_controller_ = new MockCandidateWindowController;
manager_->SetCandidateWindowControllerForTesting(
@@ -163,7 +164,8 @@ class InputMethodManagerImplTest : public BrowserWithTestWindowTest {
delegate_ = NULL;
candidate_window_controller_ = NULL;
keyboard_ = NULL;
- manager_.reset();
+ InputMethodManager::Shutdown();
+ manager_ = nullptr;
profile_manager_.reset();
}
@@ -350,7 +352,7 @@ class InputMethodManagerImplTest : public BrowserWithTestWindowTest {
}
std::unique_ptr<TestingProfileManager> profile_manager_;
- std::unique_ptr<InputMethodManagerImpl> manager_;
+ InputMethodManagerImpl* manager_; // Owned by InputMethodManager.
FakeInputMethodDelegate* delegate_;
MockCandidateWindowController* candidate_window_controller_;
std::unique_ptr<MockInputMethodEngine> mock_engine_handler_;
@@ -833,6 +835,11 @@ TEST_F(InputMethodManagerImplTest, TestXkbSetting) {
}
TEST_F(InputMethodManagerImplTest, TestActivateInputMethodMenuItem) {
+ // Activating a menu item triggers observers in ash that assume
+ // GetActiveIMEState() is not null.
+ manager_->SetState(manager_->CreateNewState(nullptr));
+ ui::IMEBridge::Get()->SetCurrentEngineHandler(mock_engine_handler_.get());
+
const std::string kKey = "key";
ui::ime::InputMethodMenuItemList menu_list;
menu_list.push_back(ui::ime::InputMethodMenuItem(
« no previous file with comments | « ash/system/tray/system_tray_notifier.cc ('k') | chrome/browser/ui/ash/system_tray_delegate_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698