| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |