| Index: net/ftp/ftp_directory_listing_parser_netware_unittest.cc
|
| diff --git a/net/ftp/ftp_directory_listing_parser_netware_unittest.cc b/net/ftp/ftp_directory_listing_parser_netware_unittest.cc
|
| index 4417599979a2ea418a6d00d0fd3ffa01bef30315..6570846811a615753b9665f8f248e6729560529d 100644
|
| --- a/net/ftp/ftp_directory_listing_parser_netware_unittest.cc
|
| +++ b/net/ftp/ftp_directory_listing_parser_netware_unittest.cc
|
| @@ -14,8 +14,9 @@ namespace {
|
| typedef net::FtpDirectoryListingParserTest FtpDirectoryListingParserNetwareTest;
|
|
|
| TEST_F(FtpDirectoryListingParserNetwareTest, Good) {
|
| - base::Time::Exploded now_exploded;
|
| - base::Time::Now().LocalExplode(&now_exploded);
|
| + base::Time mock_current_time;
|
| + ASSERT_TRUE(base::Time::FromString(L"Tue, 15 Nov 1994 12:45:26 GMT",
|
| + &mock_current_time));
|
|
|
| const struct SingleLineTestData good_cases[] = {
|
| { "d [RWCEAFMS] ftpadmin 512 Jan 29 2004 pub",
|
| @@ -23,12 +24,12 @@ TEST_F(FtpDirectoryListingParserNetwareTest, Good) {
|
| 2004, 1, 29, 0, 0 },
|
| { "- [RW------] ftpadmin 123 Nov 11 18:25 afile",
|
| net::FtpDirectoryListingEntry::FILE, "afile", 123,
|
| - now_exploded.year, 11, 11, 18, 25 },
|
| + 1994, 11, 11, 18, 25 },
|
| };
|
| for (size_t i = 0; i < arraysize(good_cases); i++) {
|
| SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, good_cases[i].input));
|
|
|
| - net::FtpDirectoryListingParserNetware parser;
|
| + net::FtpDirectoryListingParserNetware parser(mock_current_time);
|
| // The parser requires a "total n" like before accepting regular input.
|
| ASSERT_TRUE(parser.ConsumeLine(UTF8ToUTF16("total 1")));
|
| RunSingleLineTestCase(&parser, good_cases[i]);
|
| @@ -36,6 +37,10 @@ TEST_F(FtpDirectoryListingParserNetwareTest, Good) {
|
| }
|
|
|
| TEST_F(FtpDirectoryListingParserNetwareTest, Bad) {
|
| + base::Time mock_current_time;
|
| + ASSERT_TRUE(base::Time::FromString(L"Tue, 15 Nov 1994 12:45:26 GMT",
|
| + &mock_current_time));
|
| +
|
| const char* bad_cases[] = {
|
| "garbage",
|
| "d [] ftpadmin 512 Jan 29 2004 pub",
|
| @@ -45,7 +50,7 @@ TEST_F(FtpDirectoryListingParserNetwareTest, Bad) {
|
| "l [RW------] ftpadmin 512 Jan 29 2004 pub",
|
| };
|
| for (size_t i = 0; i < arraysize(bad_cases); i++) {
|
| - net::FtpDirectoryListingParserNetware parser;
|
| + net::FtpDirectoryListingParserNetware parser(mock_current_time);
|
| // The parser requires a "total n" like before accepting regular input.
|
| ASSERT_TRUE(parser.ConsumeLine(UTF8ToUTF16("total 1")));
|
| EXPECT_FALSE(parser.ConsumeLine(UTF8ToUTF16(bad_cases[i]))) << bad_cases[i];
|
|
|