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

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

Issue 240443006: Remove native VK window height logic and wait for resizeTo to setup VK window height (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
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/system_modal_container_layout_manager.h" 5 #include "ash/wm/system_modal_container_layout_manager.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/session_state_delegate.h" 8 #include "ash/session_state_delegate.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 DISALLOW_COPY_AND_ASSIGN(TransientWindowObserver); 143 DISALLOW_COPY_AND_ASSIGN(TransientWindowObserver);
144 }; 144 };
145 145
146 } // namespace 146 } // namespace
147 147
148 class SystemModalContainerLayoutManagerTest : public AshTestBase { 148 class SystemModalContainerLayoutManagerTest : public AshTestBase {
149 public: 149 public:
150 virtual void SetUp() OVERRIDE { 150 virtual void SetUp() OVERRIDE {
151 // Allow a virtual keyboard (and initialize it per default). 151 // Allow a virtual keyboard (and initialize it per default).
152 CommandLine::ForCurrentProcess()->AppendSwitch( 152 CommandLine::ForCurrentProcess()->AppendSwitch(
153 keyboard::switches::kEnableVirtualKeyboard); 153 keyboard::switches::kEnableVirtualKeyboard);
154 AshTestBase::SetUp(); 154 AshTestBase::SetUp();
155 Shell::GetPrimaryRootWindowController()->ActivateKeyboard( 155 Shell::GetPrimaryRootWindowController()->ActivateKeyboard(
156 keyboard::KeyboardController::GetInstance()); 156 keyboard::KeyboardController::GetInstance());
157 } 157 }
158 158
159 virtual void TearDown() OVERRIDE { 159 virtual void TearDown() OVERRIDE {
160 Shell::GetPrimaryRootWindowController()->DeactivateKeyboard( 160 Shell::GetPrimaryRootWindowController()->DeactivateKeyboard(
161 keyboard::KeyboardController::GetInstance()); 161 keyboard::KeyboardController::GetInstance());
162 AshTestBase::TearDown(); 162 AshTestBase::TearDown();
163 } 163 }
(...skipping 16 matching lines...) Expand all
180 void ShowKeyboard(bool show) { 180 void ShowKeyboard(bool show) {
181 keyboard::KeyboardController* keyboard = 181 keyboard::KeyboardController* keyboard =
182 keyboard::KeyboardController::GetInstance(); 182 keyboard::KeyboardController::GetInstance();
183 ASSERT_TRUE(keyboard); 183 ASSERT_TRUE(keyboard);
184 if (show == keyboard->keyboard_visible()) 184 if (show == keyboard->keyboard_visible())
185 return; 185 return;
186 186
187 // The animation has to run in order to get the notification. Run the 187 // The animation has to run in order to get the notification. Run the
188 // animation and wait until its finished. 188 // animation and wait until its finished.
189 ui::ScopedAnimationDurationScaleMode normal_duration_mode( 189 ui::ScopedAnimationDurationScaleMode normal_duration_mode(
190 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); 190 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
pkotwicz 2014/04/23 15:18:42 [Optional Nit]: You may be able to remove the need
bshe 2014/04/23 16:07:12 Done.
191 if (show) 191 if (show) {
192 keyboard->ShowAndLockKeyboard(); 192 keyboard->ShowKeyboard(true);
193 else 193 if (keyboard->proxy()->GetKeyboardWindow()->bounds().height() == 0) {
194 gfx::Rect window_bounds = keyboard->GetContainerWindow()->bounds();
195 keyboard->proxy()->GetKeyboardWindow()->SetBounds(gfx::Rect(
196 window_bounds.x(),
197 window_bounds.y() + window_bounds.height() - 100,
pkotwicz 2014/04/23 15:18:42 Nit: You can use window_bounds.bottom() here
bshe 2014/04/23 16:07:12 Done.
198 window_bounds.width(),
199 100));
200 }
201 } else {
194 keyboard->HideKeyboard(keyboard::KeyboardController::HIDE_REASON_MANUAL); 202 keyboard->HideKeyboard(keyboard::KeyboardController::HIDE_REASON_MANUAL);
203 }
195 204
196 WaitForWindowAnimationToBeFinished(keyboard->GetContainerWindow()); 205 WaitForWindowAnimationToBeFinished(keyboard->GetContainerWindow());
197 206
198 DCHECK_EQ(show, keyboard->keyboard_visible()); 207 DCHECK_EQ(show, keyboard->keyboard_visible());
199 } 208 }
200 209
201 void WaitForWindowAnimationToBeFinished(aura::Window* window) { 210 void WaitForWindowAnimationToBeFinished(aura::Window* window) {
202 DCHECK(window); 211 DCHECK(window);
203 ui::Layer* layer = window->layer(); 212 ui::Layer* layer = window->layer();
204 ui::LayerAnimatorTestController controller(layer->GetAnimator()); 213 ui::LayerAnimatorTestController controller(layer->GetAnimator());
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 589
581 // After the keyboard is gone, the window will remain where it was. 590 // After the keyboard is gone, the window will remain where it was.
582 ShowKeyboard(false); 591 ShowKeyboard(false);
583 EXPECT_NE(modal_bounds.ToString(), modal_window->bounds().ToString()); 592 EXPECT_NE(modal_bounds.ToString(), modal_window->bounds().ToString());
584 EXPECT_EQ(modal_size.ToString(), modal_window->bounds().size().ToString()); 593 EXPECT_EQ(modal_size.ToString(), modal_window->bounds().size().ToString());
585 EXPECT_EQ(modal_origin.x(), modal_window->bounds().x()); 594 EXPECT_EQ(modal_origin.x(), modal_window->bounds().x());
586 } 595 }
587 596
588 } // namespace test 597 } // namespace test
589 } // namespace ash 598 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc ('k') | ui/keyboard/keyboard_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698