| 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "chrome/browser/chromeos/input_method/input_method_descriptor.h" | 6 #include "chrome/browser/chromeos/input_method/input_method_descriptor.h" |
| 7 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" | 7 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 #if defined(USE_VIRTUAL_KEYBOARD) | |
| 11 // Since USE_VIRTUAL_KEYBOARD build only supports a few keyboard layouts, we | |
| 12 // skip the test for now. | |
| 13 #define TestCreateInputMethodDescriptor DISABLED_TestCreateInputMethodDescriptor | |
| 14 #endif // USE_VIRTUAL_KEYBOARD | |
| 15 | |
| 16 namespace chromeos { | 10 namespace chromeos { |
| 17 namespace input_method { | 11 namespace input_method { |
| 18 | 12 |
| 19 namespace { | 13 namespace { |
| 20 | 14 |
| 21 const char kFallbackLayout[] = "us"; | 15 const char kFallbackLayout[] = "us"; |
| 22 | 16 |
| 23 class InputMethodDescriptorTest : public testing::Test { | 17 class InputMethodDescriptorTest : public testing::Test { |
| 24 public: | 18 public: |
| 25 InputMethodDescriptorTest() { | 19 InputMethodDescriptorTest() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 56 EXPECT_EQ("fr", GetDesc("fr").keyboard_layout()); | 50 EXPECT_EQ("fr", GetDesc("fr").keyboard_layout()); |
| 57 EXPECT_EQ("fr", GetDesc("fr,us(dvorak)").keyboard_layout()); | 51 EXPECT_EQ("fr", GetDesc("fr,us(dvorak)").keyboard_layout()); |
| 58 EXPECT_EQ("us(dvorak)", GetDesc("us(dvorak),fr").keyboard_layout()); | 52 EXPECT_EQ("us(dvorak)", GetDesc("us(dvorak),fr").keyboard_layout()); |
| 59 | 53 |
| 60 EXPECT_EQ("fr", GetDesc("not-supported,fr").keyboard_layout()); | 54 EXPECT_EQ("fr", GetDesc("not-supported,fr").keyboard_layout()); |
| 61 EXPECT_EQ("fr", GetDesc("fr,not-supported").keyboard_layout()); | 55 EXPECT_EQ("fr", GetDesc("fr,not-supported").keyboard_layout()); |
| 62 | 56 |
| 63 EXPECT_EQ(kFallbackLayout, GetDesc("not-supported").keyboard_layout()); | 57 EXPECT_EQ(kFallbackLayout, GetDesc("not-supported").keyboard_layout()); |
| 64 EXPECT_EQ(kFallbackLayout, GetDesc(",").keyboard_layout()); | 58 EXPECT_EQ(kFallbackLayout, GetDesc(",").keyboard_layout()); |
| 65 EXPECT_EQ(kFallbackLayout, GetDesc("").keyboard_layout()); | 59 EXPECT_EQ(kFallbackLayout, GetDesc("").keyboard_layout()); |
| 66 | |
| 67 // TODO(yusukes): Add tests for |virtual_keyboard_layout| member. | |
| 68 } | 60 } |
| 69 | 61 |
| 70 TEST_F(InputMethodDescriptorTest, TestOperatorEqual) { | 62 TEST_F(InputMethodDescriptorTest, TestOperatorEqual) { |
| 71 EXPECT_EQ(GetDescById("xkb:us::eng"), GetDescById("xkb:us::eng")); | 63 EXPECT_EQ(GetDescById("xkb:us::eng"), GetDescById("xkb:us::eng")); |
| 72 EXPECT_NE(GetDescById("xkb:us::eng"), GetDescById("xkb:us:dvorak:eng")); | 64 EXPECT_NE(GetDescById("xkb:us::eng"), GetDescById("xkb:us:dvorak:eng")); |
| 73 EXPECT_NE(GetDescById("xkb:fr::fra"), GetDescById("xkb:us::eng")); | 65 EXPECT_NE(GetDescById("xkb:fr::fra"), GetDescById("xkb:us::eng")); |
| 74 } | 66 } |
| 75 | 67 |
| 76 } // namespace input_method | 68 } // namespace input_method |
| 77 } // namespace chromeos | 69 } // namespace chromeos |
| OLD | NEW |