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

Side by Side Diff: net/quic/quic_stream_sequencer_test.cc

Issue 1009543004: Create a Perspective enum to use instead of a bool is_server to improve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added NET_EXPORT_PRIVATE to fix compiler error Created 5 years, 9 months 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/quic_stream_factory.cc ('k') | net/quic/reliable_quic_stream.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/quic_stream_sequencer.h" 5 #include "net/quic/quic_stream_sequencer.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 }; 54 };
55 55
56 namespace { 56 namespace {
57 57
58 static const char kPayload[] = 58 static const char kPayload[] =
59 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 59 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
60 60
61 class QuicStreamSequencerTest : public ::testing::Test { 61 class QuicStreamSequencerTest : public ::testing::Test {
62 protected: 62 protected:
63 QuicStreamSequencerTest() 63 QuicStreamSequencerTest()
64 : connection_(new MockConnection(false)), 64 : connection_(new MockConnection(Perspective::IS_CLIENT)),
65 session_(connection_), 65 session_(connection_),
66 stream_(&session_, 1), 66 stream_(&session_, 1),
67 sequencer_(new QuicStreamSequencer(&stream_)), 67 sequencer_(new QuicStreamSequencer(&stream_)),
68 buffered_frames_( 68 buffered_frames_(
69 QuicStreamSequencerPeer::GetBufferedFrames(sequencer_.get())) { 69 QuicStreamSequencerPeer::GetBufferedFrames(sequencer_.get())) {}
70 }
71 70
72 bool VerifyIovec(const iovec& iovec, StringPiece expected) { 71 bool VerifyIovec(const iovec& iovec, StringPiece expected) {
73 if (iovec.iov_len != expected.length()) { 72 if (iovec.iov_len != expected.length()) {
74 LOG(ERROR) << "Invalid length: " << iovec.iov_len 73 LOG(ERROR) << "Invalid length: " << iovec.iov_len
75 << " vs " << expected.length(); 74 << " vs " << expected.length();
76 return false; 75 return false;
77 } 76 }
78 if (memcmp(iovec.iov_base, expected.data(), expected.length()) != 0) { 77 if (memcmp(iovec.iov_base, expected.data(), expected.length()) != 0) {
79 LOG(ERROR) << "Invalid data: " << static_cast<char*>(iovec.iov_base) 78 LOG(ERROR) << "Invalid data: " << static_cast<char*>(iovec.iov_base)
80 << " vs " << expected.data(); 79 << " vs " << expected.data();
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 QuicStreamFrame frame2(kClientDataStreamId1, false, 2, MakeIOVector("hello")); 414 QuicStreamFrame frame2(kClientDataStreamId1, false, 2, MakeIOVector("hello"));
416 EXPECT_TRUE(sequencer_->FrameOverlapsBufferedData(frame2)); 415 EXPECT_TRUE(sequencer_->FrameOverlapsBufferedData(frame2));
417 EXPECT_CALL(stream_, CloseConnectionWithDetails(QUIC_INVALID_STREAM_FRAME, _)) 416 EXPECT_CALL(stream_, CloseConnectionWithDetails(QUIC_INVALID_STREAM_FRAME, _))
418 .Times(1); 417 .Times(1);
419 sequencer_->OnStreamFrame(frame2); 418 sequencer_->OnStreamFrame(frame2);
420 } 419 }
421 420
422 } // namespace 421 } // namespace
423 } // namespace test 422 } // namespace test
424 } // namespace net 423 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_stream_factory.cc ('k') | net/quic/reliable_quic_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698