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
3// found in the LICENSE file.
4
5#include "ash/sticky_keys/sticky_keys_overlay.h"
6
7#include "ash/shell.h"
8#include "ash/sticky_keys/sticky_keys_controller.h"
9#include "ash/test/ash_test_base.h"
10#include "ui/events/event.h"
11
12namespace ash {
13
14class StickyKeysOverlayTest : public test::AshTestBase {
15 public:
16  StickyKeysOverlayTest() {}
17  virtual ~StickyKeysOverlayTest() {}
18};
19
20TEST_F(StickyKeysOverlayTest, OverlayVisibility) {
21  StickyKeysOverlay overlay;
22  EXPECT_FALSE(overlay.is_visible());
23  overlay.Show(true);
24  EXPECT_TRUE(overlay.is_visible());
25}
26
27TEST_F(StickyKeysOverlayTest, ModifierKeyState) {
28  StickyKeysOverlay overlay;
29  overlay.SetModifierKeyState(ui::EF_SHIFT_DOWN, STICKY_KEY_STATE_DISABLED);
30  overlay.SetModifierKeyState(ui::EF_ALT_DOWN, STICKY_KEY_STATE_LOCKED);
31  overlay.SetModifierKeyState(ui::EF_CONTROL_DOWN, STICKY_KEY_STATE_ENABLED);
32
33  EXPECT_EQ(STICKY_KEY_STATE_DISABLED,
34            overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN));
35  EXPECT_EQ(STICKY_KEY_STATE_LOCKED,
36            overlay.GetModifierKeyState(ui::EF_ALT_DOWN));
37  EXPECT_EQ(STICKY_KEY_STATE_ENABLED,
38            overlay.GetModifierKeyState(ui::EF_CONTROL_DOWN));
39}
40
41// Additional sticky key overlay tests that depend on chromeos::EventRewriter
42// are now in chrome/browser/chromeos/events/event_rewriter_unittest.cc .
43
44}  // namespace ash
45