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

Unified Diff: content/browser/fileapi/file_system_dir_url_request_job_unittest.cc

Issue 1246463002: Make FileSystemDirURLRequestJobTest locale-invulnerable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use createDateTimeInstance() + initialize status Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/fileapi/file_system_dir_url_request_job_unittest.cc
diff --git a/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc b/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc
index e02027be26cc0c899accb1acbd95e87a248c0f70..8d6f17b9d86e97a8ee394c7f26a897e28d3f920f 100644
--- a/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc
+++ b/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc
@@ -33,6 +33,7 @@
#include "storage/browser/fileapi/file_system_operation_context.h"
#include "storage/browser/fileapi/file_system_url.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/icu/source/i18n/unicode/datefmt.h"
#include "third_party/icu/source/i18n/unicode/regex.h"
using storage::FileSystemContext;
@@ -270,11 +271,13 @@ class FileSystemDirURLRequestJobTest : public testing::Test {
EXPECT_EQ(size_string, match.group(4, status));
}
- base::Time date;
icu::UnicodeString date_ustr(match.group(5, status));
- std::string date_str;
- base::UTF16ToUTF8(date_ustr.getBuffer(), date_ustr.length(), &date_str);
- EXPECT_TRUE(base::Time::FromString(date_str.c_str(), &date));
+ scoped_ptr<icu::DateFormat> formatter(
+ icu::DateFormat::createDateTimeInstance(icu::DateFormat::kShort));
+ UErrorCode parse_status = U_ZERO_ERROR;
+ UDate udate = formatter->parse(date_ustr, parse_status);
+ EXPECT_TRUE(U_SUCCESS(parse_status));
+ base::Time date = base::Time::FromJsTime(udate);
EXPECT_FALSE(date.is_null());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698