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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_descriptor_unittest.cc

Issue 10388181: Remove virtual keyboard support from input_method_descriptor.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "chrome/browser/chromeos/input_method/input_method_descriptor.h" 6 #include "chrome/browser/chromeos/input_method/input_method_descriptor.h"
7 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h"
8 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
9 8
10 namespace chromeos { 9 namespace chromeos {
11 namespace input_method { 10 namespace input_method {
12 11
13 namespace { 12 namespace {
14 13
15 const char kFallbackLayout[] = "us"; 14 const char kFallbackLayout[] = "us";
16 15
17 class InputMethodDescriptorTest : public testing::Test { 16 class InputMethodDescriptorTest : public testing::Test {
18 public: 17 public:
19 InputMethodDescriptorTest() { 18 InputMethodDescriptorTest() {
20 } 19 }
21 20
22 protected: 21 protected:
23 InputMethodDescriptor GetDesc(const std::string& raw_layout) {
24 return InputMethodDescriptor(whitelist_,
25 "id",
26 "", // name
27 raw_layout,
28 "language_code");
29 }
30
31 InputMethodDescriptor GetDescById(const std::string& id) { 22 InputMethodDescriptor GetDescById(const std::string& id) {
32 return InputMethodDescriptor(whitelist_, 23 return InputMethodDescriptor(id,
33 id,
34 "", // name 24 "", // name
35 "us", 25 "us",
36 "language_code"); 26 "language_code");
37 } 27 }
38
39 private:
40 const InputMethodWhitelist whitelist_;
41 }; 28 };
42 29
43 } // namespace 30 } // namespace
44 31
45 TEST_F(InputMethodDescriptorTest, TestCreateInputMethodDescriptor) {
46 EXPECT_EQ("us", GetDesc("us").keyboard_layout());
47 EXPECT_EQ("us", GetDesc("us,us(dvorak)").keyboard_layout());
48 EXPECT_EQ("us(dvorak)", GetDesc("us(dvorak),us").keyboard_layout());
49
50 EXPECT_EQ("fr", GetDesc("fr").keyboard_layout());
51 EXPECT_EQ("fr", GetDesc("fr,us(dvorak)").keyboard_layout());
52 EXPECT_EQ("us(dvorak)", GetDesc("us(dvorak),fr").keyboard_layout());
53
54 EXPECT_EQ("fr", GetDesc("not-supported,fr").keyboard_layout());
55 EXPECT_EQ("fr", GetDesc("fr,not-supported").keyboard_layout());
56
57 EXPECT_EQ(kFallbackLayout, GetDesc("not-supported").keyboard_layout());
58 EXPECT_EQ(kFallbackLayout, GetDesc(",").keyboard_layout());
59 EXPECT_EQ(kFallbackLayout, GetDesc("").keyboard_layout());
60 }
61
62 TEST_F(InputMethodDescriptorTest, TestOperatorEqual) { 32 TEST_F(InputMethodDescriptorTest, TestOperatorEqual) {
63 EXPECT_EQ(GetDescById("xkb:us::eng"), GetDescById("xkb:us::eng")); 33 EXPECT_EQ(GetDescById("xkb:us::eng"), GetDescById("xkb:us::eng"));
64 EXPECT_NE(GetDescById("xkb:us::eng"), GetDescById("xkb:us:dvorak:eng")); 34 EXPECT_NE(GetDescById("xkb:us::eng"), GetDescById("xkb:us:dvorak:eng"));
65 EXPECT_NE(GetDescById("xkb:fr::fra"), GetDescById("xkb:us::eng")); 35 EXPECT_NE(GetDescById("xkb:fr::fra"), GetDescById("xkb:us::eng"));
66 } 36 }
67 37
68 } // namespace input_method 38 } // namespace input_method
69 } // namespace chromeos 39 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698