| OLD | NEW |
| 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/sticky_keys/sticky_keys_overlay.h" | 5 #include "ash/sticky_keys/sticky_keys_overlay.h" |
| 6 | 6 |
| 7 #include "ash/common/wm_shell.h" | 7 #include "ash/common/wm_shell.h" |
| 8 #include "ash/display/window_tree_host_manager.h" | 8 #include "ash/common/wm_window.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/sticky_keys/sticky_keys_controller.h" | 10 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 12 #include "ui/display/display_layout.h" | 12 #include "ui/display/display_layout.h" |
| 13 #include "ui/display/manager/display_manager.h" | 13 #include "ui/display/manager/display_manager.h" |
| 14 #include "ui/display/test/display_manager_test_api.h" | 14 #include "ui/display/test/display_manager_test_api.h" |
| 15 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
| 16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // http://crbug.com/696754. | 60 // http://crbug.com/696754. |
| 61 if (WmShell::Get()->IsRunningInMash()) | 61 if (WmShell::Get()->IsRunningInMash()) |
| 62 return; | 62 return; |
| 63 display_manager()->SetLayoutForCurrentDisplays( | 63 display_manager()->SetLayoutForCurrentDisplays( |
| 64 display::test::CreateDisplayLayout(display_manager(), | 64 display::test::CreateDisplayLayout(display_manager(), |
| 65 display::DisplayPlacement::LEFT, 0)); | 65 display::DisplayPlacement::LEFT, 0)); |
| 66 | 66 |
| 67 // The overlay should belong to the secondary root window. | 67 // The overlay should belong to the secondary root window. |
| 68 StickyKeysOverlay overlay; | 68 StickyKeysOverlay overlay; |
| 69 views::Widget* overlay_widget = overlay.GetWidgetForTesting(); | 69 views::Widget* overlay_widget = overlay.GetWidgetForTesting(); |
| 70 WindowTreeHostManager* window_tree_host_manager = | 70 EXPECT_EQ(WmShell::Get() |
| 71 Shell::GetInstance()->window_tree_host_manager(); | 71 ->GetRootWindowForDisplayId(secondary_display_id) |
| 72 EXPECT_EQ( | 72 ->aura_window(), |
| 73 window_tree_host_manager->GetRootWindowForDisplayId(secondary_display_id), | 73 overlay_widget->GetNativeWindow()->GetRootWindow()); |
| 74 overlay_widget->GetNativeWindow()->GetRootWindow()); | |
| 75 | 74 |
| 76 // Removing the second display should move the overlay to the primary root | 75 // Removing the second display should move the overlay to the primary root |
| 77 // window. | 76 // window. |
| 78 UpdateDisplay("1280x1024"); | 77 UpdateDisplay("1280x1024"); |
| 79 EXPECT_EQ( | 78 EXPECT_EQ(WmShell::Get() |
| 80 window_tree_host_manager->GetRootWindowForDisplayId(primary_display_id), | 79 ->GetRootWindowForDisplayId(primary_display_id) |
| 81 overlay_widget->GetNativeWindow()->GetRootWindow()); | 80 ->aura_window(), |
| 81 overlay_widget->GetNativeWindow()->GetRootWindow()); |
| 82 | 82 |
| 83 overlay.SetModifierKeyState(ui::EF_SHIFT_DOWN, STICKY_KEY_STATE_ENABLED); | 83 overlay.SetModifierKeyState(ui::EF_SHIFT_DOWN, STICKY_KEY_STATE_ENABLED); |
| 84 EXPECT_EQ(STICKY_KEY_STATE_ENABLED, | 84 EXPECT_EQ(STICKY_KEY_STATE_ENABLED, |
| 85 overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN)); | 85 overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN)); |
| 86 overlay.SetModifierKeyState(ui::EF_SHIFT_DOWN, STICKY_KEY_STATE_DISABLED); | 86 overlay.SetModifierKeyState(ui::EF_SHIFT_DOWN, STICKY_KEY_STATE_DISABLED); |
| 87 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, | 87 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, |
| 88 overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN)); | 88 overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN)); |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Additional sticky key overlay tests that depend on ui::EventRewriterChromeOS | 91 // Additional sticky key overlay tests that depend on ui::EventRewriterChromeOS |
| 92 // are now in chrome/browser/chromeos/events/event_rewriter_unittest.cc . | 92 // are now in chrome/browser/chromeos/events/event_rewriter_unittest.cc . |
| 93 | 93 |
| 94 } // namespace ash | 94 } // namespace ash |
| OLD | NEW |