Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Unified Diff: chrome/browser/chromeos/input_method/ibus_controller_impl_unittest.cc

Issue 9999018: chrome/browser/chromeos/input_method/ refactoring [part 6 of 6] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, remove preferences.h and language_preference.* from this CL Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/input_method/ibus_controller_impl_unittest.cc
diff --git a/chrome/browser/chromeos/input_method/ibus_controller_impl_unittest.cc b/chrome/browser/chromeos/input_method/ibus_controller_impl_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..dc0317063c2e81a32a867d5c99e1a5683b650e63
--- /dev/null
+++ b/chrome/browser/chromeos/input_method/ibus_controller_impl_unittest.cc
@@ -0,0 +1,53 @@
+// 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/ibus_controller_impl.h"
+#include "chrome/browser/chromeos/input_method/input_method_property.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace chromeos {
+namespace input_method {
+
+namespace {
+
+bool FindAndUpdateProperty(const InputMethodProperty& new_prop,
+ InputMethodPropertyList* prop_list) {
+ return IBusControllerImpl::FindAndUpdatePropertyForTesting(new_prop,
+ prop_list);
+}
+
+} // namespace
+
+TEST(IBusControllerImplTest, TestFindAndUpdateProperty) {
+ InputMethodPropertyList properties;
+ EXPECT_FALSE(FindAndUpdateProperty(InputMethodProperty(), &properties));
+
+ properties.push_back(
+ InputMethodProperty("key1", "label1", false, false, 0));
+ EXPECT_FALSE(FindAndUpdateProperty(InputMethodProperty(), &properties));
+ EXPECT_FALSE(FindAndUpdateProperty(
+ InputMethodProperty("keyX", "labelX", false, false, 0), &properties));
+ EXPECT_EQ(InputMethodProperty("key1", "label1", false, false, 0),
+ properties[0]);
+ EXPECT_TRUE(FindAndUpdateProperty(
+ InputMethodProperty("key1", "labelY", false, false, 0), &properties));
+ EXPECT_EQ(InputMethodProperty("key1", "labelY", false, false, 0),
+ properties[0]);
+
+ properties.push_back(
+ InputMethodProperty("key2", "label2", false, false, 0));
+ EXPECT_FALSE(FindAndUpdateProperty(InputMethodProperty(), &properties));
+ EXPECT_FALSE(FindAndUpdateProperty(
+ InputMethodProperty("keyX", "labelX", false, false, 0), &properties));
+ EXPECT_EQ(InputMethodProperty("key2", "label2", false, false, 0),
+ properties[1]);
+ EXPECT_TRUE(FindAndUpdateProperty(
+ InputMethodProperty("key2", "labelZ", false, false, 0), &properties));
+ EXPECT_EQ(InputMethodProperty("key2", "labelZ", false, false, 0),
+ properties[1]);
+}
+
+} // namespace input_method
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698