| 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_serialization.h" | 5 #include "net/cert/ct_serialization.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "net/base/net_log.h" | 11 #include "net/base/net_log.h" |
| 12 #include "net/base/test_completion_callback.h" | 12 #include "net/base/test_completion_callback.h" |
| 13 #include "net/base/test_data_directory.h" | 13 #include "net/base/test_data_directory.h" |
| 14 #include "net/cert/x509_certificate.h" | 14 #include "net/cert/x509_certificate.h" |
| 15 #include "net/test/cert_test_util.h" | 15 #include "net/test/cert_test_util.h" |
| 16 #include "net/test/ct_test_util.h" | 16 #include "net/test/ct_test_util.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 class CtSerializationTest : public ::testing::Test { | 21 class CtSerializationTest : public ::testing::Test { |
| 22 public: | 22 public: |
| 23 virtual void SetUp() OVERRIDE { | 23 virtual void SetUp() override { |
| 24 test_digitally_signed_ = ct::GetTestDigitallySigned(); | 24 test_digitally_signed_ = ct::GetTestDigitallySigned(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 protected: | 27 protected: |
| 28 std::string test_digitally_signed_; | 28 std::string test_digitally_signed_; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 TEST_F(CtSerializationTest, DecodesDigitallySigned) { | 31 TEST_F(CtSerializationTest, DecodesDigitallySigned) { |
| 32 base::StringPiece digitally_signed(test_digitally_signed_); | 32 base::StringPiece digitally_signed(test_digitally_signed_); |
| 33 ct::DigitallySigned parsed; | 33 ct::DigitallySigned parsed; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Bytes 18-49 are sha256 root hash | 175 // Bytes 18-49 are sha256 root hash |
| 176 ASSERT_EQ(50u, encoded.length()); | 176 ASSERT_EQ(50u, encoded.length()); |
| 177 std::string expected_buffer( | 177 std::string expected_buffer( |
| 178 "\x0\x1\x0\x0\x1\x45\x3c\x5f\xb8\x35\x0\x0\x0\x0\x0\x0\x0\x15", 18); | 178 "\x0\x1\x0\x0\x1\x45\x3c\x5f\xb8\x35\x0\x0\x0\x0\x0\x0\x0\x15", 18); |
| 179 expected_buffer.append(ct::GetSampleSTHSHA256RootHash()); | 179 expected_buffer.append(ct::GetSampleSTHSHA256RootHash()); |
| 180 ASSERT_EQ(expected_buffer, encoded); | 180 ASSERT_EQ(expected_buffer, encoded); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace net | 183 } // namespace net |
| 184 | 184 |
| OLD | NEW |