Chromium Code Reviews| Index: components/autofill/core/browser/autofill_metrics_unittest.cc |
| diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc |
| index ed36d534fa456159b64d44b4f02352767a599d90..4266354917a52125a21e410f67dd82fbe324ce8f 100644 |
| --- a/components/autofill/core/browser/autofill_metrics_unittest.cc |
| +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc |
| @@ -21,6 +21,7 @@ |
| #include "components/autofill/core/browser/test_autofill_client.h" |
| #include "components/autofill/core/browser/test_autofill_driver.h" |
| #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| +#include "components/autofill/core/common/autofill_l10n_util.h" |
| #include "components/autofill/core/common/autofill_pref_names.h" |
| #include "components/autofill/core/common/form_data.h" |
| #include "components/autofill/core/common/form_field_data.h" |
| @@ -32,6 +33,7 @@ |
| #include "components/webdata/common/web_data_results.h" |
| #include "testing/gmock/include/gmock/gmock.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| +#include "third_party/icu/source/common/unicode/locid.h" |
| #include "ui/gfx/geometry/rect.h" |
| #include "url/gurl.h" |
| @@ -40,6 +42,7 @@ using base::Bucket; |
| using base::TimeTicks; |
| using rappor::TestRapporService; |
| using ::testing::ElementsAre; |
| +using icu::Locale; |
| namespace autofill { |
| namespace { |
| @@ -3190,6 +3193,26 @@ TEST_F(AutofillMetricsTest, ProfileActionOnFormSubmitted) { |
| 1); |
| } |
| +// Test the success in the creation of the ICU Collator. |
| +TEST_F(AutofillMetricsTest, IcuCollatorCreationSuccess) { |
| + base::HistogramTester histogram_tester; |
| + l10n::CaseInsensitiveCompare compare; |
| + histogram_tester.ExpectUniqueSample("Autofill.IcuCollatorCreationSuccess", |
| + true, 1); |
| +} |
| + |
| +// Test the failure in creating the ICU Collator. |
| +TEST_F(AutofillMetricsTest, IcuCollatorCreationSuccess_BadLocale) { |
| + // Setting the locale to a bogus value. |
| + Locale bogusLocale = Locale::createFromName("garbage"); |
| + bogusLocale.setToBogus(); |
| + |
| + base::HistogramTester histogram_tester; |
| + l10n::CaseInsensitiveCompare compare(bogusLocale); |
|
Ilya Sherman
2015/11/19 22:31:20
Rather than creating a test-only constructor, coul
Mathieu
2015/11/20 16:19:38
It was my first thought as well. I tried to call s
|
| + histogram_tester.ExpectUniqueSample("Autofill.IcuCollatorCreationSuccess", |
| + false, 1); |
| +} |
| + |
| // Test class that shares setup code for testing ParseQueryResponse. |
| class AutofillMetricsParseQueryResponseTest : public testing::Test { |
| public: |