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

Unified Diff: ash/system/ime_menu/ime_menu_tray_unittest.cc

Issue 2917423002: Revert of chromeos: Remove SystemTrayDelegate::GetIMEManagedMessage() (Closed)
Patch Set: Created 3 years, 6 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/ime/tray_ime_chromeos.cc ('k') | ash/system/tray/system_tray_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ceb41df42207c68d10db7764671ca9968df7ad03..10ea62d8572c3f07d4646f91cff47e1d5a02fb22 100644
--- a/ash/system/ime_menu/ime_menu_tray_unittest.cc
+++ b/ash/system/ime_menu/ime_menu_tray_unittest.cc
@@ -25,8 +25,6 @@
#include "ui/views/controls/label.h"
using base::UTF8ToUTF16;
-using chromeos::input_method::InputMethodManager;
-using chromeos::input_method::MockInputMethodManager;
namespace ash {
@@ -34,38 +32,10 @@
return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->ime_menu_tray();
}
-// An InputMethodManager that always returns an active IME state.
-class TestInputMethodManager : public MockInputMethodManager {
- public:
- TestInputMethodManager() : state_(new MockInputMethodManager::State) {}
- ~TestInputMethodManager() override = default;
-
- // MockInputMethodManager:
- scoped_refptr<InputMethodManager::State> GetActiveIMEState() override {
- return state_;
- }
-
- scoped_refptr<MockInputMethodManager::State> state_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TestInputMethodManager);
-};
-
class ImeMenuTrayTest : public test::AshTestBase {
public:
- ImeMenuTrayTest() = default;
- ~ImeMenuTrayTest() override = default;
-
- // test::AshTestBase:
- void SetUp() override {
- test::AshTestBase::SetUp();
- // Takes ownership.
- InputMethodManager::Initialize(new TestInputMethodManager);
- }
- void TearDown() override {
- InputMethodManager::Shutdown();
- test::AshTestBase::TearDown();
- }
+ ImeMenuTrayTest() {}
+ ~ImeMenuTrayTest() override {}
protected:
// Returns true if the IME menu tray is visible.
@@ -334,23 +304,21 @@
}
TEST_F(ImeMenuTrayTest, ShowEmojiHandwritingVoiceButtons) {
- InputMethodManager* input_method_manager = InputMethodManager::Get();
- ASSERT_TRUE(input_method_manager);
- // Feature is enabled.
- ASSERT_TRUE(input_method_manager->IsEmojiHandwritingVoiceOnImeMenuEnabled());
-
- // Text fields should show the buttons.
FocusInInputContext(ui::TEXT_INPUT_TYPE_TEXT);
+ EXPECT_FALSE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons());
+
+ chromeos::input_method::InputMethodManager* input_method_manager =
+ chromeos::input_method::InputMethodManager::Get();
+ EXPECT_FALSE(input_method_manager);
+ chromeos::input_method::InputMethodManager::Initialize(
+ new chromeos::input_method::MockInputMethodManager);
+ input_method_manager = chromeos::input_method::InputMethodManager::Get();
+ EXPECT_TRUE(input_method_manager &&
+ input_method_manager->IsEmojiHandwritingVoiceOnImeMenuEnabled());
EXPECT_TRUE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons());
- // Password fields should not show the buttons.
FocusInInputContext(ui::TEXT_INPUT_TYPE_PASSWORD);
EXPECT_FALSE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons());
-
- // Lock screen should not show the buttons.
- BlockUserSession(BLOCKED_BY_LOCK_SCREEN);
- FocusInInputContext(ui::TEXT_INPUT_TYPE_TEXT);
- EXPECT_FALSE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons());
}
} // namespace ash
« no previous file with comments | « ash/system/ime/tray_ime_chromeos.cc ('k') | ash/system/tray/system_tray_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698