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( |