Chromium Code Reviews

Side by Side Diff: components/autofill/core/common/autofill_l10n_util_unittest.cc

Issue 1457393003: [Autofill] Guard against the initialization failure of ICU Collator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: UBool Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(Empty)
1 // Copyright 2015 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 "components/autofill/core/common/autofill_l10n_util.h"
6
7 #include "base/test/histogram_tester.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/icu/source/common/unicode/locid.h"
10
11 namespace autofill {
12 namespace l10n {
13
14 // Test the success in the creation of the ICU Collator.
15 TEST(CaseInsensitiveCompareTest, IcuCollatorCreation_Success) {
16 base::HistogramTester histogram_tester;
17 CaseInsensitiveCompare compare;
18 histogram_tester.ExpectUniqueSample("Autofill.IcuCollatorCreationSuccess",
19 true, 1);
20 }
21
22 // Test the failure in creating the ICU Collator.
23 TEST(CaseInsensitiveCompareTest, IcuCollatorCreation_FailureBadLocale) {
24 // Setting the locale to a bogus value.
25 icu::Locale bogusLocale = icu::Locale::createFromName("bogus");
26 bogusLocale.setToBogus();
27
28 base::HistogramTester histogram_tester;
29 CaseInsensitiveCompare compare(bogusLocale);
30 histogram_tester.ExpectUniqueSample("Autofill.IcuCollatorCreationSuccess",
31 false, 1);
32 }
33
34 } // namespace l10n
35 } // namespace autofill
OLDNEW

Powered by Google App Engine