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

Unified Diff: ash/sticky_keys/sticky_keys_overlay_unittest.cc

Issue 754763005: Speculative fix for sticky keys overlay crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
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 .
« ash/sticky_keys/sticky_keys_overlay.h ('K') | « ash/sticky_keys/sticky_keys_overlay.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698