OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_controller.h" | 5 #include "ash/sticky_keys/sticky_keys_controller.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 #undef None | 8 #undef None |
9 #undef Bool | 9 #undef Bool |
10 #undef RootWindow | 10 #undef RootWindow |
(...skipping 16 matching lines...) Expand all Loading... |
27 const unsigned int kTouchPadDeviceId = 1; | 27 const unsigned int kTouchPadDeviceId = 1; |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 class StickyKeysTest : public test::AshTestBase { | 31 class StickyKeysTest : public test::AshTestBase { |
32 protected: | 32 protected: |
33 StickyKeysTest() | 33 StickyKeysTest() |
34 : target_(NULL), | 34 : target_(NULL), |
35 root_window_(NULL) {} | 35 root_window_(NULL) {} |
36 | 36 |
37 virtual void SetUp() override { | 37 void SetUp() override { |
38 test::AshTestBase::SetUp(); | 38 test::AshTestBase::SetUp(); |
39 | 39 |
40 // |target_| owned by root window of shell. It is still safe to delete | 40 // |target_| owned by root window of shell. It is still safe to delete |
41 // it ourselves. | 41 // it ourselves. |
42 target_ = CreateTestWindowInShellWithId(0); | 42 target_ = CreateTestWindowInShellWithId(0); |
43 root_window_ = target_->GetRootWindow(); | 43 root_window_ = target_->GetRootWindow(); |
44 | 44 |
45 ui::SetUpTouchPadForTest(kTouchPadDeviceId); | 45 ui::SetUpTouchPadForTest(kTouchPadDeviceId); |
46 } | 46 } |
47 | 47 |
48 virtual void TearDown() override { | 48 void TearDown() override { test::AshTestBase::TearDown(); } |
49 test::AshTestBase::TearDown(); | |
50 } | |
51 | 49 |
52 virtual void OnShortcutPressed() { | 50 virtual void OnShortcutPressed() { |
53 if (target_) { | 51 if (target_) { |
54 delete target_; | 52 delete target_; |
55 target_ = NULL; | 53 target_ = NULL; |
56 } | 54 } |
57 } | 55 } |
58 | 56 |
59 ui::KeyEvent* GenerateKey(ui::EventType type, ui::KeyboardCode code) { | 57 ui::KeyEvent* GenerateKey(ui::EventType type, ui::KeyboardCode code) { |
60 scoped_xevent_.InitKeyEvent(type, code, 0); | 58 scoped_xevent_.InitKeyEvent(type, code, 0); |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 gfx::Point(0, 0))); | 700 gfx::Point(0, 0))); |
703 released = false; | 701 released = false; |
704 mod_down_flags = 0; | 702 mod_down_flags = 0; |
705 sticky_key.HandleMouseEvent(*mev.get(), &mod_down_flags, &released); | 703 sticky_key.HandleMouseEvent(*mev.get(), &mod_down_flags, &released); |
706 EXPECT_TRUE(mod_down_flags & ui::EF_CONTROL_DOWN); | 704 EXPECT_TRUE(mod_down_flags & ui::EF_CONTROL_DOWN); |
707 EXPECT_TRUE(released); | 705 EXPECT_TRUE(released); |
708 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, sticky_key.current_state()); | 706 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, sticky_key.current_state()); |
709 } | 707 } |
710 | 708 |
711 } // namespace ash | 709 } // namespace ash |
OLD | NEW |