OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/input_method/xkeyboard.h" | 5 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 InputMethodWhitelist whitelist_; | 46 InputMethodWhitelist whitelist_; |
47 InputMethodUtil util_; | 47 InputMethodUtil util_; |
48 scoped_ptr<XKeyboard> xkey_; | 48 scoped_ptr<XKeyboard> xkey_; |
49 | 49 |
50 MessageLoopForUI message_loop_; | 50 MessageLoopForUI message_loop_; |
51 content::TestBrowserThread ui_thread_; | 51 content::TestBrowserThread ui_thread_; |
52 }; | 52 }; |
53 | 53 |
54 // Returns true if X display is available. | 54 // Returns true if X display is available. |
55 bool DisplayAvailable() { | 55 bool DisplayAvailable() { |
56 return ui::GetXDisplay() ? true : false; | 56 return (ui::GetXDisplay() != NULL); |
57 } | 57 } |
58 | 58 |
59 } // namespace | 59 } // namespace |
60 | 60 |
61 // Tests CheckLayoutName() function. | 61 // Tests CheckLayoutName() function. |
62 TEST_F(XKeyboardTest, TestCheckLayoutName) { | 62 TEST_F(XKeyboardTest, TestCheckLayoutName) { |
63 // CheckLayoutName should not accept non-alphanumeric characters | 63 // CheckLayoutName should not accept non-alphanumeric characters |
64 // except "()-_". | 64 // except "()-_". |
65 EXPECT_FALSE(XKeyboard::CheckLayoutNameForTesting("us!")); | 65 EXPECT_FALSE(XKeyboard::CheckLayoutNameForTesting("us!")); |
66 EXPECT_FALSE(XKeyboard::CheckLayoutNameForTesting("us; /bin/sh")); | 66 EXPECT_FALSE(XKeyboard::CheckLayoutNameForTesting("us; /bin/sh")); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 // Restore the initial state. | 215 // Restore the initial state. |
216 EXPECT_TRUE(XKeyboard::SetAutoRepeatRate(rate)); | 216 EXPECT_TRUE(XKeyboard::SetAutoRepeatRate(rate)); |
217 EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&tmp)); | 217 EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&tmp)); |
218 EXPECT_EQ(rate.initial_delay_in_ms, tmp.initial_delay_in_ms); | 218 EXPECT_EQ(rate.initial_delay_in_ms, tmp.initial_delay_in_ms); |
219 EXPECT_EQ(rate.repeat_interval_in_ms, tmp.repeat_interval_in_ms); | 219 EXPECT_EQ(rate.repeat_interval_in_ms, tmp.repeat_interval_in_ms); |
220 } | 220 } |
221 | 221 |
222 } // namespace input_method | 222 } // namespace input_method |
223 } // namespace chromeos | 223 } // namespace chromeos |
OLD | NEW |