OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) | 5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) |
6 // rather than as part of test_shell_tests because they rely on being able | 6 // rather than as part of test_shell_tests because they rely on being able |
7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses | 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses |
8 // TYPE_UI, which URLRequest doesn't allow. | 8 // TYPE_UI, which URLRequest doesn't allow. |
9 // | 9 // |
10 | 10 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 EXPECT_EQ(5, match.groupCount()); | 189 EXPECT_EQ(5, match.groupCount()); |
190 EXPECT_EQ(icu::UnicodeString(name.c_str()), match.group(1, status)); | 190 EXPECT_EQ(icu::UnicodeString(name.c_str()), match.group(1, status)); |
191 EXPECT_EQ(icu::UnicodeString(url.c_str()), match.group(2, status)); | 191 EXPECT_EQ(icu::UnicodeString(url.c_str()), match.group(2, status)); |
192 EXPECT_EQ(icu::UnicodeString(is_directory ? "1" : "0"), | 192 EXPECT_EQ(icu::UnicodeString(is_directory ? "1" : "0"), |
193 match.group(3, status)); | 193 match.group(3, status)); |
194 icu::UnicodeString size_string(FormatBytesUnlocalized(size).c_str()); | 194 icu::UnicodeString size_string(FormatBytesUnlocalized(size).c_str()); |
195 EXPECT_EQ(size_string, match.group(4, status)); | 195 EXPECT_EQ(size_string, match.group(4, status)); |
196 | 196 |
197 base::Time date; | 197 base::Time date; |
198 icu::UnicodeString date_ustr(match.group(5, status)); | 198 icu::UnicodeString date_ustr(match.group(5, status)); |
199 std::wstring date_wstr; | 199 std::string date_str; |
200 UTF16ToWide(date_ustr.getBuffer(), date_ustr.length(), &date_wstr); | 200 UTF16ToUTF8(date_ustr.getBuffer(), date_ustr.length(), &date_str); |
201 EXPECT_TRUE(base::Time::FromString(date_wstr.c_str(), &date)); | 201 EXPECT_TRUE(base::Time::FromString(date_str.c_str(), &date)); |
202 EXPECT_FALSE(date.is_null()); | 202 EXPECT_FALSE(date.is_null()); |
203 } | 203 } |
204 | 204 |
205 GURL CreateFileSystemURL(const std::string path) { | 205 GURL CreateFileSystemURL(const std::string path) { |
206 return GURL(kFileSystemURLPrefix + path); | 206 return GURL(kFileSystemURLPrefix + path); |
207 } | 207 } |
208 | 208 |
209 static net::URLRequestJob* FileSystemDirURLRequestJobFactory( | 209 static net::URLRequestJob* FileSystemDirURLRequestJobFactory( |
210 net::URLRequest* request, | 210 net::URLRequest* request, |
211 const std::string& scheme) { | 211 const std::string& scheme) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 MessageLoop::current()->PostTask(FROM_HERE, new QuitNowTask); | 310 MessageLoop::current()->PostTask(FROM_HERE, new QuitNowTask); |
311 MessageLoop::current()->Run(); | 311 MessageLoop::current()->Run(); |
312 | 312 |
313 request_.reset(); | 313 request_.reset(); |
314 MessageLoop::current()->RunAllPending(); | 314 MessageLoop::current()->RunAllPending(); |
315 // If we get here, success! we didn't crash! | 315 // If we get here, success! we didn't crash! |
316 } | 316 } |
317 | 317 |
318 } // namespace (anonymous) | 318 } // namespace (anonymous) |
319 } // namespace fileapi | 319 } // namespace fileapi |
OLD | NEW |