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

Unified Diff: components/cronet/ios/test/cronet_acceptlang_test.mm

Issue 2665703002: [cronet] Make getAcceptLanguages index a static table instead of the application bundle. (Closed)
Patch Set: address rob's comments Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« components/cronet/ios/Cronet.mm ('K') | « components/cronet/ios/test/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/ios/test/cronet_acceptlang_test.mm
diff --git a/components/cronet/ios/test/cronet_acceptlang_test.mm b/components/cronet/ios/test/cronet_acceptlang_test.mm
new file mode 100644
index 0000000000000000000000000000000000000000..847874ec16381401b66a385940dc159f39c6eccc
--- /dev/null
+++ b/components/cronet/ios/test/cronet_acceptlang_test.mm
@@ -0,0 +1,41 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import <Cronet/Cronet.h>
+#import <Foundation/Foundation.h>
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+@interface Cronet (ExposedForTesting)
++ (NSString*)getAcceptLanguagesFromNSLocale:(NSLocale*)locale;
+@end
+
+namespace cronet {
+
+#define EXPECT_NSEQ(a, b) EXPECT_TRUE([(a) isEqual:(b)])
+
+TEST(AcceptLangTest, Region) {
+ NSString* acceptLangs = [Cronet
+ getAcceptLanguagesFromNSLocale:[NSLocale
+ localeWithLocaleIdentifier:@"en-GB"]];
+
+ EXPECT_NSEQ(acceptLangs, @"en-GB,en-US,en");
+}
+
+TEST(AcceptLangTest, Lang) {
+ NSString* acceptLangs = [Cronet
+ getAcceptLanguagesFromNSLocale:[NSLocale
+ localeWithLocaleIdentifier:@"ja-JP"]];
+
+ EXPECT_NSEQ(acceptLangs, @"ja,en-US,en");
+}
+
+TEST(AcceptLangTest, Default) {
+ NSString* acceptLangs =
+ [Cronet getAcceptLanguagesFromNSLocale:
+ [NSLocale localeWithLocaleIdentifier:@"lol-LOL"]];
+
+ EXPECT_NSEQ(acceptLangs, @"en-US,en");
+}
+}
« components/cronet/ios/Cronet.mm ('K') | « components/cronet/ios/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698