Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/common/system/tray/system_tray.h" | 5 #include "ash/common/system/tray/system_tray.h" |
| 6 #include "ash/common/wm/root_window_finder.h" | 6 #include "ash/common/wm/root_window_finder.h" |
| 7 #include "ash/common/wm_window.h" | 7 #include "ash/common/wm_window.h" |
| 8 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 #include "ui/views/controls/textfield/textfield.h" | 29 #include "ui/views/controls/textfield/textfield.h" |
| 30 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
| 31 #include "ui/views/widget/widget_delegate.h" | 31 #include "ui/views/widget/widget_delegate.h" |
| 32 #include "ui/wm/public/activation_client.h" | 32 #include "ui/wm/public/activation_client.h" |
| 33 | 33 |
| 34 namespace ash { | 34 namespace ash { |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 void SetSecondaryDisplayLayout(display::DisplayPlacement::Position position) { | 37 void SetSecondaryDisplayLayout(display::DisplayPlacement::Position position) { |
| 38 std::unique_ptr<display::DisplayLayout> layout = | 38 std::unique_ptr<display::DisplayLayout> layout = |
| 39 Shell::GetInstance()->display_manager()->GetCurrentDisplayLayout().Copy(); | 39 Shell::GetInstance()->display_manager()->GetCurrentDisplayLayout().Copy(); |
|
msw
2017/02/23 20:34:01
aside: I wonder how this works in mash (isn't ther
sky
2017/02/23 20:48:26
It doesn't. This class isn't in common_unittests.
| |
| 40 layout->placement_list[0].position = position; | 40 layout->placement_list[0].position = position; |
| 41 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( | 41 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
| 42 std::move(layout)); | 42 std::move(layout)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 class ModalWidgetDelegate : public views::WidgetDelegateView { | 45 class ModalWidgetDelegate : public views::WidgetDelegateView { |
| 46 public: | 46 public: |
| 47 ModalWidgetDelegate() {} | 47 ModalWidgetDelegate() {} |
| 48 ~ModalWidgetDelegate() override {} | 48 ~ModalWidgetDelegate() override {} |
| 49 | 49 |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 744 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); | 744 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); |
| 745 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); | 745 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); |
| 746 | 746 |
| 747 // a window in SettingsBubbleContainer and StatusContainer should | 747 // a window in SettingsBubbleContainer and StatusContainer should |
| 748 // not move to another root window regardles of the bounds specified. | 748 // not move to another root window regardles of the bounds specified. |
| 749 aura::Window* settings_bubble_container = | 749 aura::Window* settings_bubble_container = |
| 750 Shell::GetPrimaryRootWindowController()->GetContainer( | 750 Shell::GetPrimaryRootWindowController()->GetContainer( |
| 751 kShellWindowId_SettingBubbleContainer); | 751 kShellWindowId_SettingBubbleContainer); |
| 752 aura::Window* window = | 752 aura::Window* window = |
| 753 aura::test::CreateTestWindowWithId(100, settings_bubble_container); | 753 aura::test::CreateTestWindowWithId(100, settings_bubble_container); |
| 754 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), | 754 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), GetSecondaryDisplay()); |
| 755 display_manager()->GetSecondaryDisplay()); | |
| 756 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 755 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 757 | 756 |
| 758 aura::Window* status_container = | 757 aura::Window* status_container = |
| 759 Shell::GetPrimaryRootWindowController()->GetContainer( | 758 Shell::GetPrimaryRootWindowController()->GetContainer( |
| 760 kShellWindowId_StatusContainer); | 759 kShellWindowId_StatusContainer); |
| 761 window = aura::test::CreateTestWindowWithId(100, status_container); | 760 window = aura::test::CreateTestWindowWithId(100, status_container); |
| 762 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), | 761 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), GetSecondaryDisplay()); |
| 763 display_manager()->GetSecondaryDisplay()); | |
| 764 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 762 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 765 } | 763 } |
| 766 | 764 |
| 767 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { | 765 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { |
| 768 UpdateDisplay("100x100,200x200"); | 766 UpdateDisplay("100x100,200x200"); |
| 769 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 767 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 770 | 768 |
| 771 // Create normal windows on both displays. | 769 // Create normal windows on both displays. |
| 772 views::Widget* widget1 = CreateTestWidget( | 770 views::Widget* widget1 = CreateTestWidget( |
| 773 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); | 771 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); |
| 774 widget1->Show(); | 772 widget1->Show(); |
| 775 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow()); | 773 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow()); |
| 776 views::Widget* widget2 = | 774 views::Widget* widget2 = CreateTestWidget(GetSecondaryDisplay().bounds()); |
| 777 CreateTestWidget(display_manager()->GetSecondaryDisplay().bounds()); | |
| 778 widget2->Show(); | 775 widget2->Show(); |
| 779 EXPECT_EQ(root_windows[1], widget2->GetNativeView()->GetRootWindow()); | 776 EXPECT_EQ(root_windows[1], widget2->GetNativeView()->GetRootWindow()); |
| 780 | 777 |
| 781 // Create a LockScreen window. | 778 // Create a LockScreen window. |
| 782 views::Widget* lock_widget = CreateTestWidget( | 779 views::Widget* lock_widget = CreateTestWidget( |
| 783 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); | 780 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); |
| 784 views::Textfield* textfield = new views::Textfield; | 781 views::Textfield* textfield = new views::Textfield; |
| 785 lock_widget->client_view()->AddChildView(textfield); | 782 lock_widget->client_view()->AddChildView(textfield); |
| 786 | 783 |
| 787 ash::Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 784 ash::Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 856 generator.ReleaseLeftButton(); | 853 generator.ReleaseLeftButton(); |
| 857 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); | 854 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); |
| 858 | 855 |
| 859 generator.MoveMouseTo(400, 150); | 856 generator.MoveMouseTo(400, 150); |
| 860 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); | 857 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); |
| 861 | 858 |
| 862 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 859 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
| 863 } | 860 } |
| 864 | 861 |
| 865 } // namespace ash | 862 } // namespace ash |
| OLD | NEW |