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/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/display/window_tree_host_manager.h" | 8 #include "ash/display/window_tree_host_manager.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" |
(...skipping 28 matching lines...) Expand all Loading... |
39 EXPECT_EQ(STICKY_KEY_STATE_LOCKED, | 39 EXPECT_EQ(STICKY_KEY_STATE_LOCKED, |
40 overlay.GetModifierKeyState(ui::EF_COMMAND_DOWN)); | 40 overlay.GetModifierKeyState(ui::EF_COMMAND_DOWN)); |
41 } | 41 } |
42 | 42 |
43 // This test addresses the crash report at crbug.com/435600, speculated to be | 43 // This test addresses the crash report at crbug.com/435600, speculated to be |
44 // caused by using sticky keys with multiple displays. | 44 // caused by using sticky keys with multiple displays. |
45 TEST_F(StickyKeysOverlayTest, OverlayNotDestroyedAfterDisplayRemoved) { | 45 TEST_F(StickyKeysOverlayTest, OverlayNotDestroyedAfterDisplayRemoved) { |
46 // Add a secondary display to the left of the primary one. | 46 // Add a secondary display to the left of the primary one. |
47 UpdateDisplay("1280x1024,1980x1080"); | 47 UpdateDisplay("1280x1024,1980x1080"); |
48 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 48 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
49 DisplayIdPair display_ids = display_manager->GetCurrentDisplayIdPair(); | 49 DisplayIdList display_ids = display_manager->GetCurrentDisplayIdList(); |
50 int64_t primary_display_id = display_ids.first; | 50 int64_t primary_display_id = display_ids[0]; |
51 int64_t secondary_display_id = display_ids.second; | 51 int64_t secondary_display_id = display_ids[1]; |
52 display_manager->SetLayoutForCurrentDisplays( | 52 display_manager->SetLayoutForCurrentDisplays( |
53 DisplayLayout(DisplayLayout::LEFT, 0)); | 53 DisplayLayout(DisplayLayout::LEFT, 0)); |
54 | 54 |
55 // The overlay should belong to the secondary root window. | 55 // The overlay should belong to the secondary root window. |
56 StickyKeysOverlay overlay; | 56 StickyKeysOverlay overlay; |
57 views::Widget* overlay_widget = overlay.GetWidgetForTesting(); | 57 views::Widget* overlay_widget = overlay.GetWidgetForTesting(); |
58 WindowTreeHostManager* window_tree_host_manager = | 58 WindowTreeHostManager* window_tree_host_manager = |
59 Shell::GetInstance()->window_tree_host_manager(); | 59 Shell::GetInstance()->window_tree_host_manager(); |
60 EXPECT_EQ( | 60 EXPECT_EQ( |
61 window_tree_host_manager->GetRootWindowForDisplayId(secondary_display_id), | 61 window_tree_host_manager->GetRootWindowForDisplayId(secondary_display_id), |
(...skipping 11 matching lines...) Expand all Loading... |
73 overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN)); | 73 overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN)); |
74 overlay.SetModifierKeyState(ui::EF_SHIFT_DOWN, STICKY_KEY_STATE_DISABLED); | 74 overlay.SetModifierKeyState(ui::EF_SHIFT_DOWN, STICKY_KEY_STATE_DISABLED); |
75 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, | 75 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, |
76 overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN)); | 76 overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN)); |
77 } | 77 } |
78 | 78 |
79 // Additional sticky key overlay tests that depend on chromeos::EventRewriter | 79 // Additional sticky key overlay tests that depend on chromeos::EventRewriter |
80 // are now in chrome/browser/chromeos/events/event_rewriter_unittest.cc . | 80 // are now in chrome/browser/chromeos/events/event_rewriter_unittest.cc . |
81 | 81 |
82 } // namespace ash | 82 } // namespace ash |
OLD | NEW |