| Index: ash/system/ime_menu/ime_menu_tray_unittest.cc
|
| diff --git a/ash/system/ime_menu/ime_menu_tray_unittest.cc b/ash/system/ime_menu/ime_menu_tray_unittest.cc
|
| index 61663037a726e9f102aea772f60fd9dc3bfd09ae..c275e44b613317c80097e30f4b977b3ba734d456 100644
|
| --- a/ash/system/ime_menu/ime_menu_tray_unittest.cc
|
| +++ b/ash/system/ime_menu/ime_menu_tray_unittest.cc
|
| @@ -11,7 +11,6 @@
|
| #include "ash/system/ime_menu/ime_list_view.h"
|
| #include "ash/system/status_area_widget.h"
|
| #include "ash/system/tray/ime_info.h"
|
| -#include "ash/system/tray/system_tray_notifier.h"
|
| #include "ash/test/ash_test_base.h"
|
| #include "ash/test/status_area_widget_test_helper.h"
|
| #include "ash/test/test_system_tray_delegate.h"
|
| @@ -61,13 +60,13 @@ class ImeMenuTrayTest : public test::AshTestBase {
|
|
|
| // test::AshTestBase:
|
| void SetUp() override {
|
| - test::AshTestBase::SetUp();
|
| // Takes ownership.
|
| InputMethodManager::Initialize(new TestInputMethodManager);
|
| + test::AshTestBase::SetUp();
|
| }
|
| void TearDown() override {
|
| - InputMethodManager::Shutdown();
|
| test::AshTestBase::TearDown();
|
| + InputMethodManager::Shutdown();
|
| }
|
|
|
| protected:
|
| @@ -122,7 +121,10 @@ class ImeMenuTrayTest : public test::AshTestBase {
|
| ui::IMEBridge::Get()->SetCurrentInputContext(input_context);
|
| }
|
|
|
| - void SetCurrentIme(const IMEInfo& info) { current_ime_ = info; }
|
| + void SetCurrentIme(const IMEInfo& info) {
|
| + current_ime_ = info;
|
| + GetTray()->InputMethodChanged(nullptr, nullptr, false);
|
| + }
|
|
|
| void SetAvailableImeList(const std::vector<IMEInfo>& list) {
|
| available_ime_list_ = list;
|
| @@ -143,16 +145,16 @@ class ImeMenuTrayTest : public test::AshTestBase {
|
| TEST_F(ImeMenuTrayTest, ImeMenuTrayVisibility) {
|
| ASSERT_FALSE(IsVisible());
|
|
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true);
|
| + GetTray()->ImeMenuActivationChanged(true);
|
| EXPECT_TRUE(IsVisible());
|
|
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(false);
|
| + GetTray()->ImeMenuActivationChanged(false);
|
| EXPECT_FALSE(IsVisible());
|
| }
|
|
|
| // Tests that IME menu tray shows the right info of the current IME.
|
| TEST_F(ImeMenuTrayTest, TrayLabelTest) {
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true);
|
| + GetTray()->ImeMenuActivationChanged(true);
|
| ASSERT_TRUE(IsVisible());
|
|
|
| // Changes the input method to "ime1".
|
| @@ -164,7 +166,6 @@ TEST_F(ImeMenuTrayTest, TrayLabelTest) {
|
| info1.third_party = false;
|
| info1.selected = true;
|
| SetCurrentIme(info1);
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIME();
|
| EXPECT_EQ(UTF8ToUTF16("US"), GetTrayText());
|
|
|
| // Changes the input method to a third-party IME extension.
|
| @@ -176,7 +177,6 @@ TEST_F(ImeMenuTrayTest, TrayLabelTest) {
|
| info2.third_party = true;
|
| info2.selected = true;
|
| SetCurrentIme(info2);
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIME();
|
| EXPECT_EQ(UTF8ToUTF16("UK*"), GetTrayText());
|
| }
|
|
|
| @@ -185,7 +185,7 @@ TEST_F(ImeMenuTrayTest, TrayLabelTest) {
|
| // menu feature. Also makes sure that the shelf won't autohide as long as the
|
| // IME menu is open.
|
| TEST_F(ImeMenuTrayTest, PerformAction) {
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true);
|
| + GetTray()->ImeMenuActivationChanged(true);
|
| ASSERT_TRUE(IsVisible());
|
| ASSERT_FALSE(IsTrayBackgroundActive());
|
| StatusAreaWidget* status = StatusAreaWidgetTestHelper::GetStatusAreaWidget();
|
| @@ -209,7 +209,7 @@ TEST_F(ImeMenuTrayTest, PerformAction) {
|
| // element will be deactivated.
|
| GetTray()->PerformAction(tap);
|
| EXPECT_TRUE(IsTrayBackgroundActive());
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(false);
|
| + GetTray()->ImeMenuActivationChanged(false);
|
| EXPECT_FALSE(IsVisible());
|
| EXPECT_FALSE(IsBubbleShown());
|
| EXPECT_FALSE(IsTrayBackgroundActive());
|
| @@ -254,7 +254,6 @@ TEST_F(ImeMenuTrayTest, RefreshImeWithListViewCreated) {
|
| // Simulate switch to IME 1.
|
| SetAvailableImeList(ime_info_list);
|
| SetCurrentIme(info1);
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIME();
|
| EXPECT_EQ(UTF8ToUTF16("US"), GetTrayText());
|
| EXPECT_TRUE(IsTrayImeListValid(ime_info_list, info1));
|
|
|
| @@ -263,7 +262,6 @@ TEST_F(ImeMenuTrayTest, RefreshImeWithListViewCreated) {
|
| ime_info_list[2].selected = true;
|
| SetAvailableImeList(ime_info_list);
|
| SetCurrentIme(info3);
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIME();
|
| EXPECT_EQ(UTF8ToUTF16("拼"), GetTrayText());
|
| EXPECT_TRUE(IsTrayImeListValid(ime_info_list, info3));
|
|
|
| @@ -275,7 +273,7 @@ TEST_F(ImeMenuTrayTest, RefreshImeWithListViewCreated) {
|
|
|
| // Tests that quits Chrome with IME menu openned will not crash.
|
| TEST_F(ImeMenuTrayTest, QuitChromeWithMenuOpen) {
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true);
|
| + GetTray()->ImeMenuActivationChanged(true);
|
| ASSERT_TRUE(IsVisible());
|
| ASSERT_FALSE(IsTrayBackgroundActive());
|
|
|
| @@ -288,7 +286,7 @@ TEST_F(ImeMenuTrayTest, QuitChromeWithMenuOpen) {
|
|
|
| // Tests using 'Alt+Shift+K' to open the menu.
|
| TEST_F(ImeMenuTrayTest, TestAccelerator) {
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true);
|
| + GetTray()->ImeMenuActivationChanged(true);
|
| ASSERT_TRUE(IsVisible());
|
| ASSERT_FALSE(IsTrayBackgroundActive());
|
|
|
| @@ -305,7 +303,7 @@ TEST_F(ImeMenuTrayTest, TestAccelerator) {
|
| }
|
|
|
| TEST_F(ImeMenuTrayTest, ShowEmojiKeyset) {
|
| - Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true);
|
| + GetTray()->ImeMenuActivationChanged(true);
|
| ASSERT_TRUE(IsVisible());
|
| ASSERT_FALSE(IsTrayBackgroundActive());
|
|
|
|
|