Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: ash/wm/always_on_top_controller_unittest.cc

Issue 2629643002: chromeos: Renames WmWindowAura to WmWindow (Closed)
Patch Set: unnecessary casts Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/common/wm/always_on_top_controller.h" 5 #include "ash/common/wm/always_on_top_controller.h"
6 6
7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/wm/workspace/workspace_layout_manager.h" 7 #include "ash/common/wm/workspace/workspace_layout_manager.h"
8 #include "ash/common/wm_window.h"
9 #include "ash/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "ui/keyboard/keyboard_controller.h" 15 #include "ui/keyboard/keyboard_controller.h"
16 #include "ui/keyboard/keyboard_switches.h" 16 #include "ui/keyboard/keyboard_switches.h"
17 #include "ui/keyboard/keyboard_ui.h" 17 #include "ui/keyboard/keyboard_ui.h"
18 #include "ui/keyboard/keyboard_util.h" 18 #include "ui/keyboard/keyboard_util.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // Verifies that the always on top controller is notified of keyboard bounds 57 // Verifies that the always on top controller is notified of keyboard bounds
58 // changing events. 58 // changing events.
59 TEST_F(VirtualKeyboardAlwaysOnTopControllerTest, NotifyKeyboardBoundsChanged) { 59 TEST_F(VirtualKeyboardAlwaysOnTopControllerTest, NotifyKeyboardBoundsChanged) {
60 keyboard::KeyboardController* keyboard_controller = 60 keyboard::KeyboardController* keyboard_controller =
61 keyboard::KeyboardController::GetInstance(); 61 keyboard::KeyboardController::GetInstance();
62 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 62 aura::Window* root_window = Shell::GetPrimaryRootWindow();
63 aura::Window* always_on_top_container = 63 aura::Window* always_on_top_container =
64 Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer); 64 Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer);
65 // Install test layout manager. 65 // Install test layout manager.
66 TestLayoutManager* manager = 66 TestLayoutManager* manager =
67 new TestLayoutManager(WmWindowAura::Get(always_on_top_container)); 67 new TestLayoutManager(WmWindow::Get(always_on_top_container));
68 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); 68 RootWindowController* controller = Shell::GetPrimaryRootWindowController();
69 AlwaysOnTopController* always_on_top_controller = 69 AlwaysOnTopController* always_on_top_controller =
70 controller->always_on_top_controller(); 70 controller->always_on_top_controller();
71 always_on_top_controller->SetLayoutManagerForTest(base::WrapUnique(manager)); 71 always_on_top_controller->SetLayoutManagerForTest(base::WrapUnique(manager));
72 // Activate keyboard. This triggers keyboard listeners to be registered. 72 // Activate keyboard. This triggers keyboard listeners to be registered.
73 controller->ActivateKeyboard(keyboard_controller); 73 controller->ActivateKeyboard(keyboard_controller);
74 74
75 // Mock a keyboard appearing. 75 // Mock a keyboard appearing.
76 aura::Window* keyboard_container = 76 aura::Window* keyboard_container =
77 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 77 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
78 ASSERT_TRUE(keyboard_container); 78 ASSERT_TRUE(keyboard_container);
79 keyboard_container->Show(); 79 keyboard_container->Show();
80 aura::Window* keyboard_window = 80 aura::Window* keyboard_window =
81 keyboard_controller->ui()->GetKeyboardWindow(); 81 keyboard_controller->ui()->GetKeyboardWindow();
82 keyboard_container->AddChild(keyboard_window); 82 keyboard_container->AddChild(keyboard_window);
83 keyboard_window->set_owned_by_parent(false); 83 keyboard_window->set_owned_by_parent(false);
84 const int kKeyboardHeight = 200; 84 const int kKeyboardHeight = 200;
85 gfx::Rect keyboard_bounds = keyboard::FullWidthKeyboardBoundsFromRootBounds( 85 gfx::Rect keyboard_bounds = keyboard::FullWidthKeyboardBoundsFromRootBounds(
86 root_window->bounds(), kKeyboardHeight); 86 root_window->bounds(), kKeyboardHeight);
87 keyboard_window->SetBounds(keyboard_bounds); 87 keyboard_window->SetBounds(keyboard_bounds);
88 keyboard_window->Show(); 88 keyboard_window->Show();
89 keyboard_controller->NotifyKeyboardBoundsChanging(keyboard_bounds); 89 keyboard_controller->NotifyKeyboardBoundsChanging(keyboard_bounds);
90 // Verify that test manager was notified of bounds change. 90 // Verify that test manager was notified of bounds change.
91 ASSERT_TRUE(manager->keyboard_bounds_changed()); 91 ASSERT_TRUE(manager->keyboard_bounds_changed());
92 } 92 }
93 93
94 } // namespace test 94 } // namespace test
95 } // namespace ash 95 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698