OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/keyboard/keyboard_controller.h" | 5 #include "ui/keyboard/keyboard_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 aura::Window* keyboard(proxy()->GetKeyboardWindow()); | 267 aura::Window* keyboard(proxy()->GetKeyboardWindow()); |
268 gfx::Rect screen_bounds = root_window()->bounds(); | 268 gfx::Rect screen_bounds = root_window()->bounds(); |
269 root_window()->AddChild(container); | 269 root_window()->AddChild(container); |
270 container->AddChild(keyboard); | 270 container->AddChild(keyboard); |
271 const gfx::Rect& initial_bounds = container->bounds(); | 271 const gfx::Rect& initial_bounds = container->bounds(); |
272 // The container should be positioned at the bottom of screen and has 0 | 272 // The container should be positioned at the bottom of screen and has 0 |
273 // height. | 273 // height. |
274 ASSERT_EQ(gfx::Rect(), initial_bounds); | 274 ASSERT_EQ(gfx::Rect(), initial_bounds); |
275 VerifyKeyboardWindowSize(container, keyboard); | 275 VerifyKeyboardWindowSize(container, keyboard); |
276 | 276 |
277 gfx::Rect new_bounds(0, 0, 50, 50); | |
278 | 277 |
279 // In FULL_WIDTH mode, attempt to change window width or move window up from | 278 // In FULL_WIDTH mode, attempt to change window width or move window up from |
280 // the bottom are ignored. Changing window height is supported. | 279 // the bottom are ignored. Changing window height is supported. |
281 gfx::Rect expected_bounds(0, | 280 gfx::Rect expected_bounds(0, |
282 screen_bounds.height() - 50, | 281 screen_bounds.height() - 50, |
283 screen_bounds.width(), | 282 screen_bounds.width(), |
284 50); | 283 50); |
285 | 284 |
| 285 // The x position of new bounds may not be 0 if shelf is on the left side of |
| 286 // screen. In FULL_WIDTH mode, the virtual keyboard should always align with |
| 287 // the left edge of screen. See http://crbug.com/510595. |
| 288 gfx::Rect new_bounds(10, 0, 50, 50); |
286 keyboard->SetBounds(new_bounds); | 289 keyboard->SetBounds(new_bounds); |
287 ASSERT_EQ(expected_bounds, container->bounds()); | 290 ASSERT_EQ(expected_bounds, container->bounds()); |
288 VerifyKeyboardWindowSize(container, keyboard); | 291 VerifyKeyboardWindowSize(container, keyboard); |
289 | 292 |
290 MockRotateScreen(); | 293 MockRotateScreen(); |
291 // The above call should resize keyboard to new width while keeping the old | 294 // The above call should resize keyboard to new width while keeping the old |
292 // height. | 295 // height. |
293 ASSERT_EQ(gfx::Rect(0, | 296 ASSERT_EQ(gfx::Rect(0, |
294 screen_bounds.width() - 50, | 297 screen_bounds.width() - 50, |
295 screen_bounds.height(), | 298 screen_bounds.height(), |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 // Before hide animation finishes, show keyboard again. | 607 // Before hide animation finishes, show keyboard again. |
605 ShowKeyboard(); | 608 ShowKeyboard(); |
606 RunAnimationForLayer(layer); | 609 RunAnimationForLayer(layer); |
607 EXPECT_TRUE(keyboard_container()->IsVisible()); | 610 EXPECT_TRUE(keyboard_container()->IsVisible()); |
608 EXPECT_TRUE(keyboard_window()->IsVisible()); | 611 EXPECT_TRUE(keyboard_window()->IsVisible()); |
609 EXPECT_EQ(1.0, layer->opacity()); | 612 EXPECT_EQ(1.0, layer->opacity()); |
610 EXPECT_EQ(gfx::Transform(), layer->transform()); | 613 EXPECT_EQ(gfx::Transform(), layer->transform()); |
611 } | 614 } |
612 | 615 |
613 } // namespace keyboard | 616 } // namespace keyboard |
OLD | NEW |