Skip to content

Commit

Permalink
Roll ICU to icu52
Browse files Browse the repository at this point in the history
The ICU update does the following among other things:
  - Update EUC-JP (no more JIS X 212 round-trip coverage) per WHATWG 
    encoding spec.
  - Add CP866
  - Add far better/more extensive support for plural, format, etc
  - Numerous locale data update
  - Khmer/Lao line/word-breaking support
  - More compact Chinese/Japanese dictionary (now a part of the upstream
    instead of our local patch)
  - Better plural support that we plan to use right away.

- Update icu/BUILD.gn : file list update, new defines, etc.
- Update tests
  a. icu_string_conversions_unittests : drop iscii (nobody uses it) and
     remove JIS X 212 code points from the round-trip test
  b. l10n_util_unittests: Display names for zh-*.
  c. ThaiSnippet's expected result. (due to a Unicode grapheme definition change).
  d. Update Expected results in file_manager_browsertest/test_util.js
     (see http://crbug.com/383930)
- Update SpellcheckerWordIterator 
  a. Add U+0027 back to MidNumLet
  b. Add Lao and Khmer scripts to the list of scripts requiring dictionary-based
     word-breaking.
- l10n_util : alias 'tl' to 'fil' (Tagalog to Filipino) 
- Update IdentityInternalsSingleTokenWebUITest.verifyGetters (DateTimeFormat-Full
  has 'at' before time, which is not handled by Date.parse()
- update license.py because we don't have a separate Chinese/Japanese
  dictionary any more. It's now a part of ICU

BUG=132145,277023,136148,360433,364072
TEST=base_unittests:*ICU*, net_unittests:*IDN*, ui_unittests:*Lang*,
     browser_tests (encoding related, Iden*verifyGet*), 
     unit_tests:Ext*L10*, unit_tests:*Lang*, component_tests:*Snipp*,
     layout tests (encoding, date/calendar, line breaking, and others),
     build 'base_i18n_nacl', GN build bots.

Review URL: https://codereview.chromium.org/265613002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277111 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jshin@chromium.org committed Jun 13, 2014
1 parent 0823c68 commit 6589d67
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 184 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ deps = {
"/external/w3c/csswg-test.git@bacbb4a8dca702cd86646761fde96793db13d4f1",

"src/third_party/icu":
"/trunk/deps/third_party/icu46@262949",
"/trunk/deps/third_party/icu52@275893",

"src/third_party/libexif/sources":
"/trunk/deps/third_party/libexif/sources@265008",
Expand Down
18 changes: 2 additions & 16 deletions base/i18n/icu_string_conversions_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,6 @@ static const struct {
true,
L"\x05E9\x05C1\x05B8\x05DC\x05D5\x05B9\x05DD",
NULL},
// Hindi Devanagari (ISCII)
{"iscii-dev",
"\xEF\x42" "\xC6\xCC\xD7\xE8\xB3\xDA\xCF",
OnStringConversionError::FAIL,
true,
L"\x0928\x092E\x0938\x094D\x0915\x093E\x0930",
NULL},
// Korean (EUC)
{"euc-kr",
"\xBE\xC8\xB3\xE7\xC7\xCF\xBC\xBC\xBF\xE4",
Expand All @@ -202,10 +195,10 @@ static const struct {
NULL},
// Japanese (EUC)
{"euc-jp",
"\xA4\xB3\xA4\xF3\xA4\xCB\xA4\xC1\xA4\xCF\xB0\xEC\x8F\xB0\xA1\x8E\xA6",
"\xA4\xB3\xA4\xF3\xA4\xCB\xA4\xC1\xA4\xCF\xB0\xEC\x8E\xA6",
OnStringConversionError::FAIL,
true,
L"\x3053\x3093\x306B\x3061\x306F\x4E00\x4E02\xFF66",
L"\x3053\x3093\x306B\x3061\x306F\x4E00\xFF66",
NULL},
// Japanese (ISO-2022)
{"iso-2022-jp",
Expand Down Expand Up @@ -238,13 +231,6 @@ static const struct {
L"\x0E2A\x0E27\x0E31\x0E2A\x0E14\x0E35"
L"\x0E04\x0E23\x0e31\x0E1A",
NULL},
// Empty text
{"iscii-dev",
"",
OnStringConversionError::FAIL,
true,
L"",
NULL},
};

TEST(ICUStringConversionsTest, ConvertBetweenCodepageAndWide) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <set>
#include <vector>

#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/prefs/pref_change_registrar.h"
#include "base/prefs/pref_service.h"
Expand Down Expand Up @@ -621,22 +622,24 @@ TEST_F(TranslateManagerRenderViewHostTest, TestLanguages) {
}
}

// A list of languages to fake being returned by the translate server.
// Use only langauges for which Chrome's copy of ICU has
// display names in English locale. To save space, Chrome's copy of ICU
// does not have the display name for a language unless it's in the
// Accept-Language list.
static const char* server_language_list[] =
{"ach", "ak", "af", "en-CA", "zh", "yi", "fr-FR", "tl", "iw", "in", "xx"};
static const char* alpha_language_list[] = {"ach", "yi"};

// Test the fetching of languages from the translate server
TEST_F(TranslateManagerRenderViewHostTest, FetchLanguagesFromTranslateServer) {
std::vector<std::string> server_languages;
// A list of languages to fake being returned by the translate server.
server_languages.push_back("aa");
server_languages.push_back("ak");
server_languages.push_back("ab");
server_languages.push_back("en-CA");
server_languages.push_back("zh");
server_languages.push_back("yi");
server_languages.push_back("fr-FR");
server_languages.push_back("xx");
for (size_t i = 0; i < arraysize(server_language_list); ++i)
server_languages.push_back(server_language_list[i]);

std::vector<std::string> alpha_languages;
alpha_languages.push_back("aa");
alpha_languages.push_back("yi");
for (size_t i = 0; i < arraysize(alpha_language_list); ++i)
alpha_languages.push_back(alpha_language_list[i]);

// First, get the default languages list. Note that calling
// GetSupportedLanguages() invokes RequestLanguageList() internally.
Expand Down Expand Up @@ -672,11 +675,12 @@ TEST_F(TranslateManagerRenderViewHostTest, FetchLanguagesFromTranslateServer) {
EXPECT_NE(current_supported_languages.end(),
std::find(current_supported_languages.begin(),
current_supported_languages.end(),
lang));
lang)) << "lang=" << lang;
bool is_alpha =
std::find(alpha_languages.begin(), alpha_languages.end(), lang) !=
alpha_languages.end();
EXPECT_EQ(TranslateDownloadManager::IsAlphaLanguage(lang), is_alpha);
EXPECT_EQ(TranslateDownloadManager::IsAlphaLanguage(lang),
is_alpha) << "lang=" << lang;
}
}

Expand All @@ -685,18 +689,12 @@ TEST_F(TranslateManagerRenderViewHostTest, FetchLanguagesFromTranslateServer) {
TEST_F(TranslateManagerRenderViewHostTest,
FetchLanguagesFromTranslateServerWithoutAlpha) {
std::vector<std::string> server_languages;
server_languages.push_back("aa");
server_languages.push_back("ak");
server_languages.push_back("ab");
server_languages.push_back("en-CA");
server_languages.push_back("zh");
server_languages.push_back("yi");
server_languages.push_back("fr-FR");
server_languages.push_back("xx");
for (size_t i = 0; i < arraysize(server_language_list); ++i)
server_languages.push_back(server_language_list[i]);

std::vector<std::string> alpha_languages;
alpha_languages.push_back("aa");
alpha_languages.push_back("yi");
for (size_t i = 0; i < arraysize(alpha_language_list); ++i)
alpha_languages.push_back(alpha_language_list[i]);

// call GetSupportedLanguages to call RequestLanguageList internally.
std::vector<std::string> default_supported_languages;
Expand All @@ -718,8 +716,9 @@ TEST_F(TranslateManagerRenderViewHostTest,
EXPECT_NE(current_supported_languages.end(),
std::find(current_supported_languages.begin(),
current_supported_languages.end(),
lang));
EXPECT_FALSE(TranslateDownloadManager::IsAlphaLanguage(lang));
lang)) << "lang=" << lang;
EXPECT_FALSE(TranslateDownloadManager::IsAlphaLanguage(lang)) <<
"lang=" << lang;
}
}

