| Index: chrome/browser/chromeos/input_method/input_method_descriptor_unittest.cc
|
| diff --git a/chrome/browser/chromeos/input_method/input_method_descriptor_unittest.cc b/chrome/browser/chromeos/input_method/input_method_descriptor_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..56f513e835c827c4ec521057deddae012759f75b
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/input_method/input_method_descriptor_unittest.cc
|
| @@ -0,0 +1,63 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/logging.h"
|
| +#include "chrome/browser/chromeos/input_method/input_method_descriptor.h"
|
| +#include "chrome/browser/chromeos/input_method/input_method_whitelist.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +#if defined(USE_VIRTUAL_KEYBOARD)
|
| +// Since USE_VIRTUAL_KEYBOARD build only supports a few keyboard layouts, we
|
| +// skip the test for now.
|
| +#define TestCreateInputMethodDescriptor DISABLED_TestCreateInputMethodDescriptor
|
| +#endif // USE_VIRTUAL_KEYBOARD
|
| +
|
| +namespace chromeos {
|
| +namespace input_method {
|
| +
|
| +namespace {
|
| +
|
| +const char kFallbackLayout[] = "us";
|
| +
|
| +class InputMethodDescriptorTest : public testing::Test {
|
| + public:
|
| + InputMethodDescriptorTest() {
|
| + }
|
| +
|
| + protected:
|
| + InputMethodDescriptor GetDesc(const std::string& raw_layout) {
|
| + return InputMethodDescriptor(whitelist_,
|
| + "id",
|
| + "", // name
|
| + raw_layout,
|
| + "language_code");
|
| + }
|
| +
|
| + private:
|
| + const InputMethodWhitelist whitelist_;
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +TEST_F(InputMethodDescriptorTest, TestCreateInputMethodDescriptor) {
|
| + EXPECT_EQ("us", GetDesc("us").keyboard_layout());
|
| + EXPECT_EQ("us", GetDesc("us,us(dvorak)").keyboard_layout());
|
| + EXPECT_EQ("us(dvorak)", GetDesc("us(dvorak),us").keyboard_layout());
|
| +
|
| + EXPECT_EQ("fr", GetDesc("fr").keyboard_layout());
|
| + EXPECT_EQ("fr", GetDesc("fr,us(dvorak)").keyboard_layout());
|
| + EXPECT_EQ("us(dvorak)", GetDesc("us(dvorak),fr").keyboard_layout());
|
| +
|
| + EXPECT_EQ("fr", GetDesc("not-supported,fr").keyboard_layout());
|
| + EXPECT_EQ("fr", GetDesc("fr,not-supported").keyboard_layout());
|
| +
|
| + EXPECT_EQ(kFallbackLayout, GetDesc("not-supported").keyboard_layout());
|
| + EXPECT_EQ(kFallbackLayout, GetDesc(",").keyboard_layout());
|
| + EXPECT_EQ(kFallbackLayout, GetDesc("").keyboard_layout());
|
| +
|
| + // TODO(yusukes): Add tests for |virtual_keyboard_layout| member.
|
| +}
|
| +
|
| +} // namespace input_method
|
| +} // namespace chromeos
|
|
|