OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "net/cert/ct_log_verifier.h" | 5 #include "net/cert/ct_log_verifier.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "net/cert/signed_certificate_timestamp.h" | 10 #include "net/cert/signed_certificate_timestamp.h" |
11 #include "net/cert/signed_tree_head.h" | 11 #include "net/cert/signed_tree_head.h" |
12 #include "net/test/ct_test_util.h" | 12 #include "net/test/ct_test_util.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 class CTLogVerifierTest : public ::testing::Test { | 17 class CTLogVerifierTest : public ::testing::Test { |
18 public: | 18 public: |
19 CTLogVerifierTest() {} | 19 CTLogVerifierTest() {} |
20 | 20 |
21 virtual void SetUp() OVERRIDE { | 21 virtual void SetUp() override { |
22 log_ = CTLogVerifier::Create(ct::GetTestPublicKey(), "testlog").Pass(); | 22 log_ = CTLogVerifier::Create(ct::GetTestPublicKey(), "testlog").Pass(); |
23 | 23 |
24 ASSERT_TRUE(log_); | 24 ASSERT_TRUE(log_); |
25 ASSERT_EQ(log_->key_id(), ct::GetTestPublicKeyId()); | 25 ASSERT_EQ(log_->key_id(), ct::GetTestPublicKeyId()); |
26 } | 26 } |
27 | 27 |
28 protected: | 28 protected: |
29 scoped_ptr<CTLogVerifier> log_; | 29 scoped_ptr<CTLogVerifier> log_; |
30 }; | 30 }; |
31 | 31 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 TEST_F(CTLogVerifierTest, DoesNotSetInvalidSTH) { | 85 TEST_F(CTLogVerifierTest, DoesNotSetInvalidSTH) { |
86 scoped_ptr<ct::SignedTreeHead> sth(new ct::SignedTreeHead()); | 86 scoped_ptr<ct::SignedTreeHead> sth(new ct::SignedTreeHead()); |
87 ct::GetSignedTreeHead(sth.get()); | 87 ct::GetSignedTreeHead(sth.get()); |
88 sth->sha256_root_hash[0] = '\x0'; | 88 sth->sha256_root_hash[0] = '\x0'; |
89 ASSERT_FALSE(log_->SetSignedTreeHead(sth.Pass())); | 89 ASSERT_FALSE(log_->SetSignedTreeHead(sth.Pass())); |
90 } | 90 } |
91 | 91 |
92 } // namespace net | 92 } // namespace net |
OLD | NEW |