Expand Down
8 changes: 6 additions & 2 deletions chrome/browser/ui/webui/identity_internals_ui_browsertest.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ BaseIdentityInternalsWebUITest.prototype = {
* @return {Date} Expiration date of the token.
*/
getExpirationTime: function(tokenEntry) {
// Full-date format has 'at' between date and time in en-US, but
// ECMAScript's Date.parse cannot grok it.
return Date.parse(tokenEntry.querySelector('.expiration-time')
.innerText);
.innerText.replace(' at ', ' '));
},

/**
Expand Down Expand Up @@ -162,9 +164,11 @@ TEST_F('IdentityInternalsSingleTokenWebUITest', 'verifyGetters', function() {
tokenListEntries[0].querySelector('.access-token').innerText);
expectEquals(this.getTokenStatus(tokenListEntries[0]),
tokenListEntries[0].querySelector('.token-status').innerText);
// Full-date format has 'at' between date and time in en-US, but
// ECMAScript's Date.parse cannot grok it.
expectEquals(this.getExpirationTime(tokenListEntries[0]),
Date.parse(tokenListEntries[0].querySelector('.expiration-time')
.innerText));
.innerText.replace(' at ', ' ')));
var scopes = tokenListEntries[0].querySelector('.scope-list')
.innerHTML.split('<br>');
var actualScopes = this.getScopes(tokenListEntries[0]);
Expand Down
8 changes: 6 additions & 2 deletions chrome/renderer/spellchecker/spellcheck_worditerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ void SpellcheckCharAttribute::CreateRuleSets(const std::string& language) {
// better, but it leads to an empty set error in Thai.
// "$ALetter = [[\\p{script=%s}] & [\\p{Word_Break = ALetter}]];"
"$ALetter = [\\p{script=%s}%s];"
"$MidNumLet = [\\p{Word_Break = MidNumLet}];"
// U+0027 (single quote/apostrophe) is not in MidNumLet any more
// in UAX 29 rev 21 or later. For our purpose, U+0027
// has to be treated as MidNumLet. ( http://crbug.com/364072 )
"$MidNumLet = [\\p{Word_Break = MidNumLet} \\u0027];"
"$MidLetter = [\\p{Word_Break = MidLetter}%s];"
"$MidNum = [\\p{Word_Break = MidNum}];"
"$Numeric = [\\p{Word_Break = Numeric}];"
Expand Down Expand Up @@ -153,7 +156,8 @@ void SpellcheckCharAttribute::CreateRuleSets(const std::string& language) {
"$ALetterPlus = [$ALetter [$dictionary-$Extend-$Control]];";
const char kWithoutDictionary[] = "$ALetterPlus = $ALetter;";
const char* aletter_plus = kWithoutDictionary;
if (script_code_ == USCRIPT_HANGUL || script_code_ == USCRIPT_THAI)
if (script_code_ == USCRIPT_HANGUL || script_code_ == USCRIPT_THAI ||
script_code_ == USCRIPT_LAO || script_code_ == USCRIPT_KHMER)
aletter_plus = kWithDictionary;

// Treat numbers as word characters except for Arabic and Hebrew.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,93 +203,93 @@ TestEntryInfo.prototype.getExpectedRow = function() {
var ENTRIES = {
hello: new TestEntryInfo(
EntryType.FILE, 'text.txt', 'hello.txt',
'text/plain', SharedOption.NONE, 'Sep 4, 1998 12:34 PM',
'text/plain', SharedOption.NONE, 'Sep 4, 1998, 12:34 PM',
'hello.txt', '51 bytes', 'Plain text'),

world: new TestEntryInfo(
EntryType.FILE, 'video.ogv', 'world.ogv',
'text/plain', SharedOption.NONE, 'Jul 4, 2012 10:35 AM',
'text/plain', SharedOption.NONE, 'Jul 4, 2012, 10:35 AM',
'world.ogv', '59 KB', 'OGG video'),

unsupported: new TestEntryInfo(
EntryType.FILE, 'random.bin', 'unsupported.foo',
'application/x-foo', SharedOption.NONE, 'Jul 4, 2012 10:36 AM',
'application/x-foo', SharedOption.NONE, 'Jul 4, 2012, 10:36 AM',
'unsupported.foo', '8 KB', 'FOO file'),

desktop: new TestEntryInfo(
EntryType.FILE, 'image.png', 'My Desktop Background.png',
'text/plain', SharedOption.NONE, 'Jan 18, 2038 1:02 AM',
'text/plain', SharedOption.NONE, 'Jan 18, 2038, 1:02 AM',
'My Desktop Background.png', '272 bytes', 'PNG image'),

image2: new TestEntryInfo(
EntryType.FILE, 'image2.png', 'image2.png',
'image/png', SharedOption.NONE, 'Jan 18, 2038 1:02 AM',
'image/png', SharedOption.NONE, 'Jan 18, 2038, 1:02 AM',
'image2.png', '272 bytes', 'PNG image'),

image3: new TestEntryInfo(
EntryType.FILE, 'image3.jpg', 'image3.jpg',
'image/jpg', SharedOption.NONE, 'Jan 18, 2038 1:02 AM',
'image/jpg', SharedOption.NONE, 'Jan 18, 2038, 1:02 AM',
'image3.jpg', '272 bytes', 'JPEG image'),

beautiful: new TestEntryInfo(
EntryType.FILE, 'music.ogg', 'Beautiful Song.ogg',
'text/plain', SharedOption.NONE, 'Nov 12, 2086 12:00 PM',
'text/plain', SharedOption.NONE, 'Nov 12, 2086, 12:00 PM',
'Beautiful Song.ogg', '14 KB', 'OGG audio'),

photos: new TestEntryInfo(
EntryType.DIRECTORY, null, 'photos',
null, SharedOption.NONE, 'Jan 1, 1980 11:59 PM',
null, SharedOption.NONE, 'Jan 1, 1980, 11:59 PM',
'photos', '--', 'Folder'),

testDocument: new TestEntryInfo(
EntryType.FILE, null, 'Test Document',
'application/vnd.google-apps.document',
SharedOption.NONE, 'Apr 10, 2013 4:20 PM',
SharedOption.NONE, 'Apr 10, 2013, 4:20 PM',
'Test Document.gdoc', '--', 'Google document'),

testSharedDocument: new TestEntryInfo(
EntryType.FILE, null, 'Test Shared Document',
'application/vnd.google-apps.document',
SharedOption.SHARED, 'Mar 20, 2013 10:40 PM',
SharedOption.SHARED, 'Mar 20, 2013, 10:40 PM',
'Test Shared Document.gdoc', '--', 'Google document'),

newlyAdded: new TestEntryInfo(
EntryType.FILE, 'music.ogg', 'newly added file.ogg',
'audio/ogg', SharedOption.NONE, 'Sep 4, 1998 12:00 AM',
'audio/ogg', SharedOption.NONE, 'Sep 4, 1998, 12:00 AM',
'newly added file.ogg', '14 KB', 'OGG audio'),

directoryA: new TestEntryInfo(
EntryType.DIRECTORY, null, 'A',
null, SharedOption.NONE, 'Jan 1, 2000 1:00 AM',
null, SharedOption.NONE, 'Jan 1, 2000, 1:00 AM',
'A', '--', 'Folder'),

directoryB: new TestEntryInfo(
EntryType.DIRECTORY, null, 'A/B',
null, SharedOption.NONE, 'Jan 1, 2000 1:00 AM',
null, SharedOption.NONE, 'Jan 1, 2000, 1:00 AM',
'B', '--', 'Folder'),

directoryC: new TestEntryInfo(
EntryType.DIRECTORY, null, 'A/B/C',
null, SharedOption.NONE, 'Jan 1, 2000 1:00 AM',
null, SharedOption.NONE, 'Jan 1, 2000, 1:00 AM',
'C', '--', 'Folder'),

directoryD: new TestEntryInfo(
EntryType.DIRECTORY, null, 'D',
null, SharedOption.NONE, 'Jan 1, 2000 1:00 AM',
null, SharedOption.NONE, 'Jan 1, 2000, 1:00 AM',
'D', '--', 'Folder'),

directoryE: new TestEntryInfo(
EntryType.DIRECTORY, null, 'D/E',
null, SharedOption.NONE, 'Jan 1, 2000 1:00 AM',
null, SharedOption.NONE, 'Jan 1, 2000, 1:00 AM',
'E', '--', 'Folder'),

directoryF: new TestEntryInfo(
EntryType.DIRECTORY, null, 'D/E/F',
null, SharedOption.NONE, 'Jan 1, 2000 1:00 AM',
null, SharedOption.NONE, 'Jan 1, 2000, 1:00 AM',
'F', '--', 'Folder'),

zipArchive: new TestEntryInfo(
EntryType.FILE, 'archive.zip', 'archive.zip',
'application/x-zip', SharedOption.NONE, 'Jan 1, 2014 1:00 AM',
'application/x-zip', SharedOption.NONE, 'Jan 1, 2014, 1:00 AM',
'archive.zip', '533 bytes', 'Zip archive')
};
4 changes: 2 additions & 2 deletions components/query_parser/snippet.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ class Snippet {
// with no overlapping elements.
//
// NOTE: the positions returned are in terms of UTF8 encoding. To convert the
// offsets to wide, use ConvertMatchPositionsToWide.
// offsets to UTF-16, use ConvertMatchPositionsToWide
static void ExtractMatchPositions(const std::string& offsets_str,
const std::string& column_num,
MatchPositions* match_positions);

// Converts match positions as returned from ExtractMatchPositions to be in
// terms of a wide string.
// terms of a UTF-16 2-byte code unit.
static void ConvertMatchPositionsToWide(
const std::string& utf8_string,
Snippet::MatchPositions* match_positions);
Expand Down
Loading

0 comments on commit 6589d67

Please sign in to comment.