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

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 b71f2f0508a5cf7cb3fa1061fb41350538a46ece..c5cfeeb011065e60924968c5c7986160a3f1d385 100644
--- a/ash/common/system/ime/tray_ime_chromeos_unittest.cc
+++ b/ash/common/system/ime/tray_ime_chromeos_unittest.cc
@@ -11,6 +11,7 @@
#include "ash/common/wm_shell.h"
#include "ash/test/ash_test_base.h"
#include "base/command_line.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 {
// Sets the current number of active IMEs.
void SetIMELength(int length);
+ // Sets the managed IMEs tooltip message (and thus also if IMEs are managed =
+ // non-empty or not = empty)
+ void SetManagedMessage(base::string16 managed_message);
+
// Returns the view in the detailed views scroll content at the provided
// index.
views::View* GetScrollChildView(int index);
@@ -75,6 +80,11 @@ void TrayIMETest::SetIMELength(int length) {
tray_->Update();
}
+void TrayIMETest::SetManagedMessage(base::string16 managed_message) {
+ tray_->ime_managed_message_ = managed_message;
+ tray_->Update();
+}
+
views::View* TrayIMETest::GetScrollChildView(int index) {
TrayDetailsView* details = static_cast<TrayDetailsView*>(detailed_view());
views::View* content = details->scroll_content();
@@ -133,9 +143,6 @@ void TrayIMETest::TearDown() {
// Tests that if the keyboard is not suppressed the default view is hidden
// if less than 2 IMEs are present.
TEST_F(TrayIMETest, HiddenWithNoIMEs) {
- if (MaterialDesignController::IsSystemTrayMenuMaterial())
- return;
-
SetIMELength(0);
EXPECT_FALSE(default_view()->visible());
SetIMELength(1);
@@ -144,6 +151,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