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_write_queue.h" | 5 #include "net/spdy/spdy_write_queue.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <cstring> | 8 #include <cstring> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 int i = 0; | 57 int i = 0; |
58 EXPECT_TRUE(base::StringToInt(ProducerToString(producer.Pass()), &i)); | 58 EXPECT_TRUE(base::StringToInt(ProducerToString(producer.Pass()), &i)); |
59 return i; | 59 return i; |
60 } | 60 } |
61 | 61 |
62 // Makes a SpdyStream with the given priority and a NULL SpdySession | 62 // Makes a SpdyStream with the given priority and a NULL SpdySession |
63 // -- be careful to not call any functions that expect the session to | 63 // -- be careful to not call any functions that expect the session to |
64 // be there. | 64 // be there. |
65 SpdyStream* MakeTestStream(RequestPriority priority) { | 65 SpdyStream* MakeTestStream(RequestPriority priority) { |
66 return new SpdyStream( | 66 return new SpdyStream( |
67 SPDY_BIDIRECTIONAL_STREAM, NULL, GURL(), priority, | 67 SPDY_BIDIRECTIONAL_STREAM, base::WeakPtr<SpdySession>(), |
68 0, 0, BoundNetLog()); | 68 GURL(), priority, 0, 0, BoundNetLog()); |
69 } | 69 } |
70 | 70 |
71 // Add some frame producers of different priority. The producers | 71 // Add some frame producers of different priority. The producers |
72 // should be dequeued in priority order with their associated stream. | 72 // should be dequeued in priority order with their associated stream. |
73 TEST_F(SpdyWriteQueueTest, DequeuesByPriority) { | 73 TEST_F(SpdyWriteQueueTest, DequeuesByPriority) { |
74 SpdyWriteQueue write_queue; | 74 SpdyWriteQueue write_queue; |
75 | 75 |
76 scoped_ptr<SpdyBufferProducer> producer_low = StringToProducer("LOW"); | 76 scoped_ptr<SpdyBufferProducer> producer_low = StringToProducer("LOW"); |
77 scoped_ptr<SpdyBufferProducer> producer_medium = StringToProducer("MEDIUM"); | 77 scoped_ptr<SpdyBufferProducer> producer_medium = StringToProducer("MEDIUM"); |
78 scoped_ptr<SpdyBufferProducer> producer_highest = StringToProducer("HIGHEST"); | 78 scoped_ptr<SpdyBufferProducer> producer_highest = StringToProducer("HIGHEST"); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 243 |
244 SpdyFrameType frame_type = DATA; | 244 SpdyFrameType frame_type = DATA; |
245 scoped_ptr<SpdyBufferProducer> frame_producer; | 245 scoped_ptr<SpdyBufferProducer> frame_producer; |
246 base::WeakPtr<SpdyStream> stream; | 246 base::WeakPtr<SpdyStream> stream; |
247 EXPECT_FALSE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); | 247 EXPECT_FALSE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); |
248 } | 248 } |
249 | 249 |
250 } // namespace | 250 } // namespace |
251 | 251 |
252 } // namespace net | 252 } // namespace net |
OLD | NEW |