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/ibus_ui_controller.h" | 6 #include "chrome/browser/chromeos/input_method/ibus_ui_controller.h" |
7 #include "chrome/browser/chromeos/input_method/input_method_descriptor.h" | 7 #include "chrome/browser/chromeos/input_method/input_method_descriptor.h" |
8 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" | |
9 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
10 | 9 |
11 namespace chromeos { | 10 namespace chromeos { |
12 namespace input_method { | 11 namespace input_method { |
13 | 12 |
14 // TODO(nona): Add more tests (crosbug.com/26334). | 13 // TODO(nona): Add more tests (crosbug.com/26334). |
15 | 14 |
16 TEST(IBusUiControllerTest, TestIsActive) { | 15 TEST(IBusUiControllerTest, TestIsActive) { |
17 InputMethodWhitelist w; | |
18 InputMethodDescriptors descriptors; | 16 InputMethodDescriptors descriptors; |
19 EXPECT_FALSE(IsActiveForTesting("mozc", &descriptors)); | 17 EXPECT_FALSE(IsActiveForTesting("mozc", &descriptors)); |
20 descriptors.push_back( | 18 descriptors.push_back(InputMethodDescriptor("mozc", "name", "us", "en-US")); |
21 InputMethodDescriptor(w, "mozc", "name", "us", "en-US")); | |
22 EXPECT_TRUE(IsActiveForTesting("mozc", &descriptors)); | 19 EXPECT_TRUE(IsActiveForTesting("mozc", &descriptors)); |
23 EXPECT_FALSE(IsActiveForTesting("mozc-jp", &descriptors)); | 20 EXPECT_FALSE(IsActiveForTesting("mozc-jp", &descriptors)); |
24 descriptors.push_back( | 21 descriptors.push_back( |
25 InputMethodDescriptor(w, "xkb:us::eng", "name", "us", "en-US")); | 22 InputMethodDescriptor("xkb:us::eng", "name", "us", "en-US")); |
26 EXPECT_TRUE(IsActiveForTesting("xkb:us::eng", &descriptors)); | 23 EXPECT_TRUE(IsActiveForTesting("xkb:us::eng", &descriptors)); |
27 EXPECT_TRUE(IsActiveForTesting("mozc", &descriptors)); | 24 EXPECT_TRUE(IsActiveForTesting("mozc", &descriptors)); |
28 EXPECT_FALSE(IsActiveForTesting("mozc-jp", &descriptors)); | 25 EXPECT_FALSE(IsActiveForTesting("mozc-jp", &descriptors)); |
29 } | 26 } |
30 | 27 |
31 } // namespace input_method | 28 } // namespace input_method |
32 } // namespace chromeos | 29 } // namespace chromeos |
OLD | NEW |