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

Side by Side Diff: ui/keyboard/keyboard_controller_unittest.cc

Issue 1050713002: aura: Remove layerless windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layerless: rebase Created 5 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
« no previous file with comments | « ui/keyboard/keyboard_controller.cc ('k') | ui/views/controls/native/native_view_host_aura.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 (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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 ~TestKeyboardControllerProxy() override { 89 ~TestKeyboardControllerProxy() override {
90 // Destroy the window before the delegate. 90 // Destroy the window before the delegate.
91 window_.reset(); 91 window_.reset();
92 } 92 }
93 93
94 // Overridden from KeyboardControllerProxy: 94 // Overridden from KeyboardControllerProxy:
95 bool HasKeyboardWindow() const override { return window_; } 95 bool HasKeyboardWindow() const override { return window_; }
96 aura::Window* GetKeyboardWindow() override { 96 aura::Window* GetKeyboardWindow() override {
97 if (!window_) { 97 if (!window_) {
98 window_.reset(new aura::Window(&delegate_)); 98 window_.reset(new aura::Window(&delegate_));
99 window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); 99 window_->Init(ui::LAYER_NOT_DRAWN);
100 window_->set_owned_by_parent(false); 100 window_->set_owned_by_parent(false);
101 } 101 }
102 return window_.get(); 102 return window_.get();
103 } 103 }
104 ui::InputMethod* GetInputMethod() override { return input_method_.get(); } 104 ui::InputMethod* GetInputMethod() override { return input_method_.get(); }
105 void RequestAudioInput( 105 void RequestAudioInput(
106 content::WebContents* web_contents, 106 content::WebContents* web_contents,
107 const content::MediaStreamRequest& request, 107 const content::MediaStreamRequest& request,
108 const content::MediaResponseCallback& callback) override { 108 const content::MediaResponseCallback& callback) override {
109 return; 109 return;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // The above call should resize keyboard to new width while keeping the old 263 // The above call should resize keyboard to new width while keeping the old
264 // height. 264 // height.
265 ASSERT_EQ(gfx::Rect(0, 150, 100, 50), keyboard->bounds()); 265 ASSERT_EQ(gfx::Rect(0, 150, 100, 50), keyboard->bounds());
266 } 266 }
267 267
268 // Tests that tapping/clicking inside the keyboard does not give it focus. 268 // Tests that tapping/clicking inside the keyboard does not give it focus.
269 TEST_F(KeyboardControllerTest, ClickDoesNotFocusKeyboard) { 269 TEST_F(KeyboardControllerTest, ClickDoesNotFocusKeyboard) {
270 const gfx::Rect& root_bounds = root_window()->bounds(); 270 const gfx::Rect& root_bounds = root_window()->bounds();
271 aura::test::EventCountDelegate delegate; 271 aura::test::EventCountDelegate delegate;
272 scoped_ptr<aura::Window> window(new aura::Window(&delegate)); 272 scoped_ptr<aura::Window> window(new aura::Window(&delegate));
273 window->Init(aura::WINDOW_LAYER_NOT_DRAWN); 273 window->Init(ui::LAYER_NOT_DRAWN);
274 window->SetBounds(root_bounds); 274 window->SetBounds(root_bounds);
275 root_window()->AddChild(window.get()); 275 root_window()->AddChild(window.get());
276 window->Show(); 276 window->Show();
277 window->Focus(); 277 window->Focus();
278 278
279 aura::Window* keyboard_container(controller()->GetContainerWindow()); 279 aura::Window* keyboard_container(controller()->GetContainerWindow());
280 keyboard_container->SetBounds(root_bounds); 280 keyboard_container->SetBounds(root_bounds);
281 281
282 root_window()->AddChild(keyboard_container); 282 root_window()->AddChild(keyboard_container);
283 keyboard_container->Show(); 283 keyboard_container->Show();
(...skipping 23 matching lines...) Expand all
307 generator.MoveMouseTo(gfx::Point()); 307 generator.MoveMouseTo(gfx::Point());
308 generator.ClickLeftButton(); 308 generator.ClickLeftButton();
309 EXPECT_EQ("1 1", delegate.GetMouseButtonCountsAndReset()); 309 EXPECT_EQ("1 1", delegate.GetMouseButtonCountsAndReset());
310 keyboard_container->RemovePreTargetHandler(&observer); 310 keyboard_container->RemovePreTargetHandler(&observer);
311 } 311 }
312 312
313 TEST_F(KeyboardControllerTest, EventHitTestingInContainer) { 313 TEST_F(KeyboardControllerTest, EventHitTestingInContainer) {
314 const gfx::Rect& root_bounds = root_window()->bounds(); 314 const gfx::Rect& root_bounds = root_window()->bounds();
315 aura::test::EventCountDelegate delegate; 315 aura::test::EventCountDelegate delegate;
316 scoped_ptr<aura::Window> window(new aura::Window(&delegate)); 316 scoped_ptr<aura::Window> window(new aura::Window(&delegate));
317 window->Init(aura::WINDOW_LAYER_NOT_DRAWN); 317 window->Init(ui::LAYER_NOT_DRAWN);
318 window->SetBounds(root_bounds); 318 window->SetBounds(root_bounds);
319 root_window()->AddChild(window.get()); 319 root_window()->AddChild(window.get());
320 window->Show(); 320 window->Show();
321 window->Focus(); 321 window->Focus();
322 322
323 aura::Window* keyboard_container(controller()->GetContainerWindow()); 323 aura::Window* keyboard_container(controller()->GetContainerWindow());
324 keyboard_container->SetBounds(root_bounds); 324 keyboard_container->SetBounds(root_bounds);
325 325
326 root_window()->AddChild(keyboard_container); 326 root_window()->AddChild(keyboard_container);
327 keyboard_container->Show(); 327 keyboard_container->Show();
(...skipping 17 matching lines...) Expand all
345 location.set_y(keyboard_window->bounds().y() - 5); 345 location.set_y(keyboard_window->bounds().y() - 5);
346 ui::MouseEvent mouse2(ui::ET_MOUSE_MOVED, location, location, 346 ui::MouseEvent mouse2(ui::ET_MOUSE_MOVED, location, location,
347 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 347 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
348 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root, &mouse2)); 348 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root, &mouse2));
349 } 349 }
350 350
351 TEST_F(KeyboardControllerTest, KeyboardWindowCreation) { 351 TEST_F(KeyboardControllerTest, KeyboardWindowCreation) {
352 const gfx::Rect& root_bounds = root_window()->bounds(); 352 const gfx::Rect& root_bounds = root_window()->bounds();
353 aura::test::EventCountDelegate delegate; 353 aura::test::EventCountDelegate delegate;
354 scoped_ptr<aura::Window> window(new aura::Window(&delegate)); 354 scoped_ptr<aura::Window> window(new aura::Window(&delegate));
355 window->Init(aura::WINDOW_LAYER_NOT_DRAWN); 355 window->Init(ui::LAYER_NOT_DRAWN);
356 window->SetBounds(root_bounds); 356 window->SetBounds(root_bounds);
357 root_window()->AddChild(window.get()); 357 root_window()->AddChild(window.get());
358 window->Show(); 358 window->Show();
359 window->Focus(); 359 window->Focus();
360 360
361 aura::Window* keyboard_container(controller()->GetContainerWindow()); 361 aura::Window* keyboard_container(controller()->GetContainerWindow());
362 keyboard_container->SetBounds(root_bounds); 362 keyboard_container->SetBounds(root_bounds);
363 363
364 root_window()->AddChild(keyboard_container); 364 root_window()->AddChild(keyboard_container);
365 keyboard_container->Show(); 365 keyboard_container->Show();
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 // Before hide animation finishes, show keyboard again. 593 // Before hide animation finishes, show keyboard again.
594 ShowKeyboard(); 594 ShowKeyboard();
595 RunAnimationForLayer(layer); 595 RunAnimationForLayer(layer);
596 EXPECT_TRUE(keyboard_container()->IsVisible()); 596 EXPECT_TRUE(keyboard_container()->IsVisible());
597 EXPECT_TRUE(keyboard_window()->IsVisible()); 597 EXPECT_TRUE(keyboard_window()->IsVisible());
598 EXPECT_EQ(1.0, layer->opacity()); 598 EXPECT_EQ(1.0, layer->opacity());
599 EXPECT_EQ(gfx::Transform(), layer->transform()); 599 EXPECT_EQ(gfx::Transform(), layer->transform());
600 } 600 }
601 601
602 } // namespace keyboard 602 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/keyboard/keyboard_controller.cc ('k') | ui/views/controls/native/native_view_host_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698