OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/spdy/spdy_test_util_common.h" | 5 #include "net/spdy/spdy_test_util_common.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 class PriorityGetter : public BufferedSpdyFramerVisitorInterface { | 208 class PriorityGetter : public BufferedSpdyFramerVisitorInterface { |
209 public: | 209 public: |
210 PriorityGetter() : priority_(0) {} | 210 PriorityGetter() : priority_(0) {} |
211 virtual ~PriorityGetter() {} | 211 virtual ~PriorityGetter() {} |
212 | 212 |
213 SpdyPriority priority() const { | 213 SpdyPriority priority() const { |
214 return priority_; | 214 return priority_; |
215 } | 215 } |
216 | 216 |
217 virtual void OnError(SpdyFramer::SpdyError error_code) OVERRIDE {} | 217 virtual void OnError(SpdyFramer::SpdyError error_code) override {} |
218 virtual void OnStreamError(SpdyStreamId stream_id, | 218 virtual void OnStreamError(SpdyStreamId stream_id, |
219 const std::string& description) OVERRIDE {} | 219 const std::string& description) override {} |
220 virtual void OnSynStream(SpdyStreamId stream_id, | 220 virtual void OnSynStream(SpdyStreamId stream_id, |
221 SpdyStreamId associated_stream_id, | 221 SpdyStreamId associated_stream_id, |
222 SpdyPriority priority, | 222 SpdyPriority priority, |
223 bool fin, | 223 bool fin, |
224 bool unidirectional, | 224 bool unidirectional, |
225 const SpdyHeaderBlock& headers) OVERRIDE { | 225 const SpdyHeaderBlock& headers) override { |
226 priority_ = priority; | 226 priority_ = priority; |
227 } | 227 } |
228 virtual void OnSynReply(SpdyStreamId stream_id, | 228 virtual void OnSynReply(SpdyStreamId stream_id, |
229 bool fin, | 229 bool fin, |
230 const SpdyHeaderBlock& headers) OVERRIDE {} | 230 const SpdyHeaderBlock& headers) override {} |
231 virtual void OnHeaders(SpdyStreamId stream_id, | 231 virtual void OnHeaders(SpdyStreamId stream_id, |
232 bool fin, | 232 bool fin, |
233 const SpdyHeaderBlock& headers) OVERRIDE {} | 233 const SpdyHeaderBlock& headers) override {} |
234 virtual void OnDataFrameHeader(SpdyStreamId stream_id, | 234 virtual void OnDataFrameHeader(SpdyStreamId stream_id, |
235 size_t length, | 235 size_t length, |
236 bool fin) OVERRIDE {} | 236 bool fin) override {} |
237 virtual void OnStreamFrameData(SpdyStreamId stream_id, | 237 virtual void OnStreamFrameData(SpdyStreamId stream_id, |
238 const char* data, | 238 const char* data, |
239 size_t len, | 239 size_t len, |
240 bool fin) OVERRIDE {} | 240 bool fin) override {} |
241 virtual void OnSettings(bool clear_persisted) OVERRIDE {} | 241 virtual void OnSettings(bool clear_persisted) override {} |
242 virtual void OnSetting( | 242 virtual void OnSetting( |
243 SpdySettingsIds id, uint8 flags, uint32 value) OVERRIDE {} | 243 SpdySettingsIds id, uint8 flags, uint32 value) override {} |
244 virtual void OnPing(SpdyPingId unique_id, bool is_ack) OVERRIDE {} | 244 virtual void OnPing(SpdyPingId unique_id, bool is_ack) override {} |
245 virtual void OnRstStream(SpdyStreamId stream_id, | 245 virtual void OnRstStream(SpdyStreamId stream_id, |
246 SpdyRstStreamStatus status) OVERRIDE {} | 246 SpdyRstStreamStatus status) override {} |
247 virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, | 247 virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, |
248 SpdyGoAwayStatus status) OVERRIDE {} | 248 SpdyGoAwayStatus status) override {} |
249 virtual void OnWindowUpdate(SpdyStreamId stream_id, | 249 virtual void OnWindowUpdate(SpdyStreamId stream_id, |
250 uint32 delta_window_size) OVERRIDE {} | 250 uint32 delta_window_size) override {} |
251 virtual void OnPushPromise(SpdyStreamId stream_id, | 251 virtual void OnPushPromise(SpdyStreamId stream_id, |
252 SpdyStreamId promised_stream_id, | 252 SpdyStreamId promised_stream_id, |
253 const SpdyHeaderBlock& headers) OVERRIDE {} | 253 const SpdyHeaderBlock& headers) override {} |
254 virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) OVERRIDE { | 254 virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override { |
255 return false; | 255 return false; |
256 } | 256 } |
257 | 257 |
258 private: | 258 private: |
259 SpdyPriority priority_; | 259 SpdyPriority priority_; |
260 }; | 260 }; |
261 | 261 |
262 } // namespace | 262 } // namespace |
263 | 263 |
264 bool GetSpdyPriority(SpdyMajorVersion version, | 264 bool GetSpdyPriority(SpdyMajorVersion version, |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 // A ClientSocket used for CreateFakeSpdySession() below. | 609 // A ClientSocket used for CreateFakeSpdySession() below. |
610 class FakeSpdySessionClientSocket : public MockClientSocket { | 610 class FakeSpdySessionClientSocket : public MockClientSocket { |
611 public: | 611 public: |
612 FakeSpdySessionClientSocket(int read_result) | 612 FakeSpdySessionClientSocket(int read_result) |
613 : MockClientSocket(BoundNetLog()), | 613 : MockClientSocket(BoundNetLog()), |
614 read_result_(read_result) {} | 614 read_result_(read_result) {} |
615 | 615 |
616 virtual ~FakeSpdySessionClientSocket() {} | 616 virtual ~FakeSpdySessionClientSocket() {} |
617 | 617 |
618 virtual int Read(IOBuffer* buf, int buf_len, | 618 virtual int Read(IOBuffer* buf, int buf_len, |
619 const CompletionCallback& callback) OVERRIDE { | 619 const CompletionCallback& callback) override { |
620 return read_result_; | 620 return read_result_; |
621 } | 621 } |
622 | 622 |
623 virtual int Write(IOBuffer* buf, int buf_len, | 623 virtual int Write(IOBuffer* buf, int buf_len, |
624 const CompletionCallback& callback) OVERRIDE { | 624 const CompletionCallback& callback) override { |
625 return ERR_IO_PENDING; | 625 return ERR_IO_PENDING; |
626 } | 626 } |
627 | 627 |
628 // Return kProtoUnknown to use the pool's default protocol. | 628 // Return kProtoUnknown to use the pool's default protocol. |
629 virtual NextProto GetNegotiatedProtocol() const OVERRIDE { | 629 virtual NextProto GetNegotiatedProtocol() const override { |
630 return kProtoUnknown; | 630 return kProtoUnknown; |
631 } | 631 } |
632 | 632 |
633 // The functions below are not expected to be called. | 633 // The functions below are not expected to be called. |
634 | 634 |
635 virtual int Connect(const CompletionCallback& callback) OVERRIDE { | 635 virtual int Connect(const CompletionCallback& callback) override { |
636 ADD_FAILURE(); | 636 ADD_FAILURE(); |
637 return ERR_UNEXPECTED; | 637 return ERR_UNEXPECTED; |
638 } | 638 } |
639 | 639 |
640 virtual bool WasEverUsed() const OVERRIDE { | 640 virtual bool WasEverUsed() const override { |
641 ADD_FAILURE(); | 641 ADD_FAILURE(); |
642 return false; | 642 return false; |
643 } | 643 } |
644 | 644 |
645 virtual bool UsingTCPFastOpen() const OVERRIDE { | 645 virtual bool UsingTCPFastOpen() const override { |
646 ADD_FAILURE(); | 646 ADD_FAILURE(); |
647 return false; | 647 return false; |
648 } | 648 } |
649 | 649 |
650 virtual bool WasNpnNegotiated() const OVERRIDE { | 650 virtual bool WasNpnNegotiated() const override { |
651 ADD_FAILURE(); | 651 ADD_FAILURE(); |
652 return false; | 652 return false; |
653 } | 653 } |
654 | 654 |
655 virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { | 655 virtual bool GetSSLInfo(SSLInfo* ssl_info) override { |
656 ADD_FAILURE(); | 656 ADD_FAILURE(); |
657 return false; | 657 return false; |
658 } | 658 } |
659 | 659 |
660 private: | 660 private: |
661 int read_result_; | 661 int read_result_; |
662 }; | 662 }; |
663 | 663 |
664 base::WeakPtr<SpdySession> CreateFakeSpdySessionHelper( | 664 base::WeakPtr<SpdySession> CreateFakeSpdySessionHelper( |
665 SpdySessionPool* pool, | 665 SpdySessionPool* pool, |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 } | 1317 } |
1318 } | 1318 } |
1319 | 1319 |
1320 void SpdyTestUtil::SetPriority(RequestPriority priority, | 1320 void SpdyTestUtil::SetPriority(RequestPriority priority, |
1321 SpdySynStreamIR* ir) const { | 1321 SpdySynStreamIR* ir) const { |
1322 ir->set_priority(ConvertRequestPriorityToSpdyPriority( | 1322 ir->set_priority(ConvertRequestPriorityToSpdyPriority( |
1323 priority, spdy_version())); | 1323 priority, spdy_version())); |
1324 } | 1324 } |
1325 | 1325 |
1326 } // namespace net | 1326 } // namespace net |
OLD | NEW |