Chromium Code Reviews| Index: ash/sticky_keys/sticky_keys_overlay_unittest.cc |
| diff --git a/ash/sticky_keys/sticky_keys_overlay_unittest.cc b/ash/sticky_keys/sticky_keys_overlay_unittest.cc |
| index b6078255bb72b2d8ed6a4efe022721518e5430e2..e34741369aee73045bafaff83c06d0946ceecc1c 100644 |
| --- a/ash/sticky_keys/sticky_keys_overlay_unittest.cc |
| +++ b/ash/sticky_keys/sticky_keys_overlay_unittest.cc |
| @@ -8,6 +8,7 @@ |
| #include "ash/sticky_keys/sticky_keys_controller.h" |
| #include "ash/test/ash_test_base.h" |
| #include "ui/events/event.h" |
| +#include "ui/views/widget/widget.h" |
| namespace ash { |
| @@ -41,6 +42,22 @@ TEST_F(StickyKeysOverlayTest, ModifierKeyState) { |
| overlay.GetModifierKeyState(ui::EF_COMMAND_DOWN)); |
| } |
| +TEST_F(StickyKeysOverlayTest, OverlayViewOwnership) { |
|
James Cook
2014/12/01 21:06:00
nit: Document what this test is testing. I like to
Tim Song
2014/12/02 20:07:05
Done.
|
| + StickyKeysOverlay overlay; |
| + views::Widget* widget = overlay.GetWidgetForTesting(); |
| + ASSERT_TRUE(widget); |
| + delete widget->GetNativeWindow(); |
| + |
| + // States should still be valid even after the native window associated with |
| + // the Widget is destroyed. |
| + overlay.SetModifierKeyState(ui::EF_SHIFT_DOWN, STICKY_KEY_STATE_ENABLED); |
| + EXPECT_EQ(STICKY_KEY_STATE_ENABLED, |
| + overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN)); |
| + overlay.SetModifierKeyState(ui::EF_SHIFT_DOWN, STICKY_KEY_STATE_DISABLED); |
| + EXPECT_EQ(STICKY_KEY_STATE_DISABLED, |
| + overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN)); |
| +} |
| + |
| // Additional sticky key overlay tests that depend on chromeos::EventRewriter |
| // are now in chrome/browser/chromeos/events/event_rewriter_unittest.cc . |