| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic/core/crypto/crypto_framer.h" | 5 #include "net/quic/core/crypto/crypto_framer.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/logging.h" | |
| 12 #include "net/quic/core/crypto/crypto_handshake.h" | 11 #include "net/quic/core/crypto/crypto_handshake.h" |
| 13 #include "net/quic/core/crypto/crypto_protocol.h" | 12 #include "net/quic/core/crypto/crypto_protocol.h" |
| 14 #include "net/quic/core/quic_packets.h" | 13 #include "net/quic/core/quic_packets.h" |
| 14 #include "net/quic/platform/api/quic_logging.h" |
| 15 #include "net/quic/test_tools/crypto_test_utils.h" | 15 #include "net/quic/test_tools/crypto_test_utils.h" |
| 16 #include "net/quic/test_tools/quic_test_utils.h" | 16 #include "net/quic/test_tools/quic_test_utils.h" |
| 17 | 17 |
| 18 using base::StringPiece; | 18 using base::StringPiece; |
| 19 using std::string; | 19 using std::string; |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 char* AsChars(unsigned char* data) { | 25 char* AsChars(unsigned char* data) { |
| 26 return reinterpret_cast<char*>(data); | 26 return reinterpret_cast<char*>(data); |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 namespace test { | 31 namespace test { |
| 32 | 32 |
| 33 class TestCryptoVisitor : public CryptoFramerVisitorInterface { | 33 class TestCryptoVisitor : public CryptoFramerVisitorInterface { |
| 34 public: | 34 public: |
| 35 TestCryptoVisitor() : error_count_(0) {} | 35 TestCryptoVisitor() : error_count_(0) {} |
| 36 | 36 |
| 37 void OnError(CryptoFramer* framer) override { | 37 void OnError(CryptoFramer* framer) override { |
| 38 DLOG(ERROR) << "CryptoFramer Error: " << framer->error(); | 38 QUIC_DLOG(ERROR) << "CryptoFramer Error: " << framer->error(); |
| 39 ++error_count_; | 39 ++error_count_; |
| 40 } | 40 } |
| 41 | 41 |
| 42 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override { | 42 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override { |
| 43 messages_.push_back(message); | 43 messages_.push_back(message); |
| 44 } | 44 } |
| 45 | 45 |
| 46 // Counters from the visitor callbacks. | 46 // Counters from the visitor callbacks. |
| 47 int error_count_; | 47 int error_count_; |
| 48 | 48 |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 }; | 460 }; |
| 461 | 461 |
| 462 EXPECT_TRUE( | 462 EXPECT_TRUE( |
| 463 framer.ProcessInput(StringPiece(AsChars(input), arraysize(input)))); | 463 framer.ProcessInput(StringPiece(AsChars(input), arraysize(input)))); |
| 464 EXPECT_EQ(0, visitor.error_count_); | 464 EXPECT_EQ(0, visitor.error_count_); |
| 465 } | 465 } |
| 466 | 466 |
| 467 } // namespace test | 467 } // namespace test |
| 468 | 468 |
| 469 } // namespace net | 469 } // namespace net |
| OLD | NEW |