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

Unified Diff: ash/shell_unittest.cc

Issue 2852403002: Make virtual keyboard work on supervised user creation (Closed)
Patch Set: Fix ShellTest.KeyboardCreation. 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/shell.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shell_unittest.cc
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc
index 62bf1237c374f2d148f1d9be169deb9db11355fa..dad834ecbdc7936760f8ff03eb35d495a46d4522 100644
--- a/ash/shell_unittest.cc
+++ b/ash/shell_unittest.cc
@@ -22,6 +22,7 @@
#include "ash/test/test_session_controller_client.h"
#include "ash/wallpaper/wallpaper_widget_controller.h"
#include "ash/wm/window_util.h"
+#include "base/command_line.h"
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -34,6 +35,9 @@
#include "ui/events/test/events_test_utils.h"
#include "ui/events/test/test_event_handler.h"
#include "ui/gfx/geometry/size.h"
+#include "ui/keyboard/keyboard_controller.h"
+#include "ui/keyboard/keyboard_switches.h"
+#include "ui/keyboard/keyboard_util.h"
#include "ui/views/controls/menu/menu_controller.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/widget/widget.h"
@@ -485,6 +489,23 @@ TEST_F(ShellTest, EnvPreTargetHandler) {
aura::Env::GetInstance()->RemovePreTargetHandler(&event_handler);
}
+// Verifies keyboard is re-created on proper timing.
+TEST_F(ShellTest, KeyboardCreation) {
+ if (Shell::GetAshConfig() == Config::MASH)
+ return;
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(
+ keyboard::switches::kEnableVirtualKeyboard);
+
+ ASSERT_TRUE(keyboard::IsKeyboardEnabled());
+
+ SessionObserver* shell = Shell::Get();
+ EXPECT_FALSE(keyboard::KeyboardController::GetInstance());
+ shell->OnSessionStateChanged(
+ session_manager::SessionState::LOGGED_IN_NOT_ACTIVE);
+
+ EXPECT_TRUE(keyboard::KeyboardController::GetInstance());
+}
+
// This verifies WindowObservers are removed when a window is destroyed after
// the Shell is destroyed. This scenario (aura::Windows being deleted after the
// Shell) occurs if someone is holding a reference to an unparented Window, as
« no previous file with comments | « ash/shell.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698