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/quic_http_stream.h" | 5 #include "net/quic/quic_http_stream.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "net/spdy/spdy_http_utils.h" | 43 #include "net/spdy/spdy_http_utils.h" |
44 #include "net/spdy/spdy_protocol.h" | 44 #include "net/spdy/spdy_protocol.h" |
45 #include "testing/gmock/include/gmock/gmock.h" | 45 #include "testing/gmock/include/gmock/gmock.h" |
46 #include "testing/gtest/include/gtest/gtest.h" | 46 #include "testing/gtest/include/gtest/gtest.h" |
47 | 47 |
48 using testing::_; | 48 using testing::_; |
49 using testing::AnyNumber; | 49 using testing::AnyNumber; |
50 using testing::Return; | 50 using testing::Return; |
51 | 51 |
52 namespace net { | 52 namespace net { |
| 53 |
| 54 class SocketPerformanceWatcher; |
| 55 |
53 namespace test { | 56 namespace test { |
54 namespace { | 57 namespace { |
55 | 58 |
56 const char kUploadData[] = "Really nifty data!"; | 59 const char kUploadData[] = "Really nifty data!"; |
57 const char kDefaultServerHostName[] = "www.google.com"; | 60 const char kDefaultServerHostName[] = "www.google.com"; |
58 const uint16 kDefaultServerPort = 80; | 61 const uint16 kDefaultServerPort = 80; |
59 | 62 |
60 class TestQuicConnection : public QuicConnection { | 63 class TestQuicConnection : public QuicConnection { |
61 public: | 64 public: |
62 TestQuicConnection(const QuicVersionVector& versions, | 65 TestQuicConnection(const QuicVersionVector& versions, |
63 QuicConnectionId connection_id, | 66 QuicConnectionId connection_id, |
64 IPEndPoint address, | 67 IPEndPoint address, |
65 QuicConnectionHelper* helper, | 68 QuicConnectionHelper* helper, |
66 const QuicConnection::PacketWriterFactory& writer_factory) | 69 const QuicConnection::PacketWriterFactory& writer_factory) |
67 : QuicConnection(connection_id, | 70 : QuicConnection(connection_id, |
68 address, | 71 address, |
69 helper, | 72 helper, |
70 writer_factory, | 73 writer_factory, |
71 true /* owns_writer */, | 74 true /* owns_writer */, |
72 Perspective::IS_CLIENT, | 75 Perspective::IS_CLIENT, |
73 false /* is_secure */, | 76 false /* is_secure */, |
74 versions) {} | 77 versions, |
| 78 scoped_ptr<SocketPerformanceWatcher>()) {} |
75 | 79 |
76 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) { | 80 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) { |
77 QuicConnectionPeer::SetSendAlgorithm(this, send_algorithm); | 81 QuicConnectionPeer::SetSendAlgorithm(this, send_algorithm); |
78 } | 82 } |
79 }; | 83 }; |
80 | 84 |
81 // Subclass of QuicHttpStream that closes itself when the first piece of data | 85 // Subclass of QuicHttpStream that closes itself when the first piece of data |
82 // is received. | 86 // is received. |
83 class AutoClosingStream : public QuicHttpStream { | 87 class AutoClosingStream : public QuicHttpStream { |
84 public: | 88 public: |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 reliable_stream->SetDelegate(delegate); | 842 reliable_stream->SetDelegate(delegate); |
839 | 843 |
840 // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the | 844 // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the |
841 // payload. | 845 // payload. |
842 EXPECT_EQ(0, stream_->GetTotalSentBytes()); | 846 EXPECT_EQ(0, stream_->GetTotalSentBytes()); |
843 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); | 847 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); |
844 } | 848 } |
845 | 849 |
846 } // namespace test | 850 } // namespace test |
847 } // namespace net | 851 } // namespace net |
OLD | NEW |