| Index: chromeos/ime/keyboard_controller_unittest.cc
|
| diff --git a/chromeos/ime/xkeyboard_unittest.cc b/chromeos/ime/keyboard_controller_unittest.cc
|
| similarity index 65%
|
| rename from chromeos/ime/xkeyboard_unittest.cc
|
| rename to chromeos/ime/keyboard_controller_unittest.cc
|
| index 238aeab2145bea4581ee4d727abba8d285d077d6..868fabeacb4e6fbc2dec7b10ec6a2f17b454f887 100644
|
| --- a/chromeos/ime/xkeyboard_unittest.cc
|
| +++ b/chromeos/ime/keyboard_controller_unittest.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chromeos/ime/xkeyboard.h"
|
| +#include "chromeos/ime/keyboard_controller.h"
|
|
|
| #include <algorithm>
|
| #include <set>
|
| @@ -20,20 +20,20 @@ namespace input_method {
|
|
|
| namespace {
|
|
|
| -class XKeyboardTest : public testing::Test {
|
| +class KeyboardControllerTest : public testing::Test {
|
| public:
|
| - XKeyboardTest() {
|
| + KeyboardControllerTest() {
|
| }
|
|
|
| virtual void SetUp() {
|
| - xkey_.reset(XKeyboard::Create());
|
| + xkey_.reset(KeyboardController::Create());
|
| }
|
|
|
| virtual void TearDown() {
|
| xkey_.reset();
|
| }
|
|
|
| - scoped_ptr<XKeyboard> xkey_;
|
| + scoped_ptr<KeyboardController> xkey_;
|
|
|
| base::MessageLoopForUI message_loop_;
|
| };
|
| @@ -46,32 +46,34 @@ bool DisplayAvailable() {
|
| } // namespace
|
|
|
| // Tests CheckLayoutName() function.
|
| -TEST_F(XKeyboardTest, TestCheckLayoutName) {
|
| +TEST_F(KeyboardControllerTest, TestCheckLayoutName) {
|
| // CheckLayoutName should not accept non-alphanumeric characters
|
| // except "()-_".
|
| - EXPECT_FALSE(XKeyboard::CheckLayoutNameForTesting("us!"));
|
| - EXPECT_FALSE(XKeyboard::CheckLayoutNameForTesting("us; /bin/sh"));
|
| - EXPECT_TRUE(XKeyboard::CheckLayoutNameForTesting("ab-c_12"));
|
| + EXPECT_FALSE(KeyboardController::CheckLayoutNameForTesting("us!"));
|
| + EXPECT_FALSE(KeyboardController::CheckLayoutNameForTesting("us; /bin/sh"));
|
| + EXPECT_TRUE(KeyboardController::CheckLayoutNameForTesting("ab-c_12"));
|
|
|
| // CheckLayoutName should not accept upper-case ascii characters.
|
| - EXPECT_FALSE(XKeyboard::CheckLayoutNameForTesting("US"));
|
| + EXPECT_FALSE(KeyboardController::CheckLayoutNameForTesting("US"));
|
|
|
| // CheckLayoutName should accept lower-case ascii characters.
|
| for (int c = 'a'; c <= 'z'; ++c) {
|
| - EXPECT_TRUE(XKeyboard::CheckLayoutNameForTesting(std::string(3, c)));
|
| + EXPECT_TRUE(
|
| + KeyboardController::CheckLayoutNameForTesting(std::string(3, c)));
|
| }
|
|
|
| // CheckLayoutName should accept numbers.
|
| for (int c = '0'; c <= '9'; ++c) {
|
| - EXPECT_TRUE(XKeyboard::CheckLayoutNameForTesting(std::string(3, c)));
|
| + EXPECT_TRUE(
|
| + KeyboardController::CheckLayoutNameForTesting(std::string(3, c)));
|
| }
|
|
|
| // CheckLayoutName should accept a layout with a variant name.
|
| - EXPECT_TRUE(XKeyboard::CheckLayoutNameForTesting("us(dvorak)"));
|
| - EXPECT_TRUE(XKeyboard::CheckLayoutNameForTesting("jp"));
|
| + EXPECT_TRUE(KeyboardController::CheckLayoutNameForTesting("us(dvorak)"));
|
| + EXPECT_TRUE(KeyboardController::CheckLayoutNameForTesting("jp"));
|
| }
|
|
|
| -TEST_F(XKeyboardTest, TestSetCapsLockEnabled) {
|
| +TEST_F(KeyboardControllerTest, TestSetCapsLockEnabled) {
|
| if (!DisplayAvailable()) {
|
| // Do not fail the test to allow developers to run unit_tests without an X
|
| // server (e.g. via ssh). Note that both try bots and waterfall always have
|
| @@ -91,38 +93,38 @@ TEST_F(XKeyboardTest, TestSetCapsLockEnabled) {
|
| xkey_->SetCapsLockEnabled(initial_lock_state);
|
| }
|
|
|
| -TEST_F(XKeyboardTest, TestSetAutoRepeatEnabled) {
|
| +TEST_F(KeyboardControllerTest, TestSetAutoRepeatEnabled) {
|
| if (!DisplayAvailable()) {
|
| DVLOG(1) << "X server is not available. Skip the test.";
|
| return;
|
| }
|
| - const bool state = XKeyboard::GetAutoRepeatEnabledForTesting();
|
| + const bool state = KeyboardController::GetAutoRepeatEnabledForTesting();
|
| xkey_->SetAutoRepeatEnabled(!state);
|
| - EXPECT_EQ(!state, XKeyboard::GetAutoRepeatEnabledForTesting());
|
| + EXPECT_EQ(!state, KeyboardController::GetAutoRepeatEnabledForTesting());
|
| // Restore the initial state.
|
| xkey_->SetAutoRepeatEnabled(state);
|
| - EXPECT_EQ(state, XKeyboard::GetAutoRepeatEnabledForTesting());
|
| + EXPECT_EQ(state, KeyboardController::GetAutoRepeatEnabledForTesting());
|
| }
|
|
|
| -TEST_F(XKeyboardTest, TestSetAutoRepeatRate) {
|
| +TEST_F(KeyboardControllerTest, TestSetAutoRepeatRate) {
|
| if (!DisplayAvailable()) {
|
| DVLOG(1) << "X server is not available. Skip the test.";
|
| return;
|
| }
|
| AutoRepeatRate rate;
|
| - EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&rate));
|
| + EXPECT_TRUE(KeyboardController::GetAutoRepeatRateForTesting(&rate));
|
|
|
| AutoRepeatRate tmp(rate);
|
| ++tmp.initial_delay_in_ms;
|
| ++tmp.repeat_interval_in_ms;
|
| EXPECT_TRUE(xkey_->SetAutoRepeatRate(tmp));
|
| - EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&tmp));
|
| + EXPECT_TRUE(KeyboardController::GetAutoRepeatRateForTesting(&tmp));
|
| EXPECT_EQ(rate.initial_delay_in_ms + 1, tmp.initial_delay_in_ms);
|
| EXPECT_EQ(rate.repeat_interval_in_ms + 1, tmp.repeat_interval_in_ms);
|
|
|
| // Restore the initial state.
|
| EXPECT_TRUE(xkey_->SetAutoRepeatRate(rate));
|
| - EXPECT_TRUE(XKeyboard::GetAutoRepeatRateForTesting(&tmp));
|
| + EXPECT_TRUE(KeyboardController::GetAutoRepeatRateForTesting(&tmp));
|
| EXPECT_EQ(rate.initial_delay_in_ms, tmp.initial_delay_in_ms);
|
| EXPECT_EQ(rate.repeat_interval_in_ms, tmp.repeat_interval_in_ms);
|
| }
|
|
|