OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_UNITTEST_H_ | 5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_UNITTEST_H_ |
6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_UNITTEST_H_ | 6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_UNITTEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "net/ftp/ftp_directory_listing_parser.h" | 10 #include "net/ftp/ftp_directory_listing_parser.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 const SingleLineTestData& test_case) { | 33 const SingleLineTestData& test_case) { |
34 ASSERT_TRUE(parser->ConsumeLine(UTF8ToUTF16(test_case.input))); | 34 ASSERT_TRUE(parser->ConsumeLine(UTF8ToUTF16(test_case.input))); |
35 ASSERT_TRUE(parser->EntryAvailable()); | 35 ASSERT_TRUE(parser->EntryAvailable()); |
36 FtpDirectoryListingEntry entry = parser->PopEntry(); | 36 FtpDirectoryListingEntry entry = parser->PopEntry(); |
37 EXPECT_EQ(test_case.type, entry.type); | 37 EXPECT_EQ(test_case.type, entry.type); |
38 EXPECT_EQ(UTF8ToUTF16(test_case.filename), entry.name); | 38 EXPECT_EQ(UTF8ToUTF16(test_case.filename), entry.name); |
39 EXPECT_EQ(test_case.size, entry.size); | 39 EXPECT_EQ(test_case.size, entry.size); |
40 | 40 |
41 base::Time::Exploded time_exploded; | 41 base::Time::Exploded time_exploded; |
42 entry.last_modified.LocalExplode(&time_exploded); | 42 entry.last_modified.LocalExplode(&time_exploded); |
| 43 |
| 44 // Only test members displayed on the directory listing. |
43 EXPECT_EQ(test_case.year, time_exploded.year); | 45 EXPECT_EQ(test_case.year, time_exploded.year); |
44 EXPECT_EQ(test_case.month, time_exploded.month); | 46 EXPECT_EQ(test_case.month, time_exploded.month); |
45 EXPECT_EQ(test_case.day_of_month, time_exploded.day_of_month); | 47 EXPECT_EQ(test_case.day_of_month, time_exploded.day_of_month); |
46 EXPECT_EQ(test_case.hour, time_exploded.hour); | 48 EXPECT_EQ(test_case.hour, time_exploded.hour); |
47 EXPECT_EQ(test_case.minute, time_exploded.minute); | 49 EXPECT_EQ(test_case.minute, time_exploded.minute); |
48 EXPECT_EQ(0, time_exploded.second); | 50 } |
49 EXPECT_EQ(0, time_exploded.millisecond); | 51 |
| 52 base::Time GetMockCurrentTime() { |
| 53 base::Time::Exploded mock_current_time_exploded = { 0 }; |
| 54 mock_current_time_exploded.year = 1994; |
| 55 mock_current_time_exploded.month = 11; |
| 56 mock_current_time_exploded.day_of_month = 15; |
| 57 mock_current_time_exploded.hour = 12; |
| 58 mock_current_time_exploded.minute = 45; |
| 59 return base::Time::FromLocalExploded(mock_current_time_exploded); |
50 } | 60 } |
51 | 61 |
52 private: | 62 private: |
53 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserTest); | 63 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserTest); |
54 }; | 64 }; |
55 | 65 |
56 } // namespace net | 66 } // namespace net |
57 | 67 |
58 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_UNITTEST_H_ | 68 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_UNITTEST_H_ |
59 | 69 |
OLD | NEW |