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

Side by Side Diff: net/quic/core/crypto/crypto_framer_test.cc

Issue 2460223002: Adds std:: to stl types (#049) (Closed)
Patch Set: remove dead using std::foo declarations. Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « net/quic/core/crypto/crypto_framer.cc ('k') | net/quic/core/crypto/crypto_secret_boxer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" 11 #include "base/logging.h"
12 #include "net/quic/core/crypto/crypto_handshake.h" 12 #include "net/quic/core/crypto/crypto_handshake.h"
13 #include "net/quic/core/crypto/crypto_protocol.h" 13 #include "net/quic/core/crypto/crypto_protocol.h"
14 #include "net/quic/core/quic_protocol.h" 14 #include "net/quic/core/quic_protocol.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::map;
20 using std::string; 19 using std::string;
21 using std::vector;
22 20
23 namespace net { 21 namespace net {
24 22
25 namespace { 23 namespace {
26 24
27 char* AsChars(unsigned char* data) { 25 char* AsChars(unsigned char* data) {
28 return reinterpret_cast<char*>(data); 26 return reinterpret_cast<char*>(data);
29 } 27 }
30 28
31 } // namespace 29 } // namespace
32 30
33 namespace test { 31 namespace test {
34 32
35 class TestCryptoVisitor : public CryptoFramerVisitorInterface { 33 class TestCryptoVisitor : public CryptoFramerVisitorInterface {
36 public: 34 public:
37 TestCryptoVisitor() : error_count_(0) {} 35 TestCryptoVisitor() : error_count_(0) {}
38 36
39 void OnError(CryptoFramer* framer) override { 37 void OnError(CryptoFramer* framer) override {
40 DLOG(ERROR) << "CryptoFramer Error: " << framer->error(); 38 DLOG(ERROR) << "CryptoFramer Error: " << framer->error();
41 ++error_count_; 39 ++error_count_;
42 } 40 }
43 41
44 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override { 42 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override {
45 messages_.push_back(message); 43 messages_.push_back(message);
46 } 44 }
47 45
48 // Counters from the visitor callbacks. 46 // Counters from the visitor callbacks.
49 int error_count_; 47 int error_count_;
50 48
51 vector<CryptoHandshakeMessage> messages_; 49 std::vector<CryptoHandshakeMessage> messages_;
52 }; 50 };
53 51
54 TEST(CryptoFramerTest, ConstructHandshakeMessage) { 52 TEST(CryptoFramerTest, ConstructHandshakeMessage) {
55 CryptoHandshakeMessage message; 53 CryptoHandshakeMessage message;
56 message.set_tag(0xFFAA7733); 54 message.set_tag(0xFFAA7733);
57 message.SetStringPiece(0x12345678, "abcdef"); 55 message.SetStringPiece(0x12345678, "abcdef");
58 message.SetStringPiece(0x12345679, "ghijk"); 56 message.SetStringPiece(0x12345679, "ghijk");
59 message.SetStringPiece(0x1234567A, "lmnopqr"); 57 message.SetStringPiece(0x1234567A, "lmnopqr");
60 58
61 unsigned char packet[] = { 59 unsigned char packet[] = {
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 }; 460 };
463 461
464 EXPECT_TRUE( 462 EXPECT_TRUE(
465 framer.ProcessInput(StringPiece(AsChars(input), arraysize(input)))); 463 framer.ProcessInput(StringPiece(AsChars(input), arraysize(input))));
466 EXPECT_EQ(0, visitor.error_count_); 464 EXPECT_EQ(0, visitor.error_count_);
467 } 465 }
468 466
469 } // namespace test 467 } // namespace test
470 468
471 } // namespace net 469 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/crypto/crypto_framer.cc ('k') | net/quic/core/crypto/crypto_secret_boxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698