#include <algorithm>
#include "ash/shell.h"
+#include "chrome/browser/chromeos/input_method/input_method_util.h"
#include "chrome/browser/chromeos/input_method/mode_indicator_controller.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chromeos/ime/component_extension_ime_manager.h"
+#include "chromeos/ime/extension_ime_util.h"
#include "chromeos/ime/input_method_manager.h"
+#include "chromeos/ime/input_method_whitelist.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
}
void InitializeIMF() {
- // Make sure ComponentExtensionIMEManager is initialized.
- // ComponentExtensionIMEManagerImpl::InitializeAsync posts
- // ReadComponentExtensionsInfo to the FILE thread for the
- // initialization. If it is never initialized for some reasons,
- // the test is timed out and failed.
- ComponentExtensionIMEManager* ceimm =
- InputMethodManager::Get()->GetComponentExtensionIMEManager();
- while (!ceimm->IsInitialized()) {
- content::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
- }
+ InputMethodManager::Get()
+ ->GetInputMethodUtil()
+ ->InitXkbInputMethodsForTesting();
}
private:
ASSERT_TRUE(imm);
std::vector<std::string> keyboard_layouts;
- keyboard_layouts.push_back("xkb:fr::fra");
+ keyboard_layouts.push_back(
+ extension_ime_util::GetInputMethodIDByEngineID("xkb:fr::fra"));
// Add keyboard layouts to enable the mode indicator.
- imm->EnableLoginLayouts("fr", keyboard_layouts);
- ASSERT_LT(1UL, imm->GetNumActiveInputMethods());
+ imm->GetActiveIMEState()->EnableLoginLayouts("fr", keyboard_layouts);
+ ASSERT_LT(1UL, imm->GetActiveIMEState()->GetNumActiveInputMethods());
- chromeos::IBusPanelCandidateWindowHandlerInterface* candidate_window =
+ chromeos::IMECandidateWindowHandlerInterface* candidate_window =
chromeos::IMEBridge::Get()->GetCandidateWindowHandler();
candidate_window->FocusStateChanged(true);
{
ScopedModeIndicatorObserverForTesting observer;
candidate_window->SetCursorBounds(cursor1_bounds, cursor1_bounds);
- EXPECT_TRUE(imm->SwitchToNextInputMethod());
+ EXPECT_TRUE(imm->GetActiveIMEState()->SwitchToNextInputMethod());
mi1_bounds = observer.last_bounds();
// The bounds should be bigger than the inner size.
EXPECT_LE(kInnerSize, mi1_bounds.width());
{
ScopedModeIndicatorObserverForTesting observer;
candidate_window->SetCursorBounds(cursor2_bounds, cursor2_bounds);
- EXPECT_TRUE(imm->SwitchToNextInputMethod());
+ EXPECT_TRUE(imm->GetActiveIMEState()->SwitchToNextInputMethod());
mi2_bounds = observer.last_bounds();
EXPECT_TRUE(observer.is_displayed());
}
{
ScopedModeIndicatorObserverForTesting observer;
candidate_window->SetCursorBounds(cursor3_bounds, cursor3_bounds);
- EXPECT_TRUE(imm->SwitchToNextInputMethod());
+ EXPECT_TRUE(imm->GetActiveIMEState()->SwitchToNextInputMethod());
mi3_bounds = observer.last_bounds();
EXPECT_TRUE(observer.is_displayed());
EXPECT_LT(mi3_bounds.bottom(), screen_bounds.bottom());
ASSERT_TRUE(imm);
std::vector<std::string> keyboard_layouts;
- keyboard_layouts.push_back("xkb:fr::fra");
+ keyboard_layouts.push_back(
+ extension_ime_util::GetInputMethodIDByEngineID("xkb:fr::fra"));
// Add keyboard layouts to enable the mode indicator.
- imm->EnableLoginLayouts("fr", keyboard_layouts);
- ASSERT_LT(1UL, imm->GetNumActiveInputMethods());
+ imm->GetActiveIMEState()->EnableLoginLayouts("fr", keyboard_layouts);
+ ASSERT_LT(1UL, imm->GetActiveIMEState()->GetNumActiveInputMethods());
- chromeos::IBusPanelCandidateWindowHandlerInterface* candidate_window =
+ chromeos::IMECandidateWindowHandlerInterface* candidate_window =
chromeos::IMEBridge::Get()->GetCandidateWindowHandler();
candidate_window->FocusStateChanged(true);
{
ScopedModeIndicatorObserverForTesting observer;
- EXPECT_TRUE(imm->SwitchToNextInputMethod());
+ EXPECT_TRUE(imm->GetActiveIMEState()->SwitchToNextInputMethod());
EXPECT_EQ(1UL, observer.max_widget_list_size());
const views::Widget* widget1 = observer.widget_list()[0];
- EXPECT_TRUE(imm->SwitchToNextInputMethod());
+ EXPECT_TRUE(imm->GetActiveIMEState()->SwitchToNextInputMethod());
EXPECT_EQ(2UL, observer.max_widget_list_size());
// When a new mode indicator is displayed, the previous one should be