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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: MakeUnique Created 4 years, 2 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/webui/chromeos/login/l10n_util.h" 5 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility>
10
9 #include "base/at_exit.h" 11 #include "base/at_exit.h"
10 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
13 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
14 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
15 #include "base/run_loop.h" 17 #include "base/run_loop.h"
16 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
17 #include "base/values.h" 19 #include "base/values.h"
18 #include "chrome/browser/chromeos/customization/customization_document.h" 20 #include "chrome/browser/chromeos/customization/customization_document.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // This requires initialized StatisticsProvider (see L10nUtilTest()). 132 // This requires initialized StatisticsProvider (see L10nUtilTest()).
131 std::unique_ptr<base::ListValue> list(GetUILanguageList(NULL, std::string())); 133 std::unique_ptr<base::ListValue> list(GetUILanguageList(NULL, std::string()));
132 134
133 VerifyOnlyUILanguages(*list); 135 VerifyOnlyUILanguages(*list);
134 } 136 }
135 137
136 TEST_F(L10nUtilTest, FindMostRelevantLocale) { 138 TEST_F(L10nUtilTest, FindMostRelevantLocale) {
137 base::ListValue available_locales; 139 base::ListValue available_locales;
138 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); 140 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
139 dict->SetString("value", "de"); 141 dict->SetString("value", "de");
140 available_locales.Append(dict.release()); 142 available_locales.Append(std::move(dict));
141 dict.reset(new base::DictionaryValue); 143 dict.reset(new base::DictionaryValue);
142 dict->SetString("value", "fr"); 144 dict->SetString("value", "fr");
143 available_locales.Append(dict.release()); 145 available_locales.Append(std::move(dict));
144 dict.reset(new base::DictionaryValue); 146 dict.reset(new base::DictionaryValue);
145 dict->SetString("value", "en-GB"); 147 dict->SetString("value", "en-GB");
146 available_locales.Append(dict.release()); 148 available_locales.Append(std::move(dict));
147 149
148 std::vector<std::string> most_relevant_language_codes; 150 std::vector<std::string> most_relevant_language_codes;
149 EXPECT_EQ("en-US", FindMostRelevantLocale(most_relevant_language_codes, 151 EXPECT_EQ("en-US", FindMostRelevantLocale(most_relevant_language_codes,
150 available_locales, 152 available_locales,
151 "en-US")); 153 "en-US"));
152 154
153 most_relevant_language_codes.push_back("xx"); 155 most_relevant_language_codes.push_back("xx");
154 EXPECT_EQ("en-US", FindMostRelevantLocale(most_relevant_language_codes, 156 EXPECT_EQ("en-US", FindMostRelevantLocale(most_relevant_language_codes,
155 available_locales, 157 available_locales,
156 "en-US")); 158 "en-US"));
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 VerifyOnlyUILanguages(*list); 221 VerifyOnlyUILanguages(*list);
220 222
221 ASSERT_LE(3u, list->GetSize()); 223 ASSERT_LE(3u, list->GetSize());
222 224
223 VerifyLanguageCode(*list, 0, "it"); 225 VerifyLanguageCode(*list, 0, "it");
224 VerifyLanguageCode(*list, 1, "de"); 226 VerifyLanguageCode(*list, 1, "de");
225 VerifyLanguageCode(*list, 2, kMostRelevantLanguagesDivider); 227 VerifyLanguageCode(*list, 2, kMostRelevantLanguagesDivider);
226 } 228 }
227 229
228 } // namespace chromeos 230 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/l10n_util.cc ('k') | chrome/browser/ui/webui/chromeos/login/network_dropdown.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698