| 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 <map> | 5 #include <map> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "net/quic/crypto/crypto_framer.h" | 10 #include "net/quic/crypto/crypto_framer.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 char* AsChars(unsigned char* data) { return reinterpret_cast<char*>(data); } | 26 char* AsChars(unsigned char* data) { return reinterpret_cast<char*>(data); } |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 namespace test { | 30 namespace test { |
| 31 | 31 |
| 32 class TestCryptoVisitor : public ::net::CryptoFramerVisitorInterface { | 32 class TestCryptoVisitor : public ::net::CryptoFramerVisitorInterface { |
| 33 public: | 33 public: |
| 34 TestCryptoVisitor() : error_count_(0) {} | 34 TestCryptoVisitor() : error_count_(0) {} |
| 35 | 35 |
| 36 virtual void OnError(CryptoFramer* framer) OVERRIDE { | 36 virtual void OnError(CryptoFramer* framer) override { |
| 37 DLOG(ERROR) << "CryptoFramer Error: " << framer->error(); | 37 DLOG(ERROR) << "CryptoFramer Error: " << framer->error(); |
| 38 ++error_count_; | 38 ++error_count_; |
| 39 } | 39 } |
| 40 | 40 |
| 41 virtual void OnHandshakeMessage( | 41 virtual void OnHandshakeMessage( |
| 42 const CryptoHandshakeMessage& message) OVERRIDE { | 42 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 |
| 49 vector<CryptoHandshakeMessage> messages_; | 49 vector<CryptoHandshakeMessage> messages_; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 TEST(CryptoFramerTest, ConstructHandshakeMessage) { | 52 TEST(CryptoFramerTest, ConstructHandshakeMessage) { |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 }; | 476 }; |
| 477 | 477 |
| 478 EXPECT_TRUE( | 478 EXPECT_TRUE( |
| 479 framer.ProcessInput(StringPiece(AsChars(input), arraysize(input)))); | 479 framer.ProcessInput(StringPiece(AsChars(input), arraysize(input)))); |
| 480 EXPECT_EQ(0, visitor.error_count_); | 480 EXPECT_EQ(0, visitor.error_count_); |
| 481 } | 481 } |
| 482 | 482 |
| 483 } // namespace test | 483 } // namespace test |
| 484 | 484 |
| 485 } // namespace net | 485 } // namespace net |
| OLD | NEW |