summaryrefslogtreecommitdiffstats
path: root/net/ftp/ftp_util_unittest.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 09:29:54 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 09:29:54 +0000
commit82acbaaacf50d6ac2db1e810839939a278e96833 (patch)
treeb9261734f168f2d5b9e8b8c3876e56465bc898a3 /net/ftp/ftp_util_unittest.cc
parent702b14e4f040653f9580644dfb8494659f210a57 (diff)
downloadchromium_src-82acbaaacf50d6ac2db1e810839939a278e96833.zip
chromium_src-82acbaaacf50d6ac2db1e810839939a278e96833.tar.gz
chromium_src-82acbaaacf50d6ac2db1e810839939a278e96833.tar.bz2
FTP: Multiple fixes for localized directory listings:
- fix detection of KOI8-R and possibly other encodings - fix parsing Russian month names When detecting the listing encoding, we need to not only check whether the data can be converted using given encoding, but also whether the result can be parsed as a valid directory listing. Also, we only need to compare the first three characters of the abbreviated month name, because that's how they're abbreviated in FTP directory listings. Finally, the Russian directory listings have swapped the "month" and "day of month" columns. BUG=65917 Review URL: http://codereview.chromium.org/6718043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81081 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp/ftp_util_unittest.cc')
-rw-r--r--net/ftp/ftp_util_unittest.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/net/ftp/ftp_util_unittest.cc b/net/ftp/ftp_util_unittest.cc
index 98ae975..4f26817 100644
--- a/net/ftp/ftp_util_unittest.cc
+++ b/net/ftp/ftp_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -125,13 +125,26 @@ TEST(FtpUtilTest, LsDateListingToTime) {
{ "Nov", "01", "2007", 2007, 11, 1, 0, 0 },
{ "Jul", "25", "13:37", 1994, 7, 25, 13, 37 },
- // Test date listings in German, we should support them for FTP servers
- // giving localized listings.
+ // Test date listings in German.
{ "M\xc3\xa4r", "13", "2009", 2009, 3, 13, 0, 0 },
{ "Mai", "1", "10:10", 1994, 5, 1, 10, 10 },
{ "Okt", "14", "21:18", 1994, 10, 14, 21, 18 },
{ "Dez", "25", "2008", 2008, 12, 25, 0, 0 },
+ // Test date listings in Russian.
+ { "\xd1\x8f\xd0\xbd\xd0\xb2", "1", "2011", 2011, 1, 1, 0, 0 },
+ { "\xd1\x84\xd0\xb5\xd0\xb2", "1", "2011", 2011, 2, 1, 0, 0 },
+ { "\xd0\xbc\xd0\xb0\xd1\x80", "1", "2011", 2011, 3, 1, 0, 0 },
+ { "\xd0\xb0\xd0\xbf\xd1\x80", "1", "2011", 2011, 4, 1, 0, 0 },
+ { "\xd0\xbc\xd0\xb0\xd0\xb9", "1", "2011", 2011, 5, 1, 0, 0 },
+ { "\xd0\xb8\xd1\x8e\xd0\xbd", "1", "2011", 2011, 6, 1, 0, 0 },
+ { "\xd0\xb8\xd1\x8e\xd0\xbb", "1", "2011", 2011, 7, 1, 0, 0 },
+ { "\xd0\xb0\xd0\xb2\xd0\xb3", "1", "2011", 2011, 8, 1, 0, 0 },
+ { "\xd1\x81\xd0\xb5\xd0\xbd", "1", "2011", 2011, 9, 1, 0, 0 },
+ { "\xd0\xbe\xd0\xba\xd1\x82", "1", "2011", 2011, 10, 1, 0, 0 },
+ { "\xd0\xbd\xd0\xbe\xd1\x8f", "1", "2011", 2011, 11, 1, 0, 0 },
+ { "\xd0\xb4\xd0\xb5\xd0\xba", "1", "2011", 2011, 12, 1, 0, 0 },
+
// Test current year detection.
{ "Nov", "01", "12:00", 1994, 11, 1, 12, 0 },
{ "Nov", "15", "12:00", 1994, 11, 15, 12, 0 },