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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 25111002: Only show virtual keyboard on primary root window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a TODO Created 7 years, 2 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
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shell.h » ('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) 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/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include "ash/session_state_delegate.h" 7 #include "ash/session_state_delegate.h"
8 #include "ash/shelf/shelf_layout_manager.h" 8 #include "ash/shelf/shelf_layout_manager.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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 virtual void SetUp() OVERRIDE { 619 virtual void SetUp() OVERRIDE {
620 CommandLine::ForCurrentProcess()->AppendSwitch( 620 CommandLine::ForCurrentProcess()->AppendSwitch(
621 keyboard::switches::kEnableVirtualKeyboard); 621 keyboard::switches::kEnableVirtualKeyboard);
622 test::AshTestBase::SetUp(); 622 test::AshTestBase::SetUp();
623 } 623 }
624 624
625 private: 625 private:
626 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardRootWindowControllerTest); 626 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardRootWindowControllerTest);
627 }; 627 };
628 628
629 // Test for http://crbug.com/297858. Virtual keyboard container should only show
630 // on primary root window.
631 TEST_F(VirtualKeyboardRootWindowControllerTest,
632 VirtualKeyboardOnPrimaryRootWindowOnly) {
633 if (!SupportsMultipleDisplays())
634 return;
635
636 UpdateDisplay("500x500,500x500");
637
638 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
639 aura::RootWindow* primary_root_window = Shell::GetPrimaryRootWindow();
640 aura::RootWindow* secondary_root_window =
641 root_windows[0] == primary_root_window ?
642 root_windows[1] : root_windows[0];
643
644 ASSERT_TRUE(Shell::GetContainer(
645 primary_root_window,
646 internal::kShellWindowId_VirtualKeyboardContainer));
647 ASSERT_FALSE(Shell::GetContainer(
648 secondary_root_window,
649 internal::kShellWindowId_VirtualKeyboardContainer));
650 }
651
629 // Test for http://crbug.com/263599. Virtual keyboard should be able to receive 652 // Test for http://crbug.com/263599. Virtual keyboard should be able to receive
630 // events at blocked user session. 653 // events at blocked user session.
631 TEST_F(VirtualKeyboardRootWindowControllerTest, 654 TEST_F(VirtualKeyboardRootWindowControllerTest,
632 ClickVirtualKeyboardInBlockedWindow) { 655 ClickVirtualKeyboardInBlockedWindow) {
633 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); 656 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow();
634 aura::Window* keyboard_container = Shell::GetContainer(root_window, 657 aura::Window* keyboard_container = Shell::GetContainer(root_window,
635 internal::kShellWindowId_VirtualKeyboardContainer); 658 internal::kShellWindowId_VirtualKeyboardContainer);
636 ASSERT_TRUE(keyboard_container); 659 ASSERT_TRUE(keyboard_container);
637 keyboard_container->Show(); 660 keyboard_container->Show();
638 661
639 ClickTestWindow* main_delegate = new ClickTestWindow(); 662 ClickTestWindow* main_delegate = new ClickTestWindow();
640 scoped_ptr<aura::Window> keyboard_window( 663 scoped_ptr<aura::Window> keyboard_window(
641 main_delegate->CreateTestWindowWithParent(keyboard_container)); 664 main_delegate->CreateTestWindowWithParent(keyboard_container));
642 keyboard_container->layout_manager()->OnWindowResized(); 665 keyboard_container->layout_manager()->OnWindowResized();
643 keyboard_window->Show(); 666 keyboard_window->Show();
(...skipping 27 matching lines...) Expand all
671 aura::WindowTracker tracker; 694 aura::WindowTracker tracker;
672 tracker.Add(keyboard_container); 695 tracker.Add(keyboard_container);
673 // Mock a login state change to reinitialize the keyboard. 696 // Mock a login state change to reinitialize the keyboard.
674 ash::Shell::GetInstance()->OnLoginStateChanged(user::LOGGED_IN_OWNER); 697 ash::Shell::GetInstance()->OnLoginStateChanged(user::LOGGED_IN_OWNER);
675 // keyboard_container should no longer be present. 698 // keyboard_container should no longer be present.
676 EXPECT_FALSE(tracker.Contains(keyboard_container)); 699 EXPECT_FALSE(tracker.Contains(keyboard_container));
677 } 700 }
678 701
679 } // namespace test 702 } // namespace test
680 } // namespace ash 703 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698