summaryrefslogtreecommitdiffstats
path: root/chromeos/ime/input_method_whitelist_unittest.cc
blob: eb4ed28da707c19ab66006d463c864346c66afb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// 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 "chromeos/ime/input_method_whitelist.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace chromeos {
namespace input_method {

namespace {

class InputMethodWhitelistTest : public testing::Test {
 protected:
  const InputMethodWhitelist whitelist_;
};

}  // namespace

TEST_F(InputMethodWhitelistTest, TestInputMethodIdIsWhitelisted) {
  EXPECT_TRUE(whitelist_.InputMethodIdIsWhitelisted("mozc"));
  EXPECT_TRUE(whitelist_.InputMethodIdIsWhitelisted("xkb:us:dvorak:eng"));
  EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("mozc,"));
  EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("mozc,xkb:us:dvorak:eng"));
  EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("not-supported-id"));
  EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted(","));
  EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted(""));
}

}  // namespace input_method
}  // namespace chromeos