Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
|
mef
2017/02/06 16:21:05
nit: 2017
lilyhoughton
2017/02/06 17:54:55
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import <Cronet/Cronet.h> | |
| 6 #import <Foundation/Foundation.h> | |
| 7 | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 | |
| 10 @interface Cronet (ExposedForTesting) | |
| 11 + (NSString*)getAcceptLanguagesFromNSLocale:(NSLocale*)locale; | |
| 12 @end | |
| 13 | |
| 14 namespace cronet { | |
| 15 | |
| 16 #define EXPECT_NSEQ(a, b) EXPECT_TRUE([(a) isEqual:(b)]) | |
| 17 | |
| 18 TEST(AcceptLangTest, Region) { | |
| 19 NSString* acceptLangs = [Cronet | |
| 20 getAcceptLanguagesFromNSLocale:[NSLocale | |
| 21 localeWithLocaleIdentifier:@"en-GB"]]; | |
| 22 | |
| 23 EXPECT_NSEQ(acceptLangs, @"en-GB,en-US,en"); | |
| 24 } | |
| 25 | |
| 26 TEST(AcceptLangTest, Lang) { | |
| 27 NSString* acceptLangs = [Cronet | |
| 28 getAcceptLanguagesFromNSLocale:[NSLocale | |
| 29 localeWithLocaleIdentifier:@"ja-JP"]]; | |
|
mef
2017/02/06 16:21:05
did you mean to specify just 'ja'?
lilyhoughton
2017/02/06 17:54:55
No, this is testing the behavior that if a languag
mef
2017/02/16 19:20:29
Acknowledged.
| |
| 30 | |
| 31 EXPECT_NSEQ(acceptLangs, @"ja,en-US,en"); | |
| 32 } | |
| 33 | |
| 34 TEST(AcceptLangTest, Default) { | |
| 35 NSString* acceptLangs = | |
| 36 [Cronet getAcceptLanguagesFromNSLocale: | |
| 37 [NSLocale localeWithLocaleIdentifier:@"lol-LOL"]]; | |
| 38 | |
| 39 EXPECT_NSEQ(acceptLangs, @"en-US,en"); | |
| 40 } | |
| 41 } | |
| OLD | NEW |