Revert 168224 - Update V8 to version 3.15.4.
[chromium-blink-merge.git] / chrome / browser / chromeos / input_method / ibus_controller_impl_unittest.cc
blobdc0317063c2e81a32a867d5c99e1a5683b650e63
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
3 // found in the LICENSE file.
5 #include "base/logging.h"
6 #include "chrome/browser/chromeos/input_method/ibus_controller_impl.h"
7 #include "chrome/browser/chromeos/input_method/input_method_property.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace chromeos {
11 namespace input_method {
13 namespace {
15 bool FindAndUpdateProperty(const InputMethodProperty& new_prop,
16 InputMethodPropertyList* prop_list) {
17 return IBusControllerImpl::FindAndUpdatePropertyForTesting(new_prop,
18 prop_list);
21 } // namespace
23 TEST(IBusControllerImplTest, TestFindAndUpdateProperty) {
24 InputMethodPropertyList properties;
25 EXPECT_FALSE(FindAndUpdateProperty(InputMethodProperty(), &properties));
27 properties.push_back(
28 InputMethodProperty("key1", "label1", false, false, 0));
29 EXPECT_FALSE(FindAndUpdateProperty(InputMethodProperty(), &properties));
30 EXPECT_FALSE(FindAndUpdateProperty(
31 InputMethodProperty("keyX", "labelX", false, false, 0), &properties));
32 EXPECT_EQ(InputMethodProperty("key1", "label1", false, false, 0),
33 properties[0]);
34 EXPECT_TRUE(FindAndUpdateProperty(
35 InputMethodProperty("key1", "labelY", false, false, 0), &properties));
36 EXPECT_EQ(InputMethodProperty("key1", "labelY", false, false, 0),
37 properties[0]);
39 properties.push_back(
40 InputMethodProperty("key2", "label2", false, false, 0));
41 EXPECT_FALSE(FindAndUpdateProperty(InputMethodProperty(), &properties));
42 EXPECT_FALSE(FindAndUpdateProperty(
43 InputMethodProperty("keyX", "labelX", false, false, 0), &properties));
44 EXPECT_EQ(InputMethodProperty("key2", "label2", false, false, 0),
45 properties[1]);
46 EXPECT_TRUE(FindAndUpdateProperty(
47 InputMethodProperty("key2", "labelZ", false, false, 0), &properties));
48 EXPECT_EQ(InputMethodProperty("key2", "labelZ", false, false, 0),
49 properties[1]);
52 } // namespace input_method
53 } // namespace chromeos