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

Unified Diff: ash/common/system/ime/tray_ime_chromeos_unittest.cc

Issue 2652793003: Add login screen locale and input method device policies (Closed)
Patch Set: Rebase. Created 3 years, 10 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
Index: ash/common/system/ime/tray_ime_chromeos_unittest.cc
diff --git a/ash/common/system/ime/tray_ime_chromeos_unittest.cc b/ash/common/system/ime/tray_ime_chromeos_unittest.cc
index c29c102988adfc4c3160e8fc344d09c6a83cbfdf..c90fa49ace8b906786929252938e49de2f551250 100644
--- a/ash/common/system/ime/tray_ime_chromeos_unittest.cc
+++ b/ash/common/system/ime/tray_ime_chromeos_unittest.cc
@@ -10,6 +10,7 @@
#include "ash/common/system/tray/system_tray_notifier.h"
#include "ash/common/wm_shell.h"
#include "ash/test/ash_test_base.h"
+#include "base/strings/utf_string_conversions.h"
#include "ui/events/devices/device_data_manager.h"
#include "ui/keyboard/keyboard_util.h"
@@ -34,6 +35,10 @@ class TrayIMETest : public test::AshTestBase {
// Returns the view responsible for toggling virtual keyboard.
views::View* GetToggleView() const;
+ // Sets the managed IMEs tooltip message (and thus also if IMEs are managed =
+ // non-empty or not = empty)
+ void SetManagedMessage(base::string16 managed_message);
+
void SuppressKeyboard();
void RestoreKeyboard();
@@ -76,6 +81,11 @@ views::View* TrayIMETest::GetToggleView() const {
return test_api.GetToggleView();
}
+void TrayIMETest::SetManagedMessage(base::string16 managed_message) {
+ tray_->ime_managed_message_ = managed_message;
+ tray_->Update();
+}
+
void TrayIMETest::SuppressKeyboard() {
DCHECK(!keyboard_suppressed_);
keyboard_suppressed_ = true;
@@ -134,6 +144,18 @@ TEST_F(TrayIMETest, HiddenWithNoIMEs) {
EXPECT_TRUE(default_view()->visible());
}
+// Tests that if IMEs are managed, the default view is displayed even for a
+// single IME.
+TEST_F(TrayIMETest, ShownWithSingleIMEWhenManaged) {
+ SetManagedMessage(base::ASCIIToUTF16("managed"));
+ SetIMELength(0);
+ EXPECT_FALSE(default_view()->visible());
+ SetIMELength(1);
+ EXPECT_TRUE(default_view()->visible());
+ SetIMELength(2);
+ EXPECT_TRUE(default_view()->visible());
+}
+
// Tests that if no IMEs are present the default view is hidden when a11y is
// enabled.
TEST_F(TrayIMETest, HidesOnA11yEnabled) {

Powered by Google App Engine
This is Rietveld 408576698