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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/cros_language_options_handler_unittest.cc

Issue 2919343005: Remove tests for deprecated Options UI (Closed)
Patch Set: and more 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler .h"
6
7 #include <memory>
8
9 #include "base/values.h"
10 #include "chrome/browser/chromeos/input_method/input_method_configuration.h"
11 #include "chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace chromeos {
15 namespace options {
16
17 class CrosLanguageOptionsHandlerTest : public testing::Test {
18 public:
19 CrosLanguageOptionsHandlerTest()
20 : input_manager_(new MockInputMethodManagerWithInputMethods) {
21 chromeos::input_method::InitializeForTesting(input_manager_);
22 }
23
24 ~CrosLanguageOptionsHandlerTest() override {
25 chromeos::input_method::Shutdown();
26 }
27
28 // testing::Test:
29 void SetUp() override {
30 input_manager_->AddInputMethod("xkb:us::eng", "us", "en-US");
31 input_manager_->AddInputMethod("xkb:fr::fra", "fr", "fr");
32 input_manager_->AddInputMethod("xkb:be::fra", "be", "fr");
33 input_manager_->AddInputMethod("xkb:is::ice", "is", "is");
34 }
35
36 private:
37 MockInputMethodManagerWithInputMethods* input_manager_;
38 };
39
40 TEST_F(CrosLanguageOptionsHandlerTest, GetInputMethodList) {
41 std::unique_ptr<base::ListValue> list(
42 CrosLanguageOptionsHandler::GetInputMethodList());
43 ASSERT_EQ(4U, list->GetSize());
44
45 base::DictionaryValue* entry = NULL;
46 base::DictionaryValue *language_code_set = NULL;
47 std::string input_method_id;
48 std::string display_name;
49 std::string language_code;
50
51 // As shown below, the list should be input method ids should appear in
52 // the same order of the descriptors.
53 ASSERT_TRUE(list->GetDictionary(0, &entry));
54 ASSERT_TRUE(entry->GetString("id", &input_method_id));
55 ASSERT_TRUE(entry->GetString("displayName", &display_name));
56 ASSERT_TRUE(entry->GetDictionary("languageCodeSet", &language_code_set));
57 EXPECT_EQ("xkb:us::eng", input_method_id);
58 // Commented out as it depends on translation in generated_resources.grd
59 // (i.e. makes the test fragile).
60 // EXPECT_EQ("English (USA) keyboard layout", display_name);
61 ASSERT_TRUE(language_code_set->HasKey("en-US"));
62
63 ASSERT_TRUE(list->GetDictionary(1, &entry));
64 ASSERT_TRUE(entry->GetString("id", &input_method_id));
65 ASSERT_TRUE(entry->GetString("displayName", &display_name));
66 ASSERT_TRUE(entry->GetDictionary("languageCodeSet", &language_code_set));
67 EXPECT_EQ("xkb:fr::fra", input_method_id);
68 // Commented out. See above.
69 // EXPECT_EQ("French keyboard layout", display_name);
70 ASSERT_TRUE(language_code_set->HasKey("fr"));
71
72 ASSERT_TRUE(list->GetDictionary(2, &entry));
73 ASSERT_TRUE(entry->GetString("id", &input_method_id));
74 ASSERT_TRUE(entry->GetString("displayName", &display_name));
75 ASSERT_TRUE(entry->GetDictionary("languageCodeSet", &language_code_set));
76 EXPECT_EQ("xkb:be::fra", input_method_id);
77 // Commented out. See above.
78 // EXPECT_EQ("Belgian keyboard layout", display_name);
79 ASSERT_TRUE(language_code_set->HasKey("fr"));
80
81 ASSERT_TRUE(list->GetDictionary(3, &entry));
82 ASSERT_TRUE(entry->GetString("id", &input_method_id));
83 ASSERT_TRUE(entry->GetString("displayName", &display_name));
84 ASSERT_TRUE(entry->GetDictionary("languageCodeSet", &language_code_set));
85 EXPECT_EQ("xkb:is::ice", input_method_id);
86 // Commented out. See above.
87 // EXPECT_EQ("Japanese input method (for US keyboard)", display_name);
88 ASSERT_TRUE(language_code_set->HasKey("is"));
89 }
90
91 } // namespace options
92 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698