0

Move keyboard test util methods into test namespace

Bug: None
Change-Id: I2d15352112d12d3e680df11436ddce32e90400de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5659439
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Commit-Queue: Jaewon Jung <jw.jung@navercorp.com>
Reviewed-by: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1321245}
This commit is contained in:
Jaewon Jung
2024-06-28 23:13:43 +00:00
committed by Chromium LUCI CQ
parent addaa509ca
commit c740009cd9
28 changed files with 77 additions and 77 deletions

@@ -343,7 +343,7 @@ TEST_P(AppListControllerImplTest, VirtualKeyboardNotShownWhenUserStartsTyping) {
// The keyboard should get shown if the user taps on the search box. // The keyboard should get shown if the user taps on the search box.
GestureTapOn(GetAppListView()->search_box_view()); GestureTapOn(GetAppListView()->search_box_view());
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
DismissAppListNow(); DismissAppListNow();
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
@@ -440,11 +440,11 @@ TEST_P(AppListControllerImplTest,
// Tap at the textfield in |window1|. The virtual keyboard should be visible. // Tap at the textfield in |window1|. The virtual keyboard should be visible.
GestureTapOn(text_field_p); GestureTapOn(text_field_p);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// Tap at the center of |window2| to hide the virtual keyboard. // Tap at the center of |window2| to hide the virtual keyboard.
GetEventGenerator()->GestureTapAt(window2->GetBoundsInScreen().CenterPoint()); GetEventGenerator()->GestureTapAt(window2->GetBoundsInScreen().CenterPoint());
ASSERT_TRUE(keyboard::WaitUntilHidden()); ASSERT_TRUE(keyboard::test::WaitUntilHidden());
// Press the home button to show the launcher. Wait for the animation of // Press the home button to show the launcher. Wait for the animation of
// launcher to finish. Note that the launcher does not exist before toggling // launcher to finish. Note that the launcher does not exist before toggling

@@ -2276,7 +2276,7 @@ TEST_P(AppListBubbleAndTabletTest,
auto* const keyboard_ui_controller = keyboard::KeyboardUIController::Get(); auto* const keyboard_ui_controller = keyboard::KeyboardUIController::Get();
keyboard_ui_controller->ShowKeyboard(false /* locked */); keyboard_ui_controller->ShowKeyboard(false /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// Show remove suggestion dialog. // Show remove suggestion dialog.
result_view->GetWidget()->LayoutRootViewIfNecessary(); result_view->GetWidget()->LayoutRootViewIfNecessary();
@@ -3360,7 +3360,7 @@ TEST_P(PopulatedAppListWithVKEnabledTest,
// Manually show the virtual keyboard. // Manually show the virtual keyboard.
auto* const keyboard_controller = keyboard::KeyboardUIController::Get(); auto* const keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboard(true /* locked */); keyboard_controller->ShowKeyboard(true /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// Touch the apps_grid outside of any apps. Expect that the keyboard is // Touch the apps_grid outside of any apps. Expect that the keyboard is
// closed. // closed.
@@ -3369,7 +3369,7 @@ TEST_P(PopulatedAppListWithVKEnabledTest,
// Reshow the VKeyboard // Reshow the VKeyboard
keyboard_controller->ShowKeyboard(true); keyboard_controller->ShowKeyboard(true);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// Touch the apps_grid between two apps. Expect that the keyboard is closed. // Touch the apps_grid between two apps. Expect that the keyboard is closed.
GetEventGenerator()->GestureTapAt(between_apps); GetEventGenerator()->GestureTapAt(between_apps);
@@ -4604,7 +4604,7 @@ TEST_P(AppListPresenterVirtualKeyboardTest,
// Manually show the virtual keyboard. // Manually show the virtual keyboard.
auto* const keyboard_controller = keyboard::KeyboardUIController::Get(); auto* const keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboard(true); keyboard_controller->ShowKeyboard(true);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// Tap or click outside the searchbox, the virtual keyboard should hide. // Tap or click outside the searchbox, the virtual keyboard should hide.
ClickOrTap(GetPointOutsideSearchbox()); ClickOrTap(GetPointOutsideSearchbox());
@@ -4638,7 +4638,7 @@ TEST_P(AppListPresenterVirtualKeyboardTest,
// Manually show the virtual keyboard. // Manually show the virtual keyboard.
auto* const keyboard_controller = keyboard::KeyboardUIController::Get(); auto* const keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboard(true); keyboard_controller->ShowKeyboard(true);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// Tap or click outside the searchbox, the virtual keyboard should hide and // Tap or click outside the searchbox, the virtual keyboard should hide and
// the searchbox should be inactive when there is no text in the searchbox. // the searchbox should be inactive when there is no text in the searchbox.

@@ -6504,7 +6504,7 @@ TEST_P(AppsGridViewTabletTest, ChangeFolderNameShouldUpdateShadows) {
// and shadow bounds. // and shadow bounds.
auto* keyboard_controller = keyboard::KeyboardUIController::Get(); auto* keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboard(false); keyboard_controller->ShowKeyboard(false);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
gfx::Rect folder_bounds_with_keyboard = gfx::Rect folder_bounds_with_keyboard =
folder_apps_grid_view()->GetBoundsInScreen(); folder_apps_grid_view()->GetBoundsInScreen();

@@ -345,7 +345,8 @@ void AssistantAshTestBase::DismissKeyboard() {
bool AssistantAshTestBase::IsKeyboardShowing() const { bool AssistantAshTestBase::IsKeyboardShowing() const {
auto* keyboard_controller = keyboard::KeyboardUIController::Get(); auto* keyboard_controller = keyboard::KeyboardUIController::Get();
return keyboard_controller->IsEnabled() && keyboard::IsKeyboardShowing(); return keyboard_controller->IsEnabled() &&
keyboard::test::IsKeyboardShowing();
} }
TestAssistantService* AssistantAshTestBase::assistant_service() { TestAssistantService* AssistantAshTestBase::assistant_service() {

@@ -515,7 +515,7 @@ TEST_F(KeyboardControllerImplTest, VisualBoundsInMultipleDisplays) {
keyboard_ui_controller()->ShowKeyboardInDisplay( keyboard_ui_controller()->ShowKeyboardInDisplay(
display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.GetSecondaryDisplay()); .GetSecondaryDisplay());
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
gfx::Rect root_bounds = keyboard_ui_controller()->visual_bounds_in_root(); gfx::Rect root_bounds = keyboard_ui_controller()->visual_bounds_in_root();
EXPECT_EQ(0, root_bounds.x()); EXPECT_EQ(0, root_bounds.x());
@@ -533,7 +533,7 @@ TEST_F(KeyboardControllerImplTest, OccludedBoundsInMultipleDisplays) {
keyboard_ui_controller()->ShowKeyboardInDisplay( keyboard_ui_controller()->ShowKeyboardInDisplay(
display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) display::test::DisplayManagerTestApi(Shell::Get()->display_manager())
.GetSecondaryDisplay()); .GetSecondaryDisplay());
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
gfx::Rect screen_bounds = gfx::Rect screen_bounds =
keyboard_ui_controller()->GetWorkspaceOccludedBoundsInScreen(); keyboard_ui_controller()->GetWorkspaceOccludedBoundsInScreen();
@@ -690,7 +690,7 @@ TEST_F(KeyboardControllerImplTest, ShowKeyboardInSecondaryDisplay) {
keyboard_ui_controller()->ShowKeyboardInDisplay(GetSecondaryDisplay()); keyboard_ui_controller()->ShowKeyboardInDisplay(GetSecondaryDisplay());
EXPECT_EQ(GetSecondaryRootWindow(), EXPECT_EQ(GetSecondaryRootWindow(),
keyboard_ui_controller()->GetRootWindow()); keyboard_ui_controller()->GetRootWindow());
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
EXPECT_TRUE( EXPECT_TRUE(
!keyboard_ui_controller()->GetKeyboardWindow()->bounds().IsEmpty()); !keyboard_ui_controller()->GetKeyboardWindow()->bounds().IsEmpty());
} }
@@ -705,7 +705,7 @@ TEST_F(KeyboardControllerImplTest, SwipeUpToShowHotSeat) {
keyboard_controller()->SetEnableFlag(KeyboardEnableFlag::kExtensionEnabled); keyboard_controller()->SetEnableFlag(KeyboardEnableFlag::kExtensionEnabled);
keyboard_ui_controller()->ShowKeyboard(/* lock */ false); keyboard_ui_controller()->ShowKeyboard(/* lock */ false);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
gfx::Rect display_bounds = gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
@@ -717,7 +717,7 @@ TEST_F(KeyboardControllerImplTest, SwipeUpToShowHotSeat) {
num_scroll_steps); num_scroll_steps);
// Keyboard should hide and gesture should forward to the shelf. // Keyboard should hide and gesture should forward to the shelf.
ASSERT_TRUE(keyboard::WaitUntilHidden()); ASSERT_TRUE(keyboard::test::WaitUntilHidden());
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state()); EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
} }
@@ -731,7 +731,7 @@ TEST_F(KeyboardControllerImplTest, FlingUpToShowOverviewMode) {
keyboard_controller()->SetEnableFlag(KeyboardEnableFlag::kExtensionEnabled); keyboard_controller()->SetEnableFlag(KeyboardEnableFlag::kExtensionEnabled);
keyboard_ui_controller()->ShowKeyboard(/* lock */ false); keyboard_ui_controller()->ShowKeyboard(/* lock */ false);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
gfx::Rect display_bounds = gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
@@ -747,7 +747,7 @@ TEST_F(KeyboardControllerImplTest, FlingUpToShowOverviewMode) {
scroll_steps); scroll_steps);
// Keyboard should hide and gesture should forward to the shelf. // Keyboard should hide and gesture should forward to the shelf.
ASSERT_TRUE(keyboard::WaitUntilHidden()); ASSERT_TRUE(keyboard::test::WaitUntilHidden());
EXPECT_EQ(HotseatState::kShownHomeLauncher, EXPECT_EQ(HotseatState::kShownHomeLauncher,
GetShelfLayoutManager()->hotseat_state()); GetShelfLayoutManager()->hotseat_state());
} }
@@ -760,7 +760,7 @@ TEST_F(KeyboardControllerImplTest, SwipeUpDoesntHideKeyboardInClamshellMode) {
keyboard_controller()->SetEnableFlag(KeyboardEnableFlag::kExtensionEnabled); keyboard_controller()->SetEnableFlag(KeyboardEnableFlag::kExtensionEnabled);
keyboard_ui_controller()->ShowKeyboard(/* lock */ false); keyboard_ui_controller()->ShowKeyboard(/* lock */ false);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
gfx::Rect display_bounds = gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
@@ -771,7 +771,7 @@ TEST_F(KeyboardControllerImplTest, SwipeUpDoesntHideKeyboardInClamshellMode) {
GetEventGenerator()->GestureScrollSequence(start, end, time_delta, GetEventGenerator()->GestureScrollSequence(start, end, time_delta,
num_scroll_steps); num_scroll_steps);
EXPECT_FALSE(keyboard::IsKeyboardHiding()); EXPECT_FALSE(keyboard::test::IsKeyboardHiding());
} }
TEST_F(KeyboardControllerImplTest, RecordsKeyRepeatSettings) { TEST_F(KeyboardControllerImplTest, RecordsKeyRepeatSettings) {

@@ -25,7 +25,7 @@ aura::Window* TestKeyboardUI::LoadKeyboardWindow(LoadCallback callback) {
// Set a default size for the keyboard. // Set a default size for the keyboard.
display::Screen* screen = display::Screen::GetScreen(); display::Screen* screen = display::Screen::GetScreen();
keyboard_window_->SetBounds(keyboard::KeyboardBoundsFromRootBounds( keyboard_window_->SetBounds(keyboard::test::KeyboardBoundsFromRootBounds(
screen->GetPrimaryDisplay().bounds())); screen->GetPrimaryDisplay().bounds()));
// Simulate an asynchronous load. // Simulate an asynchronous load.

@@ -239,7 +239,7 @@ class KeyboardUIControllerTest : public aura::test::AuraTestBase,
if (client && client->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE && if (client && client->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE &&
client->GetTextInputMode() != ui::TEXT_INPUT_MODE_NONE) { client->GetTextInputMode() != ui::TEXT_INPUT_MODE_NONE) {
input_method->SetVirtualKeyboardVisibilityIfEnabled(true); input_method->SetVirtualKeyboardVisibilityIfEnabled(true);
ASSERT_TRUE(WaitUntilShown()); ASSERT_TRUE(test::WaitUntilShown());
} }
} }

@@ -65,8 +65,6 @@ bool WaitUntilLoaded() {
return true; return true;
} }
} // namespace test
bool WaitUntilShown() { bool WaitUntilShown() {
// KeyboardController send a visibility update once the show animation // KeyboardController send a visibility update once the show animation
// finishes. // finishes.
@@ -103,4 +101,6 @@ gfx::Rect KeyboardBoundsFromRootBounds(const gfx::Rect& root_bounds,
root_bounds.width(), keyboard_height); root_bounds.width(), keyboard_height);
} }
} // namespace test
} // namespace keyboard } // namespace keyboard

@@ -13,14 +13,11 @@ class Rect;
namespace keyboard { namespace keyboard {
// TODO(shend): Move other methods into test namespace.
namespace test { namespace test {
// Waits until the keyboard window finishes loading. // Waits until the keyboard window finishes loading.
bool WaitUntilLoaded(); bool WaitUntilLoaded();
} // namespace test
// Waits until the keyboard is fully shown, with no pending animations. // Waits until the keyboard is fully shown, with no pending animations.
bool WaitUntilShown(); bool WaitUntilShown();
@@ -38,6 +35,8 @@ bool IsKeyboardHiding();
gfx::Rect KeyboardBoundsFromRootBounds(const gfx::Rect& root_bounds, gfx::Rect KeyboardBoundsFromRootBounds(const gfx::Rect& root_bounds,
int keyboard_height = 100); int keyboard_height = 100);
} // namespace test
} // namespace keyboard } // namespace keyboard
#endif // ASH_KEYBOARD_UI_TEST_KEYBOARD_TEST_UTIL_H_ #endif // ASH_KEYBOARD_UI_TEST_KEYBOARD_TEST_UTIL_H_

@@ -43,7 +43,7 @@ aura::Window* TestKeyboardUIFactory::TestKeyboardUI::LoadKeyboardWindow(
// Set a default size for the keyboard. // Set a default size for the keyboard.
display::Screen* screen = display::Screen::GetScreen(); display::Screen* screen = display::Screen::GetScreen();
window_->SetBounds( window_->SetBounds(
KeyboardBoundsFromRootBounds(screen->GetPrimaryDisplay().bounds())); test::KeyboardBoundsFromRootBounds(screen->GetPrimaryDisplay().bounds()));
// Simulate an asynchronous load. // Simulate an asynchronous load.
base::SequencedTaskRunner::GetCurrentDefault()->PostTask(FROM_HERE, base::SequencedTaskRunner::GetCurrentDefault()->PostTask(FROM_HERE,

@@ -44,7 +44,7 @@ TEST_F(VirtualKeyboardTest, EventsAreHandledBasedOnHitTestBounds) {
auto* keyboard_controller = keyboard::KeyboardUIController::Get(); auto* keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboard(false); keyboard_controller->ShowKeyboard(false);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// Add two hit test bounds (coordinates relative to keyboard window). // Add two hit test bounds (coordinates relative to keyboard window).
// Both are 10x10 squares, but placed in different locations. // Both are 10x10 squares, but placed in different locations.
@@ -94,7 +94,7 @@ TEST_F(VirtualKeyboardTest, HitTestBoundsAreResetWhenContainerTypeChanges) {
auto* keyboard_controller = keyboard::KeyboardUIController::Get(); auto* keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboard(false); keyboard_controller->ShowKeyboard(false);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// Set empty hit test bounds, so all events pass through to the background. // Set empty hit test bounds, so all events pass through to the background.
keyboard_controller->SetHitTestBounds(std::vector<gfx::Rect>()); keyboard_controller->SetHitTestBounds(std::vector<gfx::Rect>());

@@ -37,9 +37,9 @@ void LoginKeyboardTestBase::ShowKeyboard() {
// lock/login layout. // lock/login layout.
int height = Shell::GetPrimaryRootWindow()->bounds().height() / 2; int height = Shell::GetPrimaryRootWindow()->bounds().height() / 2;
keyboard_controller->GetKeyboardWindow()->SetBounds( keyboard_controller->GetKeyboardWindow()->SetBounds(
keyboard::KeyboardBoundsFromRootBounds( keyboard::test::KeyboardBoundsFromRootBounds(
Shell::GetPrimaryRootWindow()->bounds(), height)); Shell::GetPrimaryRootWindow()->bounds(), height));
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
} }
void LoginKeyboardTestBase::HideKeyboard() { void LoginKeyboardTestBase::HideKeyboard() {

@@ -822,7 +822,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) {
auto* controller = keyboard::KeyboardUIController::Get(); auto* controller = keyboard::KeyboardUIController::Get();
aura::Window* contents_window = controller->GetKeyboardWindow(); aura::Window* contents_window = controller->GetKeyboardWindow();
contents_window->SetBounds( contents_window->SetBounds(
keyboard::KeyboardBoundsFromRootBounds(root_window->bounds(), 100)); keyboard::test::KeyboardBoundsFromRootBounds(root_window->bounds(), 100));
contents_window->Show(); contents_window->Show();
gfx::Rect before = gfx::Rect before =
@@ -850,7 +850,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) {
ASSERT_EQ(root_window, controller->GetRootWindow()); ASSERT_EQ(root_window, controller->GetRootWindow());
controller->ShowKeyboard(false /* locked */); controller->ShowKeyboard(false /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
ui::test::TestEventHandler handler; ui::test::TestEventHandler handler;
root_window->AddPreTargetHandler(&handler); root_window->AddPreTargetHandler(&handler);
@@ -891,7 +891,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, EnsureCaretInWorkArea) {
const int keyboard_height = 100; const int keyboard_height = 100;
aura::Window* contents_window = keyboard_controller->GetKeyboardWindow(); aura::Window* contents_window = keyboard_controller->GetKeyboardWindow();
contents_window->SetBounds(keyboard::KeyboardBoundsFromRootBounds( contents_window->SetBounds(keyboard::test::KeyboardBoundsFromRootBounds(
root_window->bounds(), keyboard_height)); root_window->bounds(), keyboard_height));
contents_window->Show(); contents_window->Show();
@@ -927,7 +927,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest,
// Check that the keyboard on the primary screen doesn't cover the window on // Check that the keyboard on the primary screen doesn't cover the window on
// the secondary screen. // the secondary screen.
aura::Window* contents_window = keyboard_controller->GetKeyboardWindow(); aura::Window* contents_window = keyboard_controller->GetKeyboardWindow();
contents_window->SetBounds(keyboard::KeyboardBoundsFromRootBounds( contents_window->SetBounds(keyboard::test::KeyboardBoundsFromRootBounds(
primary_root_window->bounds(), keyboard_height)); primary_root_window->bounds(), keyboard_height));
contents_window->Show(); contents_window->Show();
@@ -942,7 +942,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest,
// Move the keyboard into the secondary display and check that the keyboard // Move the keyboard into the secondary display and check that the keyboard
// doesn't cover the window on the primary screen. // doesn't cover the window on the primary screen.
keyboard_controller->ShowKeyboardInDisplay(GetSecondaryDisplay()); keyboard_controller->ShowKeyboardInDisplay(GetSecondaryDisplay());
contents_window->SetBounds(keyboard::KeyboardBoundsFromRootBounds( contents_window->SetBounds(keyboard::test::KeyboardBoundsFromRootBounds(
secondary_root_window->bounds(), keyboard_height)); secondary_root_window->bounds(), keyboard_height));
EnsureCaretInWorkArea(contents_window->GetBoundsInScreen()); EnsureCaretInWorkArea(contents_window->GetBoundsInScreen());
@@ -967,7 +967,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, ZOrderTest) {
const int keyboard_height = 200; const int keyboard_height = 200;
aura::Window* contents_window = keyboard_controller->GetKeyboardWindow(); aura::Window* contents_window = keyboard_controller->GetKeyboardWindow();
gfx::Rect keyboard_bounds = keyboard::KeyboardBoundsFromRootBounds( gfx::Rect keyboard_bounds = keyboard::test::KeyboardBoundsFromRootBounds(
root_window->bounds(), keyboard_height); root_window->bounds(), keyboard_height);
contents_window->SetBounds(keyboard_bounds); contents_window->SetBounds(keyboard_bounds);
contents_window->Show(); contents_window->Show();
@@ -1085,7 +1085,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, ClickDoesNotFocusKeyboard) {
auto* keyboard_controller = keyboard::KeyboardUIController::Get(); auto* keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboard(false); keyboard_controller->ShowKeyboard(false);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow(); aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow();
EXPECT_FALSE(keyboard_window->HasFocus()); EXPECT_FALSE(keyboard_window->HasFocus());

@@ -1188,7 +1188,7 @@ class ShelfWidgetVirtualKeyboardTest : public AshTestBase {
TEST_F(ShelfWidgetVirtualKeyboardTest, ClickingHidesVirtualKeyboard) { TEST_F(ShelfWidgetVirtualKeyboardTest, ClickingHidesVirtualKeyboard) {
keyboard_ui_controller()->ShowKeyboard(false /* locked */); keyboard_ui_controller()->ShowKeyboard(false /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
ui::test::EventGenerator* generator = GetEventGenerator(); ui::test::EventGenerator* generator = GetEventGenerator();
generator->set_current_screen_location( generator->set_current_screen_location(
@@ -1196,12 +1196,12 @@ TEST_F(ShelfWidgetVirtualKeyboardTest, ClickingHidesVirtualKeyboard) {
generator->ClickLeftButton(); generator->ClickLeftButton();
// Times out if test fails. // Times out if test fails.
ASSERT_TRUE(keyboard::WaitUntilHidden()); ASSERT_TRUE(keyboard::test::WaitUntilHidden());
} }
TEST_F(ShelfWidgetVirtualKeyboardTest, TappingHidesVirtualKeyboard) { TEST_F(ShelfWidgetVirtualKeyboardTest, TappingHidesVirtualKeyboard) {
keyboard_ui_controller()->ShowKeyboard(false /* locked */); keyboard_ui_controller()->ShowKeyboard(false /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
ui::test::EventGenerator* generator = GetEventGenerator(); ui::test::EventGenerator* generator = GetEventGenerator();
generator->set_current_screen_location( generator->set_current_screen_location(
@@ -1209,22 +1209,22 @@ TEST_F(ShelfWidgetVirtualKeyboardTest, TappingHidesVirtualKeyboard) {
generator->PressTouch(); generator->PressTouch();
// Times out if test fails. // Times out if test fails.
ASSERT_TRUE(keyboard::WaitUntilHidden()); ASSERT_TRUE(keyboard::test::WaitUntilHidden());
} }
TEST_F(ShelfWidgetVirtualKeyboardTest, DoesNotHideLockedVirtualKeyboard) { TEST_F(ShelfWidgetVirtualKeyboardTest, DoesNotHideLockedVirtualKeyboard) {
keyboard_ui_controller()->ShowKeyboard(true /* locked */); keyboard_ui_controller()->ShowKeyboard(true /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
ui::test::EventGenerator* generator = GetEventGenerator(); ui::test::EventGenerator* generator = GetEventGenerator();
generator->set_current_screen_location( generator->set_current_screen_location(
GetShelfWidget()->GetWindowBoundsInScreen().CenterPoint()); GetShelfWidget()->GetWindowBoundsInScreen().CenterPoint());
generator->ClickLeftButton(); generator->ClickLeftButton();
EXPECT_FALSE(keyboard::IsKeyboardHiding()); EXPECT_FALSE(keyboard::test::IsKeyboardHiding());
generator->PressTouch(); generator->PressTouch();
EXPECT_FALSE(keyboard::IsKeyboardHiding()); EXPECT_FALSE(keyboard::test::IsKeyboardHiding());
} }
} // namespace } // namespace

@@ -545,7 +545,7 @@ TEST_F(EcheTrayTest, EcheTrayKeyboardShowHideUpdateBubbleBounds) {
// Place a keyboard window. // Place a keyboard window.
auto* keyboard_controller = keyboard::KeyboardUIController::Get(); auto* keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboard(/*lock=*/true); keyboard_controller->ShowKeyboard(/*lock=*/true);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
EXPECT_EQ(expected_eche_size.width(), EXPECT_EQ(expected_eche_size.width(),
eche_tray()->get_bubble_wrapper_for_test()->bubble_view()->width()); eche_tray()->get_bubble_wrapper_for_test()->bubble_view()->width());

@@ -447,7 +447,7 @@ TEST_F(StatusAreaWidgetVirtualKeyboardTest,
status->ime_menu_tray()->SetVisiblePreferred(true); status->ime_menu_tray()->SetVisiblePreferred(true);
keyboard_ui_controller()->ShowKeyboard(false /* locked */); keyboard_ui_controller()->ShowKeyboard(false /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// The keyboard should hide when clicked. // The keyboard should hide when clicked.
ui::test::EventGenerator* generator = GetEventGenerator(); ui::test::EventGenerator* generator = GetEventGenerator();
@@ -456,7 +456,7 @@ TEST_F(StatusAreaWidgetVirtualKeyboardTest,
->GetBoundsInScreen() ->GetBoundsInScreen()
.CenterPoint()); .CenterPoint());
generator->ClickLeftButton(); generator->ClickLeftButton();
ASSERT_TRUE(keyboard::WaitUntilHidden()); ASSERT_TRUE(keyboard::test::WaitUntilHidden());
} }
// See https://crbug.com/897672. // See https://crbug.com/897672.
@@ -468,14 +468,14 @@ TEST_F(StatusAreaWidgetVirtualKeyboardTest,
status->ime_menu_tray()->SetVisiblePreferred(true); status->ime_menu_tray()->SetVisiblePreferred(true);
keyboard_ui_controller()->ShowKeyboard(false /* locked */); keyboard_ui_controller()->ShowKeyboard(false /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// The keyboard should hide when tapped. // The keyboard should hide when tapped.
ui::test::EventGenerator* generator = GetEventGenerator(); ui::test::EventGenerator* generator = GetEventGenerator();
generator->GestureTapAt(status->virtual_keyboard_tray_for_testing() generator->GestureTapAt(status->virtual_keyboard_tray_for_testing()
->GetBoundsInScreen() ->GetBoundsInScreen()
.CenterPoint()); .CenterPoint());
ASSERT_TRUE(keyboard::WaitUntilHidden()); ASSERT_TRUE(keyboard::test::WaitUntilHidden());
} }
TEST_F(StatusAreaWidgetVirtualKeyboardTest, ClickingHidesVirtualKeyboard) { TEST_F(StatusAreaWidgetVirtualKeyboardTest, ClickingHidesVirtualKeyboard) {
@@ -490,12 +490,12 @@ TEST_F(StatusAreaWidgetVirtualKeyboardTest, ClickingHidesVirtualKeyboard) {
generator->ClickLeftButton(); generator->ClickLeftButton();
// Times out if test fails. // Times out if test fails.
ASSERT_TRUE(keyboard::WaitUntilHidden()); ASSERT_TRUE(keyboard::test::WaitUntilHidden());
} }
TEST_F(StatusAreaWidgetVirtualKeyboardTest, TappingHidesVirtualKeyboard) { TEST_F(StatusAreaWidgetVirtualKeyboardTest, TappingHidesVirtualKeyboard) {
keyboard_ui_controller()->ShowKeyboard(false /* locked */); keyboard_ui_controller()->ShowKeyboard(false /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
ui::test::EventGenerator* generator = GetEventGenerator(); ui::test::EventGenerator* generator = GetEventGenerator();
generator->set_current_screen_location( generator->set_current_screen_location(
@@ -505,12 +505,12 @@ TEST_F(StatusAreaWidgetVirtualKeyboardTest, TappingHidesVirtualKeyboard) {
generator->PressTouch(); generator->PressTouch();
// Times out if test fails. // Times out if test fails.
ASSERT_TRUE(keyboard::WaitUntilHidden()); ASSERT_TRUE(keyboard::test::WaitUntilHidden());
} }
TEST_F(StatusAreaWidgetVirtualKeyboardTest, DoesNotHideLockedVirtualKeyboard) { TEST_F(StatusAreaWidgetVirtualKeyboardTest, DoesNotHideLockedVirtualKeyboard) {
keyboard_ui_controller()->ShowKeyboard(true /* locked */); keyboard_ui_controller()->ShowKeyboard(true /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
ui::test::EventGenerator* generator = GetEventGenerator(); ui::test::EventGenerator* generator = GetEventGenerator();
generator->set_current_screen_location( generator->set_current_screen_location(
@@ -519,10 +519,10 @@ TEST_F(StatusAreaWidgetVirtualKeyboardTest, DoesNotHideLockedVirtualKeyboard) {
.CenterPoint()); .CenterPoint());
generator->ClickLeftButton(); generator->ClickLeftButton();
EXPECT_FALSE(keyboard::IsKeyboardHiding()); EXPECT_FALSE(keyboard::test::IsKeyboardHiding());
generator->PressTouch(); generator->PressTouch();
EXPECT_FALSE(keyboard::IsKeyboardHiding()); EXPECT_FALSE(keyboard::test::IsKeyboardHiding());
} }
class StatusAreaWidgetCollapseStateTest : public AshTestBase { class StatusAreaWidgetCollapseStateTest : public AshTestBase {

@@ -47,12 +47,12 @@ TEST_F(VirtualKeyboardTrayTest, PerformActionTogglesVirtualKeyboard) {
// First tap should show the virtual keyboard. // First tap should show the virtual keyboard.
GestureTapOn(tray); GestureTapOn(tray);
EXPECT_TRUE(tray->is_active()); EXPECT_TRUE(tray->is_active());
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// Second tap should hide the virtual keyboard. // Second tap should hide the virtual keyboard.
GestureTapOn(tray); GestureTapOn(tray);
EXPECT_FALSE(tray->is_active()); EXPECT_FALSE(tray->is_active());
ASSERT_TRUE(keyboard::WaitUntilHidden()); ASSERT_TRUE(keyboard::test::WaitUntilHidden());
} }
} // namespace ash } // namespace ash

@@ -83,7 +83,7 @@ TEST_F(AlwaysOnTopControllerTest, NotifyKeyboardBoundsChanging) {
EXPECT_FALSE(manager->keyboard_displacing_bounds_changed()); EXPECT_FALSE(manager->keyboard_displacing_bounds_changed());
keyboard_controller->ShowKeyboard(true /* locked */); keyboard_controller->ShowKeyboard(true /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
// Verify that test manager was notified of bounds change. // Verify that test manager was notified of bounds change.
EXPECT_TRUE(manager->keyboard_displacing_bounds_changed()); EXPECT_TRUE(manager->keyboard_displacing_bounds_changed());

@@ -209,7 +209,7 @@ TEST_P(CollisionDetectionUtilsDisplayTest,
MovementAreaIncludesKeyboardIfKeyboardIsShown) { MovementAreaIncludesKeyboardIfKeyboardIsShown) {
auto* keyboard_controller = keyboard::KeyboardUIController::Get(); auto* keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboardInDisplay(GetDisplay()); keyboard_controller->ShowKeyboardInDisplay(GetDisplay());
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow(); aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow();
constexpr int keyboard_height = 100; constexpr int keyboard_height = 100;
@@ -304,7 +304,7 @@ TEST_P(CollisionDetectionUtilsDisplayTest,
keyboard_controller->SetContainerType(keyboard::ContainerType::kFloating, keyboard_controller->SetContainerType(keyboard::ContainerType::kFloating,
gfx::Rect(), base::DoNothing()); gfx::Rect(), base::DoNothing());
keyboard_controller->ShowKeyboardInDisplay(display); keyboard_controller->ShowKeyboardInDisplay(display);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow(); aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow();
keyboard_window->SetBounds(gfx::Rect(0, 0, 100, 100)); keyboard_window->SetBounds(gfx::Rect(0, 0, 100, 100));
@@ -406,7 +406,7 @@ TEST_P(CollisionDetectionUtilsDisplayTest, GetRestingPositionAvoidsKeyboard) {
auto* keyboard_controller = keyboard::KeyboardUIController::Get(); auto* keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboardInDisplay(display); keyboard_controller->ShowKeyboardInDisplay(display);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow(); aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow();
constexpr int keyboard_height = 100; constexpr int keyboard_height = 100;

@@ -7798,7 +7798,7 @@ TEST_P(DesksTest, NameNudgesTabletMode) {
// created and the virtual keyboard should be shown. // created and the virtual keyboard should be shown.
ui::DeviceDataManagerTestApi().SetKeyboardDevices({}); ui::DeviceDataManagerTestApi().SetKeyboardDevices({});
GestureTapOnView(desks_bar_view->new_desk_button(), event_generator); GestureTapOnView(desks_bar_view->new_desk_button(), event_generator);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
EXPECT_TRUE(keyboard::KeyboardUIController::Get()->IsKeyboardVisible()); EXPECT_TRUE(keyboard::KeyboardUIController::Get()->IsKeyboardVisible());
EXPECT_EQ(4u, desks_bar_view->mini_views().size()); EXPECT_EQ(4u, desks_bar_view->mini_views().size());
desk_name_view = desks_bar_view->mini_views()[3]->desk_name_view(); desk_name_view = desks_bar_view->mini_views()[3]->desk_name_view();

@@ -136,7 +136,7 @@ class LockActionHandlerLayoutManagerTest : public AshTestBase {
if (show) { if (show) {
keyboard->ShowKeyboard(true); keyboard->ShowKeyboard(true);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
} else { } else {
keyboard->HideKeyboardByUser(); keyboard->HideKeyboardByUser();
} }

@@ -90,7 +90,7 @@ class LockLayoutManagerTest : public AshTestBase {
if (show) { if (show) {
keyboard->ShowKeyboard(false); keyboard->ShowKeyboard(false);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
} else { } else {
keyboard->HideKeyboardByUser(); keyboard->HideKeyboardByUser();
} }

@@ -769,7 +769,7 @@ class OverviewVirtualKeyboardTest : public OverviewControllerTest {
keyboard::test::WaitUntilLoaded(); keyboard::test::WaitUntilLoaded();
keyboard_ui_controller()->GetKeyboardWindow()->SetBounds( keyboard_ui_controller()->GetKeyboardWindow()->SetBounds(
keyboard::KeyboardBoundsFromRootBounds( keyboard::test::KeyboardBoundsFromRootBounds(
Shell::GetPrimaryRootWindow()->bounds(), 100)); Shell::GetPrimaryRootWindow()->bounds(), 100));
// Wait for keyboard window to load. // Wait for keyboard window to load.
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
@@ -782,21 +782,21 @@ class OverviewVirtualKeyboardTest : public OverviewControllerTest {
TEST_F(OverviewVirtualKeyboardTest, ToggleOverviewModeHidesVirtualKeyboard) { TEST_F(OverviewVirtualKeyboardTest, ToggleOverviewModeHidesVirtualKeyboard) {
keyboard_ui_controller()->ShowKeyboard(false /* locked */); keyboard_ui_controller()->ShowKeyboard(false /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
EnterOverview(); EnterOverview();
// Timeout failure here if the keyboard does not hide. // Timeout failure here if the keyboard does not hide.
keyboard::WaitUntilHidden(); keyboard::test::WaitUntilHidden();
} }
TEST_F(OverviewVirtualKeyboardTest, TEST_F(OverviewVirtualKeyboardTest,
ToggleOverviewModeDoesNotHideLockedVirtualKeyboard) { ToggleOverviewModeDoesNotHideLockedVirtualKeyboard) {
keyboard_ui_controller()->ShowKeyboard(true /* locked */); keyboard_ui_controller()->ShowKeyboard(true /* locked */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
EnterOverview(); EnterOverview();
EXPECT_FALSE(keyboard::IsKeyboardHiding()); EXPECT_FALSE(keyboard::test::IsKeyboardHiding());
} }
// Tests that frame throttling starts and ends accordingly when overview starts // Tests that frame throttling starts and ends accordingly when overview starts

@@ -159,7 +159,7 @@ TEST_F(PipTest, PipInitialPositionAvoidsObstacles) {
auto* keyboard_controller = keyboard::KeyboardUIController::Get(); auto* keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboard(/*lock=*/true); keyboard_controller->ShowKeyboard(/*lock=*/true);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow(); aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow();
keyboard_window->SetBounds(gfx::Rect(0, 300, 400, 100)); keyboard_window->SetBounds(gfx::Rect(0, 300, 400, 100));
@@ -175,7 +175,7 @@ TEST_F(PipTest, TargetBoundsAffectedByWorkAreaChange) {
// Place a keyboard window at the initial position of a PIP window. // Place a keyboard window at the initial position of a PIP window.
auto* keyboard_controller = keyboard::KeyboardUIController::Get(); auto* keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboard(/*lock=*/true); keyboard_controller->ShowKeyboard(/*lock=*/true);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow(); aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow();
keyboard_window->SetBounds(gfx::Rect(0, 300, 400, 100)); keyboard_window->SetBounds(gfx::Rect(0, 300, 400, 100));
@@ -308,7 +308,7 @@ TEST_F(PipTest, PipSnappedToEdgeWhenSavingSnapFraction) {
// edges. // edges.
auto* keyboard_controller = keyboard::KeyboardUIController::Get(); auto* keyboard_controller = keyboard::KeyboardUIController::Get();
keyboard_controller->ShowKeyboardInDisplay(window_state->GetDisplay()); keyboard_controller->ShowKeyboardInDisplay(window_state->GetDisplay());
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow(); aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow();
keyboard_window->SetBounds(gfx::Rect(0, 300, 400, 100)); keyboard_window->SetBounds(gfx::Rect(0, 300, 400, 100));

@@ -605,7 +605,7 @@ TEST_P(PipWindowResizerTest, PipWindowFlungAvoidsFloatingKeyboard) {
base::DoNothing()); base::DoNothing());
const display::Display display = WindowState::Get(window())->GetDisplay(); const display::Display display = WindowState::Get(window())->GetDisplay();
keyboard_controller->ShowKeyboardInDisplay(display); keyboard_controller->ShowKeyboardInDisplay(display);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow(); aura::Window* keyboard_window = keyboard_controller->GetKeyboardWindow();
keyboard_window->SetBounds(gfx::Rect(8, 150, 100, 100)); keyboard_window->SetBounds(gfx::Rect(8, 150, 100, 100));

@@ -171,7 +171,7 @@ class TestTextInputClient : public ui::DummyTextInputClient {
} }
ime->SetVirtualKeyboardVisibilityIfEnabled(true); ime->SetVirtualKeyboardVisibilityIfEnabled(true);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
} }
// When the text client is unfocused, hide the virtual keyboard. // When the text client is unfocused, hide the virtual keyboard.

@@ -173,7 +173,7 @@ class SystemModalContainerLayoutManagerTest : public AshTestBase {
if (show) { if (show) {
keyboard->ShowKeyboard(true /* lock */); keyboard->ShowKeyboard(true /* lock */);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
} else { } else {
keyboard->HideKeyboardByUser(); keyboard->HideKeyboardByUser();
} }

@@ -2249,7 +2249,7 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest,
// Open keyboard in sticky mode. // Open keyboard in sticky mode.
kb_controller->ShowKeyboard(true); kb_controller->ShowKeyboard(true);
ASSERT_TRUE(keyboard::WaitUntilShown()); ASSERT_TRUE(keyboard::test::WaitUntilShown());
int shift = int shift =
work_area.height() - kb_controller->GetKeyboardWindow()->bounds().y(); work_area.height() - kb_controller->GetKeyboardWindow()->bounds().y();