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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "storage/browser/fileapi/file_system_dir_url_request_job.h" 5 #include "storage/browser/fileapi/file_system_dir_url_request_job.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 15 matching lines...) Expand all
26 #include "net/http/http_request_headers.h" 26 #include "net/http/http_request_headers.h"
27 #include "net/url_request/url_request.h" 27 #include "net/url_request/url_request.h"
28 #include "net/url_request/url_request_context.h" 28 #include "net/url_request/url_request_context.h"
29 #include "net/url_request/url_request_test_util.h" 29 #include "net/url_request/url_request_test_util.h"
30 #include "storage/browser/fileapi/external_mount_points.h" 30 #include "storage/browser/fileapi/external_mount_points.h"
31 #include "storage/browser/fileapi/file_system_context.h" 31 #include "storage/browser/fileapi/file_system_context.h"
32 #include "storage/browser/fileapi/file_system_file_util.h" 32 #include "storage/browser/fileapi/file_system_file_util.h"
33 #include "storage/browser/fileapi/file_system_operation_context.h" 33 #include "storage/browser/fileapi/file_system_operation_context.h"
34 #include "storage/browser/fileapi/file_system_url.h" 34 #include "storage/browser/fileapi/file_system_url.h"
35 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
36 #include "third_party/icu/source/i18n/unicode/datefmt.h"
36 #include "third_party/icu/source/i18n/unicode/regex.h" 37 #include "third_party/icu/source/i18n/unicode/regex.h"
37 38
38 using storage::FileSystemContext; 39 using storage::FileSystemContext;
39 using storage::FileSystemOperationContext; 40 using storage::FileSystemOperationContext;
40 using storage::FileSystemURL; 41 using storage::FileSystemURL;
41 42
42 namespace content { 43 namespace content {
43 namespace { 44 namespace {
44 45
45 // We always use the TEMPORARY FileSystem in this test. 46 // We always use the TEMPORARY FileSystem in this test.
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 EXPECT_EQ(icu::UnicodeString(name.c_str()), match.group(1, status)); 264 EXPECT_EQ(icu::UnicodeString(name.c_str()), match.group(1, status));
264 EXPECT_EQ(icu::UnicodeString(url.c_str()), match.group(2, status)); 265 EXPECT_EQ(icu::UnicodeString(url.c_str()), match.group(2, status));
265 EXPECT_EQ(icu::UnicodeString(is_directory ? "1" : "0"), 266 EXPECT_EQ(icu::UnicodeString(is_directory ? "1" : "0"),
266 match.group(3, status)); 267 match.group(3, status));
267 if (size >= 0) { 268 if (size >= 0) {
268 icu::UnicodeString size_string( 269 icu::UnicodeString size_string(
269 base::FormatBytesUnlocalized(size).c_str()); 270 base::FormatBytesUnlocalized(size).c_str());
270 EXPECT_EQ(size_string, match.group(4, status)); 271 EXPECT_EQ(size_string, match.group(4, status));
271 } 272 }
272 273
273 base::Time date;
274 icu::UnicodeString date_ustr(match.group(5, status)); 274 icu::UnicodeString date_ustr(match.group(5, status));
275 std::string date_str; 275 scoped_ptr<icu::DateFormat> formatter(
276 base::UTF16ToUTF8(date_ustr.getBuffer(), date_ustr.length(), &date_str); 276 icu::DateFormat::createDateTimeInstance(icu::DateFormat::kShort));
277 EXPECT_TRUE(base::Time::FromString(date_str.c_str(), &date)); 277 UErrorCode parse_status = U_ZERO_ERROR;
278 UDate udate = formatter->parse(date_ustr, parse_status);
279 EXPECT_TRUE(U_SUCCESS(parse_status));
280 base::Time date = base::Time::FromJsTime(udate);
278 EXPECT_FALSE(date.is_null()); 281 EXPECT_FALSE(date.is_null());
279 } 282 }
280 283
281 GURL CreateFileSystemURL(const std::string path) { 284 GURL CreateFileSystemURL(const std::string path) {
282 return GURL(kFileSystemURLPrefix + path); 285 return GURL(kFileSystemURLPrefix + path);
283 } 286 }
284 287
285 storage::FileSystemFileUtil* file_util() { 288 storage::FileSystemFileUtil* file_util() {
286 return file_system_context_->sandbox_delegate()->sync_file_util(); 289 return file_system_context_->sandbox_delegate()->sync_file_util();
287 } 290 }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 ASSERT_FALSE(request_->status().is_success()); 450 ASSERT_FALSE(request_->status().is_success());
448 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); 451 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error());
449 452
450 ASSERT_FALSE( 453 ASSERT_FALSE(
451 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( 454 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(
452 kValidExternalMountPoint)); 455 kValidExternalMountPoint));
453 } 456 }
454 457
455 } // namespace 458 } // namespace
456 } // namespace content 459 } // namespace content
OLDNEW
« 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