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 "ui/base/ime/chromeos/ime_keyboard.h" | 5 #include "ui/base/ime/chromeos/ime_keyboard.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "ui/gfx/x/x11_types.h" | 15 #include "ui/gfx/x/x11_types.h" |
16 | 16 |
17 #include <X11/Xlib.h> | 17 #include <X11/Xlib.h> |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 namespace input_method { | 20 namespace input_method { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 class ImeKeyboardTest : public testing::Test, | 24 class ImeKeyboardTest : public testing::Test, |
25 public ImeKeyboard::Observer { | 25 public ImeKeyboard::Observer { |
26 public: | 26 public: |
27 ImeKeyboardTest() { | 27 ImeKeyboardTest() { |
28 } | 28 } |
29 | 29 |
30 virtual void SetUp() { | 30 void SetUp() override { |
31 xkey_.reset(ImeKeyboard::Create()); | 31 xkey_.reset(ImeKeyboard::Create()); |
32 xkey_->AddObserver(this); | 32 xkey_->AddObserver(this); |
33 caps_changed_ = false; | 33 caps_changed_ = false; |
34 } | 34 } |
35 | 35 |
36 virtual void TearDown() { | 36 void TearDown() override { |
37 xkey_->RemoveObserver(this); | 37 xkey_->RemoveObserver(this); |
38 xkey_.reset(); | 38 xkey_.reset(); |
39 } | 39 } |
40 | 40 |
41 virtual void OnCapsLockChanged(bool enabled) override { | 41 void OnCapsLockChanged(bool enabled) override { |
42 caps_changed_ = true; | 42 caps_changed_ = true; |
43 } | 43 } |
44 | 44 |
45 void VerifyCapsLockChanged(bool changed) { | 45 void VerifyCapsLockChanged(bool changed) { |
46 EXPECT_EQ(changed, caps_changed_); | 46 EXPECT_EQ(changed, caps_changed_); |
47 caps_changed_ = false; | 47 caps_changed_ = false; |
48 } | 48 } |
49 | 49 |
50 scoped_ptr<ImeKeyboard> xkey_; | 50 scoped_ptr<ImeKeyboard> xkey_; |
51 base::MessageLoopForUI message_loop_; | 51 base::MessageLoopForUI message_loop_; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 // Restore the initial state. | 148 // Restore the initial state. |
149 EXPECT_TRUE(xkey_->SetAutoRepeatRate(rate)); | 149 EXPECT_TRUE(xkey_->SetAutoRepeatRate(rate)); |
150 EXPECT_TRUE(ImeKeyboard::GetAutoRepeatRateForTesting(&tmp)); | 150 EXPECT_TRUE(ImeKeyboard::GetAutoRepeatRateForTesting(&tmp)); |
151 EXPECT_EQ(rate.initial_delay_in_ms, tmp.initial_delay_in_ms); | 151 EXPECT_EQ(rate.initial_delay_in_ms, tmp.initial_delay_in_ms); |
152 EXPECT_EQ(rate.repeat_interval_in_ms, tmp.repeat_interval_in_ms); | 152 EXPECT_EQ(rate.repeat_interval_in_ms, tmp.repeat_interval_in_ms); |
153 } | 153 } |
154 | 154 |
155 } // namespace input_method | 155 } // namespace input_method |
156 } // namespace chromeos | 156 } // namespace chromeos |
OLD | NEW |