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

Side by Side Diff: components/language_usage_metrics/language_usage_metrics_unittest.cc

Issue 131203002: Move LanguageUsageMetrics and TranslateBrowserMetrics to components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 11 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
« no previous file with comments | « components/language_usage_metrics/language_usage_metrics.cc ('k') | components/translate.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/language_usage_metrics.h" 5 #include "components/language_usage_metrics/language_usage_metrics.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace language_usage_metrics {
10
9 TEST(LanguageUsageMetricsTest, ParseAcceptLanguages) { 11 TEST(LanguageUsageMetricsTest, ParseAcceptLanguages) {
10 std::set<int> language_set; 12 std::set<int> language_set;
11 std::set<int>::const_iterator it; 13 std::set<int>::const_iterator it;
12 14
13 const int ENGLISH = 25966; 15 const int ENGLISH = 25966;
14 const int SPANISH = 25971; 16 const int SPANISH = 25971;
15 const int JAPANESE = 27233; 17 const int JAPANESE = 27233;
16 18
17 // Basic single language case. 19 // Basic single language case.
18 LanguageUsageMetrics::ParseAcceptLanguages("ja", &language_set); 20 LanguageUsageMetrics::ParseAcceptLanguages("ja", &language_set);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 EXPECT_EQ(JAPANESE, LanguageUsageMetrics::ToLanguageCode("ja-JP")); 96 EXPECT_EQ(JAPANESE, LanguageUsageMetrics::ToLanguageCode("ja-JP"));
95 97
96 // Invalid locales are considered as unknown language. 98 // Invalid locales are considered as unknown language.
97 EXPECT_EQ(0, LanguageUsageMetrics::ToLanguageCode(std::string())); 99 EXPECT_EQ(0, LanguageUsageMetrics::ToLanguageCode(std::string()));
98 EXPECT_EQ(0, LanguageUsageMetrics::ToLanguageCode("1234")); 100 EXPECT_EQ(0, LanguageUsageMetrics::ToLanguageCode("1234"));
99 101
100 // "xx" is not acceptable because it doesn't exist in ISO 639-1 table. 102 // "xx" is not acceptable because it doesn't exist in ISO 639-1 table.
101 // However, LanguageUsageMetrics doesn't tell what code is valid. 103 // However, LanguageUsageMetrics doesn't tell what code is valid.
102 EXPECT_EQ(30840, LanguageUsageMetrics::ToLanguageCode("xx")); 104 EXPECT_EQ(30840, LanguageUsageMetrics::ToLanguageCode("xx"));
103 } 105 }
106
107 } // namespace language_usage_metrics
OLDNEW
« no previous file with comments | « components/language_usage_metrics/language_usage_metrics.cc ('k') | components/translate.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698