Commit 07187e4b authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

vk: Move keyboard layout delegate impl to AshKeyboardController.

VirtualKeyboardController is a class for observing changes to input
devices to decide whether to enable the VK. It currently also implements
the keyboard layout delegate interface (for working with displays),
which is not really its responsibility.

This patch moves the logic into AshKeyboardController, which will be
the ash impl of the virtual keyboard interface, so it makes sense that
the code is there.

Bug: 845780
Change-Id: Idf2e1805fbb3b3788dce27ee0ba0b76a9d4b2989
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1657511
Commit-Queue: Darren Shen <shend@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#669069}
parent 9d62030e
......@@ -11,9 +11,11 @@
#include "ash/keyboard/virtual_keyboard_controller.h"
#include "ash/public/cpp/keyboard/keyboard_switches.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/geometry/rect.h"
......@@ -24,6 +26,18 @@ using keyboard::KeyboardEnableFlag;
namespace ash {
namespace {
base::Optional<display::Display> GetFirstTouchDisplay() {
for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) {
if (display.touch_support() == display::Display::TouchSupport::AVAILABLE)
return display;
}
return base::nullopt;
}
} // namespace
AshKeyboardController::AshKeyboardController(
SessionControllerImpl* session_controller)
: session_controller_(session_controller),
......@@ -43,8 +57,7 @@ void AshKeyboardController::CreateVirtualKeyboard(
std::unique_ptr<keyboard::KeyboardUIFactory> keyboard_ui_factory) {
DCHECK(keyboard_ui_factory);
virtual_keyboard_controller_ = std::make_unique<VirtualKeyboardController>();
keyboard_controller_->Initialize(std::move(keyboard_ui_factory),
virtual_keyboard_controller_.get());
keyboard_controller_->Initialize(std::move(keyboard_ui_factory), this);
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
keyboard::switches::kEnableVirtualKeyboard)) {
......@@ -195,17 +208,50 @@ void AshKeyboardController::OnSessionStateChanged(
}
}
// private methods
void AshKeyboardController::OnRootWindowClosing(aura::Window* root_window) {
if (keyboard_controller_->GetRootWindow() == root_window) {
aura::Window* new_parent =
virtual_keyboard_controller_->GetContainerForDefaultDisplay();
aura::Window* new_parent = GetContainerForDefaultDisplay();
DCHECK_NE(root_window, new_parent);
keyboard_controller_->MoveToParentContainer(new_parent);
}
}
aura::Window* AshKeyboardController::GetContainerForDisplay(
const display::Display& display) {
DCHECK(display.is_valid());
RootWindowController* controller =
Shell::Get()->GetRootWindowControllerWithDisplayId(display.id());
aura::Window* container =
controller->GetContainer(kShellWindowId_VirtualKeyboardContainer);
DCHECK(container);
return container;
}
aura::Window* AshKeyboardController::GetContainerForDefaultDisplay() {
const display::Screen* screen = display::Screen::GetScreen();
const base::Optional<display::Display> first_touch_display =
GetFirstTouchDisplay();
const bool has_touch_display = first_touch_display.has_value();
if (wm::GetFocusedWindow()) {
// Return the focused display if that display has touch capability or no
// other display has touch capability.
const display::Display focused_display =
screen->GetDisplayNearestWindow(wm::GetFocusedWindow());
if (focused_display.is_valid() &&
(focused_display.touch_support() ==
display::Display::TouchSupport::AVAILABLE ||
!has_touch_display)) {
return GetContainerForDisplay(focused_display);
}
}
// Return the first touch display, or the primary display if there are none.
return GetContainerForDisplay(
has_touch_display ? *first_touch_display : screen->GetPrimaryDisplay());
}
void AshKeyboardController::OnKeyboardConfigChanged(
const keyboard::KeyboardConfig& config) {
for (auto& observer : observers_)
......
......@@ -11,6 +11,7 @@
#include "ash/ash_export.h"
#include "ash/keyboard/ui/keyboard_controller.h"
#include "ash/keyboard/ui/keyboard_layout_delegate.h"
#include "ash/public/cpp/keyboard/keyboard_controller.h"
#include "ash/public/cpp/keyboard/keyboard_controller_observer.h"
#include "ash/session/session_observer.h"
......@@ -36,9 +37,11 @@ class VirtualKeyboardController;
// class. TODO(shend): Consider re-factoring keyboard::KeyboardController so
// that this can inherit from that class instead. Rename this to
// KeyboardControllerImpl.
class ASH_EXPORT AshKeyboardController : public KeyboardController,
public KeyboardControllerObserver,
public SessionObserver {
class ASH_EXPORT AshKeyboardController
: public KeyboardController,
public keyboard::KeyboardLayoutDelegate,
public KeyboardControllerObserver,
public SessionObserver {
public:
// |session_controller| is expected to outlive AshKeyboardController.
explicit AshKeyboardController(SessionControllerImpl* session_controller);
......@@ -79,6 +82,11 @@ class ASH_EXPORT AshKeyboardController : public KeyboardController,
void SetDraggableArea(const gfx::Rect& bounds) override;
void AddObserver(KeyboardControllerObserver* observer) override;
// keyboard::KeyboardLayoutDelegate:
aura::Window* GetContainerForDefaultDisplay() override;
aura::Window* GetContainerForDisplay(
const display::Display& display) override;
// SessionObserver:
void OnSessionStateChanged(session_manager::SessionState state) override;
......
......@@ -24,6 +24,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/window.h"
#include "ui/display/manager/display_manager.h"
#include "ui/display/test/display_manager_test_api.h"
using keyboard::KeyboardConfig;
using keyboard::KeyboardEnableFlag;
......@@ -136,6 +137,21 @@ class AshKeyboardControllerTest : public AshTestBase {
return result;
}
aura::Window* GetPrimaryRootWindow() { return Shell::GetPrimaryRootWindow(); }
aura::Window* GetSecondaryRootWindow() {
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
return root_windows[0] == GetPrimaryRootWindow() ? root_windows[1]
: root_windows[0];
}
void CreateFocusedTestWindowInRootWindow(aura::Window* root_window) {
// Owned by |root_window|.
aura::Window* focusable_window =
CreateTestWindowInShellWithBounds(root_window->GetBoundsInScreen());
focusable_window->Focus();
}
private:
DISALLOW_COPY_AND_ASSIGN(AshKeyboardControllerTest);
};
......@@ -371,4 +387,158 @@ TEST_F(AshKeyboardControllerTest, OccludedBoundsInMultipleDisplays) {
EXPECT_EQ(800, screen_bounds.x());
}
// Test for http://crbug.com/303429. |GetContainerForDisplay| should move
// keyboard to specified display even when it's not touchable.
TEST_F(AshKeyboardControllerTest, GetContainerForDisplay) {
UpdateDisplay("500x500,500x500");
// Make primary display touchable.
display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.SetTouchSupport(GetPrimaryDisplay().id(),
display::Display::TouchSupport::AVAILABLE);
EXPECT_EQ(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
// Move to primary display.
EXPECT_EQ(GetPrimaryRootWindow(),
ash_keyboard_controller()
->GetContainerForDisplay(GetPrimaryDisplay())
->GetRootWindow());
// Move to secondary display.
EXPECT_EQ(GetSecondaryRootWindow(),
ash_keyboard_controller()
->GetContainerForDisplay(GetSecondaryDisplay())
->GetRootWindow());
}
// Test for http://crbug.com/297858. |GetContainerForDefaultDisplay| should
// return the primary display if no display has touch capability and
// no window is focused.
TEST_F(AshKeyboardControllerTest,
DefaultContainerInPrimaryDisplayWhenNoDisplayHasTouch) {
UpdateDisplay("500x500,500x500");
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
EXPECT_EQ(GetPrimaryRootWindow(), ash_keyboard_controller()
->GetContainerForDefaultDisplay()
->GetRootWindow());
}
// Test for http://crbug.com/297858. |GetContainerForDefaultDisplay| should
// move keyboard to focused display if no display has touch capability.
TEST_F(AshKeyboardControllerTest,
DefaultContainerIsInFocusedDisplayWhenNoDisplayHasTouch) {
UpdateDisplay("500x500,500x500");
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
CreateFocusedTestWindowInRootWindow(GetSecondaryRootWindow());
EXPECT_EQ(GetSecondaryRootWindow(), ash_keyboard_controller()
->GetContainerForDefaultDisplay()
->GetRootWindow());
}
// Test for http://crbug.com/303429. |GetContainerForDefaultDisplay| should
// move keyboard to first touchable display when there is one.
TEST_F(AshKeyboardControllerTest, DefaultContainerIsInFirstTouchableDisplay) {
UpdateDisplay("500x500,500x500");
// Make secondary display touchable.
display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.SetTouchSupport(GetSecondaryDisplay().id(),
display::Display::TouchSupport::AVAILABLE);
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_EQ(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
EXPECT_EQ(GetSecondaryRootWindow(), ash_keyboard_controller()
->GetContainerForDefaultDisplay()
->GetRootWindow());
}
// Test for http://crbug.com/303429. |GetContainerForDefaultDisplay| should
// move keyboard to first touchable display when the focused display is not
// touchable.
TEST_F(
AshKeyboardControllerTest,
DefaultContainerIsInFirstTouchableDisplayIfFocusedDisplayIsNotTouchable) {
UpdateDisplay("500x500,500x500");
// Make secondary display touchable.
display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.SetTouchSupport(GetSecondaryDisplay().id(),
display::Display::TouchSupport::AVAILABLE);
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_EQ(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
// Focus on primary display.
CreateFocusedTestWindowInRootWindow(GetPrimaryRootWindow());
EXPECT_EQ(GetSecondaryRootWindow(), ash_keyboard_controller()
->GetContainerForDefaultDisplay()
->GetRootWindow());
}
// Test for http://crbug.com/303429. |GetContainerForDefaultDisplay| should
// move keyborad to first touchable display when there is one.
TEST_F(AshKeyboardControllerTest,
DefaultContainerIsInFocusedDisplayIfTouchable) {
UpdateDisplay("500x500,500x500");
// Make both displays touchable.
display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.SetTouchSupport(GetPrimaryDisplay().id(),
display::Display::TouchSupport::AVAILABLE);
display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.SetTouchSupport(GetSecondaryDisplay().id(),
display::Display::TouchSupport::AVAILABLE);
EXPECT_EQ(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_EQ(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
// Focus on secondary display.
CreateFocusedTestWindowInRootWindow(GetSecondaryRootWindow());
EXPECT_EQ(GetSecondaryRootWindow(), ash_keyboard_controller()
->GetContainerForDefaultDisplay()
->GetRootWindow());
// Focus on primary display.
CreateFocusedTestWindowInRootWindow(GetPrimaryRootWindow());
EXPECT_EQ(GetPrimaryRootWindow(), ash_keyboard_controller()
->GetContainerForDefaultDisplay()
->GetRootWindow());
}
// Test for https://crbug.com/897007.
TEST_F(AshKeyboardControllerTest, ShowKeyboardInSecondaryDisplay) {
UpdateDisplay("500x500,500x500");
ash_keyboard_controller()->SetEnableFlag(
KeyboardEnableFlag::kExtensionEnabled);
// Show in secondary display.
keyboard_controller()->ShowKeyboardInDisplay(GetSecondaryDisplay());
EXPECT_EQ(GetSecondaryRootWindow(), keyboard_controller()->GetRootWindow());
ASSERT_TRUE(keyboard::WaitUntilShown());
EXPECT_TRUE(!keyboard_controller()->GetKeyboardWindow()->bounds().IsEmpty());
}
} // namespace ash
......@@ -13,12 +13,10 @@
#include "ash/keyboard/ui/keyboard_util.h"
#include "ash/public/cpp/keyboard/keyboard_switches.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray_notifier.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/window_util.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
......@@ -49,14 +47,6 @@ void ResetVirtualKeyboard() {
chromeos::input_method::mojom::ImeKeyset::kNone);
}
bool HasTouchableDisplay() {
for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) {
if (display.touch_support() == display::Display::TouchSupport::AVAILABLE)
return true;
}
return false;
}
} // namespace
VirtualKeyboardController::VirtualKeyboardController()
......@@ -120,44 +110,6 @@ void VirtualKeyboardController::ToggleIgnoreExternalKeyboard() {
UpdateKeyboardEnabled();
}
aura::Window* VirtualKeyboardController::GetContainerForDisplay(
const display::Display& display) {
DCHECK(display.is_valid());
RootWindowController* controller =
Shell::Get()->GetRootWindowControllerWithDisplayId(display.id());
aura::Window* container =
controller->GetContainer(kShellWindowId_VirtualKeyboardContainer);
DCHECK(container);
return container;
}
aura::Window* VirtualKeyboardController::GetContainerForDefaultDisplay() {
const display::Screen* screen = display::Screen::GetScreen();
if (wm::GetFocusedWindow()) {
// Return the focused display if that display has touch capability or no
// other display has touch capability.
const display::Display focused_display =
screen->GetDisplayNearestWindow(wm::GetFocusedWindow());
if (focused_display.is_valid() &&
(focused_display.touch_support() ==
display::Display::TouchSupport::AVAILABLE ||
!HasTouchableDisplay())) {
return GetContainerForDisplay(focused_display);
}
}
// Otherwise, get the first touchable display.
for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) {
if (display.touch_support() == display::Display::TouchSupport::AVAILABLE)
return GetContainerForDisplay(display);
}
// If there are no touchable displays, then just return the primary display.
return GetContainerForDisplay(screen->GetPrimaryDisplay());
}
void VirtualKeyboardController::UpdateDevices() {
ui::DeviceDataManager* device_data_manager =
ui::DeviceDataManager::GetInstance();
......
......@@ -9,7 +9,6 @@
#include "ash/ash_export.h"
#include "ash/bluetooth_devices_observer.h"
#include "ash/keyboard/ui/keyboard_layout_delegate.h"
#include "ash/public/cpp/keyboard/keyboard_controller_observer.h"
#include "ash/session/session_observer.h"
#include "ash/wm/tablet_mode/tablet_mode_observer.h"
......@@ -26,7 +25,6 @@ namespace ash {
class ASH_EXPORT VirtualKeyboardController
: public TabletModeObserver,
public ui::InputDeviceEventObserver,
public keyboard::KeyboardLayoutDelegate,
public KeyboardControllerObserver,
public SessionObserver {
public:
......@@ -48,11 +46,6 @@ class ASH_EXPORT VirtualKeyboardController
// when determining whether or not to show the on-screen keyboard.
void ToggleIgnoreExternalKeyboard();
// keyboard::KeyboardLayoutDelegate:
aura::Window* GetContainerForDefaultDisplay() override;
aura::Window* GetContainerForDisplay(
const display::Display& display) override;
// KeyboardControllerObserver:
void OnKeyboardEnabledChanged(bool is_enabled) override;
void OnKeyboardHidden(bool is_temporary_hide) override;
......
......@@ -21,7 +21,6 @@
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h"
#include "base/command_line.h"
#include "ui/display/test/display_manager_test_api.h"
#include "ui/events/devices/device_data_manager_test_api.h"
#include "ui/events/devices/input_device.h"
#include "ui/events/devices/touchscreen_device.h"
......@@ -51,21 +50,6 @@ class VirtualKeyboardControllerTest : public AshTestBase {
return Shell::Get()->display_manager()->GetSecondaryDisplay();
}
aura::Window* GetPrimaryRootWindow() { return Shell::GetPrimaryRootWindow(); }
aura::Window* GetSecondaryRootWindow() {
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
return root_windows[0] == GetPrimaryRootWindow() ? root_windows[1]
: root_windows[0];
}
void CreateFocusedTestWindowInRootWindow(aura::Window* root_window) {
// Owned by |root_window|.
aura::Window* focusable_window =
CreateTestWindowInShellWithBounds(root_window->GetBoundsInScreen());
focusable_window->Focus();
}
keyboard::KeyboardController* keyboard_controller() {
return keyboard::KeyboardController::Get();
}
......@@ -434,157 +418,4 @@ TEST_F(VirtualKeyboardControllerAlwaysEnabledTest, DoesNotSuppressKeyboard) {
EXPECT_TRUE(keyboard_controller()->IsEnabled());
}
// Test for http://crbug.com/297858. |GetContainerForDefaultDisplay| should
// return the primary display if no display has touch capability and
// no window is focused.
TEST_F(VirtualKeyboardControllerAlwaysEnabledTest,
DefaultContainerInPrimaryDisplayWhenNoDisplayHasTouch) {
UpdateDisplay("500x500,500x500");
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
EXPECT_EQ(GetPrimaryRootWindow(), GetVirtualKeyboardController()
->GetContainerForDefaultDisplay()
->GetRootWindow());
}
// Test for http://crbug.com/297858. |GetContainerForDefaultDisplay| should
// move keyboard to focused display if no display has touch capability.
TEST_F(VirtualKeyboardControllerAlwaysEnabledTest,
DefaultContainerIsInFocusedDisplayWhenNoDisplayHasTouch) {
UpdateDisplay("500x500,500x500");
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
CreateFocusedTestWindowInRootWindow(GetSecondaryRootWindow());
EXPECT_EQ(GetSecondaryRootWindow(), GetVirtualKeyboardController()
->GetContainerForDefaultDisplay()
->GetRootWindow());
}
// Test for http://crbug.com/303429. |GetContainerForDefaultDisplay| should
// move keyboard to first touchable display when there is one.
TEST_F(VirtualKeyboardControllerAlwaysEnabledTest,
DefaultContainerIsInFirstTouchableDisplay) {
UpdateDisplay("500x500,500x500");
// Make secondary display touchable.
display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.SetTouchSupport(GetSecondaryDisplay().id(),
display::Display::TouchSupport::AVAILABLE);
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_EQ(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
EXPECT_EQ(GetSecondaryRootWindow(), GetVirtualKeyboardController()
->GetContainerForDefaultDisplay()
->GetRootWindow());
}
// Test for http://crbug.com/303429. |GetContainerForDefaultDisplay| should
// move keyboard to first touchable display when the focused display is not
// touchable.
TEST_F(
VirtualKeyboardControllerAlwaysEnabledTest,
DefaultContainerIsInFirstTouchableDisplayIfFocusedDisplayIsNotTouchable) {
UpdateDisplay("500x500,500x500");
// Make secondary display touchable.
display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.SetTouchSupport(GetSecondaryDisplay().id(),
display::Display::TouchSupport::AVAILABLE);
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_EQ(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
// Focus on primary display.
CreateFocusedTestWindowInRootWindow(GetPrimaryRootWindow());
EXPECT_EQ(GetSecondaryRootWindow(), GetVirtualKeyboardController()
->GetContainerForDefaultDisplay()
->GetRootWindow());
}
// Test for http://crbug.com/303429. |GetContainerForDefaultDisplay| should
// move keyborad to first touchable display when there is one.
TEST_F(VirtualKeyboardControllerAlwaysEnabledTest,
DefaultContainerIsInFocusedDisplayIfTouchable) {
UpdateDisplay("500x500,500x500");
// Make both displays touchable.
display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.SetTouchSupport(GetPrimaryDisplay().id(),
display::Display::TouchSupport::AVAILABLE);
display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.SetTouchSupport(GetSecondaryDisplay().id(),
display::Display::TouchSupport::AVAILABLE);
EXPECT_EQ(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_EQ(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
// Focus on secondary display.
CreateFocusedTestWindowInRootWindow(GetSecondaryRootWindow());
EXPECT_EQ(GetSecondaryRootWindow(), GetVirtualKeyboardController()
->GetContainerForDefaultDisplay()
->GetRootWindow());
// Focus on primary display.
CreateFocusedTestWindowInRootWindow(GetPrimaryRootWindow());
EXPECT_EQ(GetPrimaryRootWindow(), GetVirtualKeyboardController()
->GetContainerForDefaultDisplay()
->GetRootWindow());
}
// Test for http://crbug.com/303429. |GetContainerForDisplay| should move
// keyboard to specified display even when it's not touchable.
TEST_F(VirtualKeyboardControllerAlwaysEnabledTest, GetContainerForDisplay) {
UpdateDisplay("500x500,500x500");
// Make primary display touchable.
display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.SetTouchSupport(GetPrimaryDisplay().id(),
display::Display::TouchSupport::AVAILABLE);
EXPECT_EQ(display::Display::TouchSupport::AVAILABLE,
GetPrimaryDisplay().touch_support());
EXPECT_NE(display::Display::TouchSupport::AVAILABLE,
GetSecondaryDisplay().touch_support());
// Move to primary display.
EXPECT_EQ(GetPrimaryRootWindow(),
GetVirtualKeyboardController()
->GetContainerForDisplay(GetPrimaryDisplay())
->GetRootWindow());
// Move to secondary display.
EXPECT_EQ(GetSecondaryRootWindow(),
GetVirtualKeyboardController()
->GetContainerForDisplay(GetSecondaryDisplay())
->GetRootWindow());
}
// Test for https://crbug.com/897007.
TEST_F(VirtualKeyboardControllerAlwaysEnabledTest,
ShowKeyboardInSecondaryDisplay) {
UpdateDisplay("500x500,500x500");
// Show in secondary display.
keyboard_controller()->ShowKeyboardInDisplay(GetSecondaryDisplay());
EXPECT_EQ(GetSecondaryRootWindow(), keyboard_controller()->GetRootWindow());
ASSERT_TRUE(keyboard::WaitUntilShown());
EXPECT_TRUE(!keyboard_controller()->GetKeyboardWindow()->bounds().IsEmpty());
}
} // namespace ash
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment