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

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

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase Created 3 years, 9 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/common/wm/workspace/workspace_layout_manager.h" 7 #include "ash/common/wm/workspace/workspace_layout_manager.h"
8 #include "ash/common/wm_window.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"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(WmWindow::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 // Deactivates keyboard to unregister existing listeners.
70 controller->DeactivateKeyboard(keyboard_controller);
69 AlwaysOnTopController* always_on_top_controller = 71 AlwaysOnTopController* always_on_top_controller =
70 controller->always_on_top_controller(); 72 controller->always_on_top_controller();
71 always_on_top_controller->SetLayoutManagerForTest(base::WrapUnique(manager)); 73 always_on_top_controller->SetLayoutManagerForTest(base::WrapUnique(manager));
72 // Activate keyboard. This triggers keyboard listeners to be registered. 74 // Activate keyboard. This triggers keyboard listeners to be registered.
73 controller->ActivateKeyboard(keyboard_controller); 75 controller->ActivateKeyboard(keyboard_controller);
74 76
75 // Mock a keyboard appearing. 77 // Mock a keyboard appearing.
76 aura::Window* keyboard_container = 78 aura::Window* keyboard_container =
77 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 79 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
78 ASSERT_TRUE(keyboard_container); 80 ASSERT_TRUE(keyboard_container);
79 keyboard_container->Show(); 81 keyboard_container->Show();
80 aura::Window* keyboard_window = 82 aura::Window* keyboard_window =
81 keyboard_controller->ui()->GetKeyboardWindow(); 83 keyboard_controller->ui()->GetKeyboardWindow();
82 keyboard_container->AddChild(keyboard_window); 84 keyboard_container->AddChild(keyboard_window);
83 keyboard_window->set_owned_by_parent(false); 85 keyboard_window->set_owned_by_parent(false);
84 const int kKeyboardHeight = 200; 86 const int kKeyboardHeight = 200;
85 gfx::Rect keyboard_bounds = keyboard::FullWidthKeyboardBoundsFromRootBounds( 87 gfx::Rect keyboard_bounds = keyboard::FullWidthKeyboardBoundsFromRootBounds(
86 root_window->bounds(), kKeyboardHeight); 88 root_window->bounds(), kKeyboardHeight);
87 keyboard_window->SetBounds(keyboard_bounds); 89 keyboard_window->SetBounds(keyboard_bounds);
88 keyboard_window->Show(); 90 keyboard_window->Show();
89 keyboard_controller->NotifyKeyboardBoundsChanging(keyboard_bounds); 91 keyboard_controller->NotifyKeyboardBoundsChanging(keyboard_bounds);
90 // Verify that test manager was notified of bounds change. 92 // Verify that test manager was notified of bounds change.
91 ASSERT_TRUE(manager->keyboard_bounds_changed()); 93 ASSERT_TRUE(manager->keyboard_bounds_changed());
92 } 94 }
93 95
94 } // namespace test 96 } // namespace test
95 } // namespace ash 97 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698