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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « ui/base/ime/chromeos/ime_keyboard_mus.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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.
4
5 #include "base/logging.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/base/ime/chromeos/fake_ime_keyboard.h"
8 #include "ui/base/ime/chromeos/ime_keyboard.h"
9
10 namespace chromeos {
11 namespace input_method {
12
13 namespace {
14
15 class ImeKeyboardTest : public testing::Test,
16 public ImeKeyboard::Observer {
17 public:
18 void SetUp() override {
19 xkey_.reset(new FakeImeKeyboard());
20 xkey_->AddObserver(this);
21 caps_changed_ = false;
22 }
23 void TearDown() override {
24 xkey_->RemoveObserver(this);
25 xkey_.reset();
26 }
27 void OnCapsLockChanged(bool enabled) override {
28 caps_changed_ = true;
29 }
30 void OnLayoutChanging(const std::string& layout_name) override {
31 layout_changed_ = true;
32 }
33 void VerifyCapsLockChanged(bool changed) {
34 EXPECT_EQ(changed, caps_changed_);
35 caps_changed_ = false;
36 }
37 void VerifyLayoutChanged(bool changed) {
38 EXPECT_EQ(changed, layout_changed_);
39 layout_changed_ = false;
40 }
41 std::unique_ptr<ImeKeyboard> xkey_;
42 bool caps_changed_;
43 bool layout_changed_;
44 };
45
46 // Tests CheckLayoutName() function.
47 TEST_F(ImeKeyboardTest, TestObserver) {
48 xkey_->SetCapsLockEnabled(true);
49 VerifyCapsLockChanged(true);
50 xkey_->SetCurrentKeyboardLayoutByName("foo");
51 VerifyLayoutChanged(true);
52 }
53
54 } // namespace
55
56 } // namespace input_method
57 } // namespace chromeos
OLDNEW
« 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