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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/AcceptLanguagesResolverTest.cpp

Issue 2213393002: Defer computing localeForHan until needed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: drott review Created 4 years, 4 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 | « third_party/WebKit/Source/platform/fonts/AcceptLanguagesResolver.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/fonts/AcceptLanguagesResolver.h" 5 #include "platform/fonts/AcceptLanguagesResolver.h"
6 6
7 #include "platform/LayoutLocale.h" 7 #include "platform/LayoutLocale.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 TEST(AcceptLanguagesResolverTest, AcceptLanguagesChanged) 12 TEST(AcceptLanguagesResolverTest, AcceptLanguagesChanged)
13 { 13 {
14 struct { 14 struct {
15 const char* acceptLanguages; 15 const char* acceptLanguages;
16 UScriptCode script; 16 UScriptCode script;
17 const char* locale; 17 const char* locale;
18 } tests[] = { 18 } tests[] = {
19 // Non-Han script cases. 19 // Non-Han script cases.
20 { nullptr, USCRIPT_COMMON, nullptr },
20 { "", USCRIPT_COMMON, nullptr }, 21 { "", USCRIPT_COMMON, nullptr },
21 { "en-US", USCRIPT_COMMON, nullptr }, 22 { "en-US", USCRIPT_COMMON, nullptr },
22 { ",en-US", USCRIPT_COMMON, nullptr }, 23 { ",en-US", USCRIPT_COMMON, nullptr },
23 24
24 // Single value cases. 25 // Single value cases.
25 { "ja-JP", USCRIPT_KATAKANA_OR_HIRAGANA, "ja-jp" }, 26 { "ja-JP", USCRIPT_KATAKANA_OR_HIRAGANA, "ja-jp" },
26 { "ko-KR", USCRIPT_HANGUL, "ko-kr" }, 27 { "ko-KR", USCRIPT_HANGUL, "ko-kr" },
27 { "zh-CN", USCRIPT_SIMPLIFIED_HAN, "zh-Hans" }, 28 { "zh-CN", USCRIPT_SIMPLIFIED_HAN, "zh-Hans" },
28 { "zh-HK", USCRIPT_TRADITIONAL_HAN, "zh-Hant" }, 29 { "zh-HK", USCRIPT_TRADITIONAL_HAN, "zh-Hant" },
29 { "zh-TW", USCRIPT_TRADITIONAL_HAN, "zh-Hant" }, 30 { "zh-TW", USCRIPT_TRADITIONAL_HAN, "zh-Hant" },
(...skipping 26 matching lines...) Expand all
56 } 57 }
57 58
58 ASSERT_NE(nullptr, locale) << test.acceptLanguages; 59 ASSERT_NE(nullptr, locale) << test.acceptLanguages;
59 EXPECT_EQ(test.script, locale->scriptForHan()) << test.acceptLanguages; 60 EXPECT_EQ(test.script, locale->scriptForHan()) << test.acceptLanguages;
60 EXPECT_STRCASEEQ(test.locale, locale->localeForHanForSkFontMgr()) 61 EXPECT_STRCASEEQ(test.locale, locale->localeForHanForSkFontMgr())
61 << test.acceptLanguages; 62 << test.acceptLanguages;
62 } 63 }
63 } 64 }
64 65
65 } // namespace blink 66 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/AcceptLanguagesResolver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698