Chromium Code Reviews| Index: ash/wm/workspace/workspace_layout_manager_unittest.cc |
| diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc |
| index a5fa688c4cd009eb53c4fb7b106738ae61a952d5..5c81eb8cc1aca340836fcc589d59650cc14ffa26 100644 |
| --- a/ash/wm/workspace/workspace_layout_manager_unittest.cc |
| +++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc |
| @@ -1034,6 +1034,56 @@ class FakeTextInputClient : public ui::DummyTextInputClient { |
| DISALLOW_COPY_AND_ASSIGN(FakeTextInputClient); |
| }; |
| +TEST_F(WorkspaceLayoutManagerKeyboardTest, ChildWindowFocused) { |
|
flackr
2014/08/25 20:06:51
nit: Add a description, i.e.:
Tests that when a ch
rsadam
2014/08/26 14:36:49
Done.
|
| + gfx::Rect work_area( |
| + Shell::GetScreen()->GetPrimaryDisplay().work_area()); |
| + gfx::Rect keyboard_bounds(work_area.x(), |
| + work_area.y() + work_area.height() / 2, |
| + work_area.width(), |
| + work_area.height() / 2); |
| + |
| + SetKeyboardBounds(keyboard_bounds); |
| + |
| + aura::test::TestWindowDelegate delegate1; |
| + scoped_ptr<aura::Window> parent_window(CreateTestWindowInShellWithDelegate( |
| + &delegate1, -1, work_area)); |
| + aura::test::TestWindowDelegate delegate2; |
| + scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( |
| + &delegate2, -1, work_area)); |
| + parent_window->AddChild(window.get()); |
| + |
| + aura::Window* root_window = ash::Shell::GetInstance()->GetPrimaryRootWindow(); |
| + FakeTextInputClient text_input_client(window.get()); |
| + ui::InputMethod* input_method = |
| + root_window->GetProperty(aura::client::kRootWindowInputMethodKey); |
| + if (switches::IsTextInputFocusManagerEnabled()) { |
| + ui::TextInputFocusManager::GetInstance()->FocusTextInputClient( |
| + &text_input_client); |
| + } else { |
| + input_method->SetFocusedTextInputClient(&text_input_client); |
| + } |
|
flackr
2014/08/25 20:06:51
Can you make methods in WorkspaceLayoutManagerKeyb
rsadam
2014/08/26 14:36:49
Done.
|
| + |
| + int available_height = |
| + Shell::GetScreen()->GetPrimaryDisplay().bounds().height() - |
| + keyboard_bounds.height(); |
| + |
| + gfx::Rect small_window_bound(50, 50, 100, 500); |
|
flackr
2014/08/25 20:06:51
nit: s/small_window_bound/initial_window_bounds
rsadam
2014/08/26 14:36:49
Done.
|
| + parent_window->SetBounds(small_window_bound); |
| + EXPECT_EQ(small_window_bound.ToString(), parent_window->bounds().ToString()); |
| + ShowKeyboard(); |
| + EXPECT_EQ(gfx::Rect(50, 0, 100, available_height).ToString(), |
| + parent_window->bounds().ToString()); |
| + HideKeyboard(); |
| + EXPECT_EQ(small_window_bound.ToString(), parent_window->bounds().ToString()); |
| + |
| + if (switches::IsTextInputFocusManagerEnabled()) { |
| + ui::TextInputFocusManager::GetInstance()->BlurTextInputClient( |
| + &text_input_client); |
| + } else { |
| + input_method->SetFocusedTextInputClient(NULL); |
| + } |
| +} |
| + |
| TEST_F(WorkspaceLayoutManagerKeyboardTest, AdjustWindowForA11yKeyboard) { |
| gfx::Rect work_area( |
| Shell::GetScreen()->GetPrimaryDisplay().work_area()); |