17ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany// Copyright (c) 2012 The Chromium Authors. All rights reserved.
27ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany// Use of this source code is governed by a BSD-style license that can be
37ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany// found in the LICENSE file.
47ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany
57ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany#include "base/logging.h"
67ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany#include "chromeos/ime/input_method_whitelist.h"
77ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany#include "testing/gtest/include/gtest/gtest.h"
87ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany
97ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryanynamespace chromeos {
107ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryanynamespace input_method {
117ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany
127ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryanynamespace {
137ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany
147ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryanyclass InputMethodWhitelistTest : public testing::Test {
157ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany protected:
167ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany  const InputMethodWhitelist whitelist_;
177ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany};
187ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany
195d71de26cedae3dafc17449fe0182045c0bd20e8Stephen Hines}  // namespace
207ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany
217ac41484ea322e0ea5774df681660269f5dc321eKostya SerebryanyTEST_F(InputMethodWhitelistTest, TestInputMethodIdIsWhitelisted) {
227ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany  EXPECT_TRUE(whitelist_.InputMethodIdIsWhitelisted("xkb:us:dvorak:eng"));
237ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany  EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("mozc,"));
247ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany  EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted(
257ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany      "mozc-pinyin,xkb:us:dvorak:eng"));
267ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany  EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted("not-supported-id"));
277ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany  EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted(","));
287ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany  EXPECT_FALSE(whitelist_.InputMethodIdIsWhitelisted(""));
297ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany}
307ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany
317ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany}  // namespace input_method
327ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany}  // namespace chromeos
337ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany