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

Unified Diff: net/cert/ct_log_response_parser_unittest.cc

Issue 1758823002: Certificate Transparency: Ensure timestamps over 32 bit are handled correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing review comments Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/ct_log_response_parser.cc ('k') | net/cert/signed_tree_head.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/ct_log_response_parser_unittest.cc
diff --git a/net/cert/ct_log_response_parser_unittest.cc b/net/cert/ct_log_response_parser_unittest.cc
index fad759019acbf9b3861aae2984cc518c7c513e5d..e505b051f4db6d52ca431815ff97073083781960 100644
--- a/net/cert/ct_log_response_parser_unittest.cc
+++ b/net/cert/ct_log_response_parser_unittest.cc
@@ -95,6 +95,23 @@ TEST(CTLogResponseParserTest, FailsToParseIncorrectLengthRootHash) {
ASSERT_FALSE(FillSignedTreeHead(*too_short_hash_json.get(), &tree_head));
}
+TEST(CTLogResponseParserTest, ParsesJsonSTHWithLargeTimestamp) {
+ SignedTreeHead tree_head;
+
+ scoped_ptr<base::Value> large_timestamp_json =
+ ParseJson(CreateSignedTreeHeadJsonString(
+ 100, INT64_C(1) << 34, GetSampleSTHSHA256RootHash(),
+ GetSampleSTHTreeHeadSignature()));
+
+ ASSERT_TRUE(FillSignedTreeHead(*large_timestamp_json.get(), &tree_head));
+
+ base::Time expected_time =
+ base::Time::UnixEpoch() +
+ base::TimeDelta::FromMilliseconds(INT64_C(1) << 34);
+
+ EXPECT_EQ(tree_head.timestamp, expected_time);
+}
+
TEST(CTLogResponseParserTest, ParsesConsistencyProofSuccessfully) {
std::string first(32, 'a');
std::string second(32, 'b');
« no previous file with comments | « net/cert/ct_log_response_parser.cc ('k') | net/cert/signed_tree_head.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698