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

Side by Side Diff: net/tools/quic/quic_spdy_client_stream_test.cc

Issue 763833003: Remove using namespace in net/quic/quic_stream_sequencer.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
OLDNEW
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/tools/quic/quic_spdy_client_stream.h" 5 #include "net/tools/quic/quic_spdy_client_stream.h"
6 6
7 #include <string>
8
7 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
8 #include "net/quic/quic_utils.h" 10 #include "net/quic/quic_utils.h"
9 #include "net/quic/test_tools/quic_test_utils.h" 11 #include "net/quic/test_tools/quic_test_utils.h"
10 #include "net/tools/quic/quic_client_session.h" 12 #include "net/tools/quic/quic_client_session.h"
11 #include "net/tools/quic/quic_spdy_client_stream.h" 13 #include "net/tools/quic/quic_spdy_client_stream.h"
12 #include "net/tools/quic/spdy_utils.h" 14 #include "net/tools/quic/spdy_utils.h"
13 #include "net/tools/quic/test_tools/quic_test_utils.h" 15 #include "net/tools/quic/test_tools/quic_test_utils.h"
14 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
16 18
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 kInitialStreamFlowControlWindowForTest); 50 kInitialStreamFlowControlWindowForTest);
49 session_.config()->SetInitialSessionFlowControlWindowToSend( 51 session_.config()->SetInitialSessionFlowControlWindowToSend(
50 kInitialSessionFlowControlWindowForTest); 52 kInitialSessionFlowControlWindowForTest);
51 stream_.reset(new QuicSpdyClientStream(3, &session_)); 53 stream_.reset(new QuicSpdyClientStream(3, &session_));
52 } 54 }
53 55
54 StrictMock<MockConnection>* connection_; 56 StrictMock<MockConnection>* connection_;
55 QuicClientSession session_; 57 QuicClientSession session_;
56 scoped_ptr<QuicSpdyClientStream> stream_; 58 scoped_ptr<QuicSpdyClientStream> stream_;
57 BalsaHeaders headers_; 59 BalsaHeaders headers_;
58 string headers_string_; 60 std::string headers_string_;
59 string body_; 61 std::string body_;
60 QuicCryptoClientConfig crypto_config_; 62 QuicCryptoClientConfig crypto_config_;
61 }; 63 };
62 64
63 INSTANTIATE_TEST_CASE_P(Tests, QuicSpdyClientStreamTest, 65 INSTANTIATE_TEST_CASE_P(Tests, QuicSpdyClientStreamTest,
64 ::testing::ValuesIn(QuicSupportedVersions())); 66 ::testing::ValuesIn(QuicSupportedVersions()));
65 67
66 TEST_P(QuicSpdyClientStreamTest, TestFraming) { 68 TEST_P(QuicSpdyClientStreamTest, TestFraming) {
67 EXPECT_EQ(headers_string_.size(), stream_->ProcessData( 69 EXPECT_EQ(headers_string_.size(), stream_->ProcessData(
68 headers_string_.c_str(), headers_string_.size())); 70 headers_string_.c_str(), headers_string_.size()));
69 EXPECT_EQ(body_.size(), 71 EXPECT_EQ(body_.size(),
70 stream_->ProcessData(body_.c_str(), body_.size())); 72 stream_->ProcessData(body_.c_str(), body_.size()));
71 EXPECT_EQ(200u, stream_->headers().parsed_response_code()); 73 EXPECT_EQ(200u, stream_->headers().parsed_response_code());
72 EXPECT_EQ(body_, stream_->data()); 74 EXPECT_EQ(body_, stream_->data());
73 } 75 }
74 76
75 TEST_P(QuicSpdyClientStreamTest, TestFramingOnePacket) { 77 TEST_P(QuicSpdyClientStreamTest, TestFramingOnePacket) {
76 string message = headers_string_ + body_; 78 std::string message = headers_string_ + body_;
77 79
78 EXPECT_EQ(message.size(), stream_->ProcessData( 80 EXPECT_EQ(message.size(), stream_->ProcessData(
79 message.c_str(), message.size())); 81 message.c_str(), message.size()));
80 EXPECT_EQ(200u, stream_->headers().parsed_response_code()); 82 EXPECT_EQ(200u, stream_->headers().parsed_response_code());
81 EXPECT_EQ(body_, stream_->data()); 83 EXPECT_EQ(body_, stream_->data());
82 } 84 }
83 85
84 TEST_P(QuicSpdyClientStreamTest, DISABLED_TestFramingExtraData) { 86 TEST_P(QuicSpdyClientStreamTest, DISABLED_TestFramingExtraData) {
85 string large_body = "hello world!!!!!!"; 87 std::string large_body = "hello world!!!!!!";
86 88
87 EXPECT_EQ(headers_string_.size(), stream_->ProcessData( 89 EXPECT_EQ(headers_string_.size(), stream_->ProcessData(
88 headers_string_.c_str(), headers_string_.size())); 90 headers_string_.c_str(), headers_string_.size()));
89 // The headers should parse successfully. 91 // The headers should parse successfully.
90 EXPECT_EQ(QUIC_STREAM_NO_ERROR, stream_->stream_error()); 92 EXPECT_EQ(QUIC_STREAM_NO_ERROR, stream_->stream_error());
91 EXPECT_EQ(200u, stream_->headers().parsed_response_code()); 93 EXPECT_EQ(200u, stream_->headers().parsed_response_code());
92 94
93 EXPECT_CALL(*connection_, 95 EXPECT_CALL(*connection_,
94 SendRstStream(stream_->id(), QUIC_BAD_APPLICATION_PAYLOAD, 0)); 96 SendRstStream(stream_->id(), QUIC_BAD_APPLICATION_PAYLOAD, 0));
95 stream_->ProcessData(large_body.c_str(), large_body.size()); 97 stream_->ProcessData(large_body.c_str(), large_body.size());
96 98
97 EXPECT_NE(QUIC_STREAM_NO_ERROR, stream_->stream_error()); 99 EXPECT_NE(QUIC_STREAM_NO_ERROR, stream_->stream_error());
98 } 100 }
99 101
100 TEST_P(QuicSpdyClientStreamTest, TestNoBidirectionalStreaming) { 102 TEST_P(QuicSpdyClientStreamTest, TestNoBidirectionalStreaming) {
101 QuicStreamFrame frame(3, false, 3, MakeIOVector("asd")); 103 QuicStreamFrame frame(3, false, 3, MakeIOVector("asd"));
102 104
103 EXPECT_FALSE(stream_->write_side_closed()); 105 EXPECT_FALSE(stream_->write_side_closed());
104 stream_->OnStreamFrame(frame); 106 stream_->OnStreamFrame(frame);
105 EXPECT_TRUE(stream_->write_side_closed()); 107 EXPECT_TRUE(stream_->write_side_closed());
106 } 108 }
107 109
108 } // namespace 110 } // namespace
109 } // namespace test 111 } // namespace test
110 } // namespace tools 112 } // namespace tools
111 } // namespace net 113 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698