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

Side by Side Diff: chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2_unittest.cc

Issue 1068093002: Refactoring for InputMethodAuraLinux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removes unexpected 229 keydown for non-IME users. Created 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 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 "chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h"
6
7 #include "base/strings/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace libgtk2ui {
11
12 class X11InputMethodContextImplGtk2FriendTest : public testing::Test {
13 };
14
15 TEST_F(X11InputMethodContextImplGtk2FriendTest, GtkCommitSignalTrap) {
16 libgtk2ui::X11InputMethodContextImplGtk2::GtkCommitSignalTrap trap;
17
18 // Test the initial state.
19 EXPECT_FALSE(trap.IsSignalCaught());
20 EXPECT_FALSE(trap.Trap(base::string16()));
21 EXPECT_FALSE(trap.IsSignalCaught());
22
23 // Cases which don't match the target keyval.
24 trap.StartTrap('t');
25 EXPECT_FALSE(trap.Trap(base::UTF8ToUTF16("T")));
26 EXPECT_FALSE(trap.IsSignalCaught());
27 EXPECT_FALSE(trap.Trap(base::UTF8ToUTF16("true")));
28 EXPECT_FALSE(trap.IsSignalCaught());
29
30 // Do not catch when the trap is not activated.
31 trap.StopTrap();
32 EXPECT_FALSE(trap.Trap(base::UTF8ToUTF16("t")));
33 EXPECT_FALSE(trap.IsSignalCaught());
34
35 // Successive calls don't break anything.
36 trap.StopTrap();
37 trap.StopTrap();
38 EXPECT_FALSE(trap.Trap(base::UTF8ToUTF16("t")));
39 EXPECT_FALSE(trap.IsSignalCaught());
40 trap.StartTrap('f');
41 trap.StartTrap('t');
42 EXPECT_TRUE(trap.Trap(base::UTF8ToUTF16("t")));
43 EXPECT_TRUE(trap.IsSignalCaught());
44
45 // StartTrap() resets the state.
46 trap.StartTrap('t');
47 EXPECT_FALSE(trap.IsSignalCaught());
48 // Many times calls to Trap() are okay.
49 EXPECT_FALSE(trap.Trap(base::UTF8ToUTF16("f")));
50 EXPECT_FALSE(trap.IsSignalCaught());
51 EXPECT_TRUE(trap.Trap(base::UTF8ToUTF16("t")));
52 EXPECT_TRUE(trap.IsSignalCaught());
53 }
54
55 } // namespace libgtk2ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698