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

Side by Side Diff: net/ftp/ftp_directory_listing_parser_unittest.h

Issue 2558143003: Use UTC rather than local time for interpreting FTP listing dates. (Closed)
Patch Set: Created 4 years 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
OLDNEW
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 #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 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const SingleLineTestData& test_case, 42 const SingleLineTestData& test_case,
43 const std::vector<FtpDirectoryListingEntry>& entries) { 43 const std::vector<FtpDirectoryListingEntry>& entries) {
44 ASSERT_FALSE(entries.empty()); 44 ASSERT_FALSE(entries.empty());
45 45
46 FtpDirectoryListingEntry entry = entries[0]; 46 FtpDirectoryListingEntry entry = entries[0];
47 EXPECT_EQ(test_case.type, entry.type); 47 EXPECT_EQ(test_case.type, entry.type);
48 EXPECT_EQ(base::UTF8ToUTF16(test_case.filename), entry.name); 48 EXPECT_EQ(base::UTF8ToUTF16(test_case.filename), entry.name);
49 EXPECT_EQ(test_case.size, entry.size); 49 EXPECT_EQ(test_case.size, entry.size);
50 50
51 base::Time::Exploded time_exploded; 51 base::Time::Exploded time_exploded;
52 entry.last_modified.LocalExplode(&time_exploded); 52 entry.last_modified.UTCExplode(&time_exploded);
53 53
54 // Only test members displayed on the directory listing. 54 // Only test members displayed on the directory listing.
55 EXPECT_EQ(test_case.year, time_exploded.year); 55 EXPECT_EQ(test_case.year, time_exploded.year);
56 EXPECT_EQ(test_case.month, time_exploded.month); 56 EXPECT_EQ(test_case.month, time_exploded.month);
57 EXPECT_EQ(test_case.day_of_month, time_exploded.day_of_month); 57 EXPECT_EQ(test_case.day_of_month, time_exploded.day_of_month);
58 EXPECT_EQ(test_case.hour, time_exploded.hour); 58 EXPECT_EQ(test_case.hour, time_exploded.hour);
59 EXPECT_EQ(test_case.minute, time_exploded.minute); 59 EXPECT_EQ(test_case.minute, time_exploded.minute);
60 60
61 EXPECT_EQ(1U, entries.size()); 61 EXPECT_EQ(1U, entries.size());
62 } 62 }
63 63
64 base::Time GetMockCurrentTime() { 64 base::Time GetMockCurrentTime() {
65 base::Time::Exploded mock_current_time_exploded = { 0 }; 65 base::Time::Exploded mock_current_time_exploded = { 0 };
66 mock_current_time_exploded.year = 1994; 66 mock_current_time_exploded.year = 1994;
67 mock_current_time_exploded.month = 11; 67 mock_current_time_exploded.month = 11;
68 mock_current_time_exploded.day_of_month = 15; 68 mock_current_time_exploded.day_of_month = 15;
69 mock_current_time_exploded.hour = 12; 69 mock_current_time_exploded.hour = 12;
70 mock_current_time_exploded.minute = 45; 70 mock_current_time_exploded.minute = 45;
71 return base::Time::FromLocalExploded(mock_current_time_exploded); 71 return base::Time::FromUTCExploded(mock_current_time_exploded);
72 } 72 }
73 }; 73 };
74 74
75 } // namespace net 75 } // namespace net
76 76
77 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_UNITTEST_H_ 77 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_UNITTEST_H_
78 78
OLDNEW
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_ls.cc ('k') | net/ftp/ftp_directory_listing_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698