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

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

Issue 2620153003: Folds WmRootWindowController into RootWindowController (Closed)
Patch Set: merge 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
« no previous file with comments | « ash/test/ash_test_base.cc ('k') | ash/wm/panels/panel_layout_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/wm/workspace/workspace_layout_manager.h" 8 #include "ash/common/wm/workspace/workspace_layout_manager.h"
9 #include "ash/common/wm_root_window_controller.h"
10 #include "ash/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
11 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
12 #include "ash/shell.h" 11 #include "ash/shell.h"
13 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
14 #include "base/command_line.h" 13 #include "base/command_line.h"
15 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
16 #include "ui/keyboard/keyboard_controller.h" 15 #include "ui/keyboard/keyboard_controller.h"
17 #include "ui/keyboard/keyboard_switches.h" 16 #include "ui/keyboard/keyboard_switches.h"
18 #include "ui/keyboard/keyboard_ui.h" 17 #include "ui/keyboard/keyboard_ui.h"
19 #include "ui/keyboard/keyboard_util.h" 18 #include "ui/keyboard/keyboard_util.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 keyboard::KeyboardController* keyboard_controller = 60 keyboard::KeyboardController* keyboard_controller =
62 keyboard::KeyboardController::GetInstance(); 61 keyboard::KeyboardController::GetInstance();
63 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 62 aura::Window* root_window = Shell::GetPrimaryRootWindow();
64 aura::Window* always_on_top_container = 63 aura::Window* always_on_top_container =
65 Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer); 64 Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer);
66 // Install test layout manager. 65 // Install test layout manager.
67 TestLayoutManager* manager = 66 TestLayoutManager* manager =
68 new TestLayoutManager(WmWindowAura::Get(always_on_top_container)); 67 new TestLayoutManager(WmWindowAura::Get(always_on_top_container));
69 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); 68 RootWindowController* controller = Shell::GetPrimaryRootWindowController();
70 AlwaysOnTopController* always_on_top_controller = 69 AlwaysOnTopController* always_on_top_controller =
71 controller->wm_root_window_controller()->always_on_top_controller(); 70 controller->always_on_top_controller();
72 always_on_top_controller->SetLayoutManagerForTest(base::WrapUnique(manager)); 71 always_on_top_controller->SetLayoutManagerForTest(base::WrapUnique(manager));
73 // Activate keyboard. This triggers keyboard listeners to be registered. 72 // Activate keyboard. This triggers keyboard listeners to be registered.
74 controller->ActivateKeyboard(keyboard_controller); 73 controller->ActivateKeyboard(keyboard_controller);
75 74
76 // Mock a keyboard appearing. 75 // Mock a keyboard appearing.
77 aura::Window* keyboard_container = 76 aura::Window* keyboard_container =
78 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 77 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
79 ASSERT_TRUE(keyboard_container); 78 ASSERT_TRUE(keyboard_container);
80 keyboard_container->Show(); 79 keyboard_container->Show();
81 aura::Window* keyboard_window = 80 aura::Window* keyboard_window =
82 keyboard_controller->ui()->GetKeyboardWindow(); 81 keyboard_controller->ui()->GetKeyboardWindow();
83 keyboard_container->AddChild(keyboard_window); 82 keyboard_container->AddChild(keyboard_window);
84 keyboard_window->set_owned_by_parent(false); 83 keyboard_window->set_owned_by_parent(false);
85 const int kKeyboardHeight = 200; 84 const int kKeyboardHeight = 200;
86 gfx::Rect keyboard_bounds = keyboard::FullWidthKeyboardBoundsFromRootBounds( 85 gfx::Rect keyboard_bounds = keyboard::FullWidthKeyboardBoundsFromRootBounds(
87 root_window->bounds(), kKeyboardHeight); 86 root_window->bounds(), kKeyboardHeight);
88 keyboard_window->SetBounds(keyboard_bounds); 87 keyboard_window->SetBounds(keyboard_bounds);
89 keyboard_window->Show(); 88 keyboard_window->Show();
90 keyboard_controller->NotifyKeyboardBoundsChanging(keyboard_bounds); 89 keyboard_controller->NotifyKeyboardBoundsChanging(keyboard_bounds);
91 // Verify that test manager was notified of bounds change. 90 // Verify that test manager was notified of bounds change.
92 ASSERT_TRUE(manager->keyboard_bounds_changed()); 91 ASSERT_TRUE(manager->keyboard_bounds_changed());
93 } 92 }
94 93
95 } // namespace test 94 } // namespace test
96 } // namespace ash 95 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_base.cc ('k') | ash/wm/panels/panel_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698