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

Unified Diff: ui/base/ime/chromeos/ime_keyboard_unittest.cc

Issue 2925353002: Implement sync of keyboard layout between Ozone and Wayland clients (Closed)
Patch Set: Rebase on master Created 3 years, 6 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
« no previous file with comments | « ui/base/ime/chromeos/ime_keyboard_mus.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/ime/chromeos/ime_keyboard_unittest.cc
diff --git a/ui/base/ime/chromeos/ime_keyboard_unittest.cc b/ui/base/ime/chromeos/ime_keyboard_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1b8bc556d6b3d8d649d525626a8f86a9d5beb8f5
--- /dev/null
+++ b/ui/base/ime/chromeos/ime_keyboard_unittest.cc
@@ -0,0 +1,57 @@
+// Copyright 2017 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 "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/ime/chromeos/fake_ime_keyboard.h"
+#include "ui/base/ime/chromeos/ime_keyboard.h"
+
+namespace chromeos {
+namespace input_method {
+
+namespace {
+
+class ImeKeyboardTest : public testing::Test,
+ public ImeKeyboard::Observer {
+ public:
+ void SetUp() override {
+ xkey_.reset(new FakeImeKeyboard());
+ xkey_->AddObserver(this);
+ caps_changed_ = false;
+ }
+ void TearDown() override {
+ xkey_->RemoveObserver(this);
+ xkey_.reset();
+ }
+ void OnCapsLockChanged(bool enabled) override {
+ caps_changed_ = true;
+ }
+ void OnLayoutChanging(const std::string& layout_name) override {
+ layout_changed_ = true;
+ }
+ void VerifyCapsLockChanged(bool changed) {
+ EXPECT_EQ(changed, caps_changed_);
+ caps_changed_ = false;
+ }
+ void VerifyLayoutChanged(bool changed) {
+ EXPECT_EQ(changed, layout_changed_);
+ layout_changed_ = false;
+ }
+ std::unique_ptr<ImeKeyboard> xkey_;
+ bool caps_changed_;
+ bool layout_changed_;
+};
+
+// Tests CheckLayoutName() function.
+TEST_F(ImeKeyboardTest, TestObserver) {
+ xkey_->SetCapsLockEnabled(true);
+ VerifyCapsLockChanged(true);
+ xkey_->SetCurrentKeyboardLayoutByName("foo");
+ VerifyLayoutChanged(true);
+}
+
+} // namespace
+
+} // namespace input_method
+} // namespace chromeos
« no previous file with comments | « ui/base/ime/chromeos/ime_keyboard_mus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698