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 "chromeos/ime/xkeyboard.h" | 5 #include "chromeos/ime/xkeyboard.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.h" | 13 #include "base/message_loop.h" |
14 #include "chromeos/ime/input_method_whitelist.h" | |
15 #include "chromeos/ime/mock_input_method_delegate.h" | |
16 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
17 | 15 |
18 #include <X11/Xlib.h> | 16 #include <X11/Xlib.h> |
19 | 17 |
20 namespace chromeos { | 18 namespace chromeos { |
21 namespace input_method { | 19 namespace input_method { |
22 | 20 |
23 namespace { | 21 namespace { |
24 | 22 |
25 class XKeyboardTest : public testing::Test { | 23 class XKeyboardTest : public testing::Test { |
26 public: | 24 public: |
27 XKeyboardTest() { | 25 XKeyboardTest() { |
28 } | 26 } |
29 | 27 |
30 virtual void SetUp() { | 28 virtual void SetUp() { |
31 xkey_.reset(XKeyboard::Create()); | 29 xkey_.reset(XKeyboard::Create()); |
32 } | 30 } |
33 | 31 |
34 virtual void TearDown() { | 32 virtual void TearDown() { |
35 xkey_.reset(); | 33 xkey_.reset(); |
36 } | 34 } |
37 | 35 |
38 InputMethodWhitelist whitelist_; | |
39 scoped_ptr<XKeyboard> xkey_; | 36 scoped_ptr<XKeyboard> xkey_; |
40 | 37 |
41 MessageLoopForUI message_loop_; | 38 MessageLoopForUI message_loop_; |
42 }; | 39 }; |
43 | 40 |
44 // Returns true if X display is available. | 41 // Returns true if X display is available. |
45 bool DisplayAvailable() { | 42 bool DisplayAvailable() { |
46 return (base::MessagePumpForUI::GetDefaultXDisplay() != NULL); | 43 return (base::MessagePumpForUI::GetDefaultXDisplay() != NULL); |
47 } | 44 } |
48 | 45 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 201 |
205 // Restore the initial state. | 202 // Restore the initial state. |
206 EXPECT_TRUE(XKeyboard::SetAutoRepeatRate(rate)); | 203 EXPECT_TRUE(XKeyboard::SetAutoRepeatRate(rate)); |
207 EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&tmp)); | 204 EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&tmp)); |
208 EXPECT_EQ(rate.initial_delay_in_ms, tmp.initial_delay_in_ms); | 205 EXPECT_EQ(rate.initial_delay_in_ms, tmp.initial_delay_in_ms); |
209 EXPECT_EQ(rate.repeat_interval_in_ms, tmp.repeat_interval_in_ms); | 206 EXPECT_EQ(rate.repeat_interval_in_ms, tmp.repeat_interval_in_ms); |
210 } | 207 } |
211 | 208 |
212 } // namespace input_method | 209 } // namespace input_method |
213 } // namespace chromeos | 210 } // namespace chromeos |
OLD | NEW |