OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/display/display_layout.h" | 9 #include "ash/display/display_layout.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1027 virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE { | 1027 virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE { |
1028 return window_; | 1028 return window_; |
1029 } | 1029 } |
1030 | 1030 |
1031 private: | 1031 private: |
1032 gfx::NativeWindow window_; | 1032 gfx::NativeWindow window_; |
1033 | 1033 |
1034 DISALLOW_COPY_AND_ASSIGN(FakeTextInputClient); | 1034 DISALLOW_COPY_AND_ASSIGN(FakeTextInputClient); |
1035 }; | 1035 }; |
1036 | 1036 |
1037 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.
| |
1038 gfx::Rect work_area( | |
1039 Shell::GetScreen()->GetPrimaryDisplay().work_area()); | |
1040 gfx::Rect keyboard_bounds(work_area.x(), | |
1041 work_area.y() + work_area.height() / 2, | |
1042 work_area.width(), | |
1043 work_area.height() / 2); | |
1044 | |
1045 SetKeyboardBounds(keyboard_bounds); | |
1046 | |
1047 aura::test::TestWindowDelegate delegate1; | |
1048 scoped_ptr<aura::Window> parent_window(CreateTestWindowInShellWithDelegate( | |
1049 &delegate1, -1, work_area)); | |
1050 aura::test::TestWindowDelegate delegate2; | |
1051 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( | |
1052 &delegate2, -1, work_area)); | |
1053 parent_window->AddChild(window.get()); | |
1054 | |
1055 aura::Window* root_window = ash::Shell::GetInstance()->GetPrimaryRootWindow(); | |
1056 FakeTextInputClient text_input_client(window.get()); | |
1057 ui::InputMethod* input_method = | |
1058 root_window->GetProperty(aura::client::kRootWindowInputMethodKey); | |
1059 if (switches::IsTextInputFocusManagerEnabled()) { | |
1060 ui::TextInputFocusManager::GetInstance()->FocusTextInputClient( | |
1061 &text_input_client); | |
1062 } else { | |
1063 input_method->SetFocusedTextInputClient(&text_input_client); | |
1064 } | |
flackr
2014/08/25 20:06:51
Can you make methods in WorkspaceLayoutManagerKeyb
rsadam
2014/08/26 14:36:49
Done.
| |
1065 | |
1066 int available_height = | |
1067 Shell::GetScreen()->GetPrimaryDisplay().bounds().height() - | |
1068 keyboard_bounds.height(); | |
1069 | |
1070 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.
| |
1071 parent_window->SetBounds(small_window_bound); | |
1072 EXPECT_EQ(small_window_bound.ToString(), parent_window->bounds().ToString()); | |
1073 ShowKeyboard(); | |
1074 EXPECT_EQ(gfx::Rect(50, 0, 100, available_height).ToString(), | |
1075 parent_window->bounds().ToString()); | |
1076 HideKeyboard(); | |
1077 EXPECT_EQ(small_window_bound.ToString(), parent_window->bounds().ToString()); | |
1078 | |
1079 if (switches::IsTextInputFocusManagerEnabled()) { | |
1080 ui::TextInputFocusManager::GetInstance()->BlurTextInputClient( | |
1081 &text_input_client); | |
1082 } else { | |
1083 input_method->SetFocusedTextInputClient(NULL); | |
1084 } | |
1085 } | |
1086 | |
1037 TEST_F(WorkspaceLayoutManagerKeyboardTest, AdjustWindowForA11yKeyboard) { | 1087 TEST_F(WorkspaceLayoutManagerKeyboardTest, AdjustWindowForA11yKeyboard) { |
1038 gfx::Rect work_area( | 1088 gfx::Rect work_area( |
1039 Shell::GetScreen()->GetPrimaryDisplay().work_area()); | 1089 Shell::GetScreen()->GetPrimaryDisplay().work_area()); |
1040 gfx::Rect keyboard_bounds(work_area.x(), | 1090 gfx::Rect keyboard_bounds(work_area.x(), |
1041 work_area.y() + work_area.height() / 2, | 1091 work_area.y() + work_area.height() / 2, |
1042 work_area.width(), | 1092 work_area.width(), |
1043 work_area.height() / 2); | 1093 work_area.height() / 2); |
1044 | 1094 |
1045 SetKeyboardBounds(keyboard_bounds); | 1095 SetKeyboardBounds(keyboard_bounds); |
1046 | 1096 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1082 | 1132 |
1083 if (switches::IsTextInputFocusManagerEnabled()) { | 1133 if (switches::IsTextInputFocusManagerEnabled()) { |
1084 ui::TextInputFocusManager::GetInstance()->BlurTextInputClient( | 1134 ui::TextInputFocusManager::GetInstance()->BlurTextInputClient( |
1085 &text_input_client); | 1135 &text_input_client); |
1086 } else { | 1136 } else { |
1087 input_method->SetFocusedTextInputClient(NULL); | 1137 input_method->SetFocusedTextInputClient(NULL); |
1088 } | 1138 } |
1089 } | 1139 } |
1090 | 1140 |
1091 } // namespace ash | 1141 } // namespace ash |
OLD | NEW |