| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 int ProducerToInt(scoped_ptr<SpdyFrameProducer> producer) { | 53 int ProducerToInt(scoped_ptr<SpdyFrameProducer> producer) { |
| 54 int i = 0; | 54 int i = 0; |
| 55 EXPECT_TRUE(base::StringToInt(ProducerToString(producer.Pass()), &i)); | 55 EXPECT_TRUE(base::StringToInt(ProducerToString(producer.Pass()), &i)); |
| 56 return i; | 56 return i; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Makes a SpdyStream with the given priority and a NULL SpdySession | 59 // Makes a SpdyStream with the given priority and a NULL SpdySession |
| 60 // -- be careful to not call any functions that expect the session to | 60 // -- be careful to not call any functions that expect the session to |
| 61 // be there. | 61 // be there. |
| 62 SpdyStream* MakeTestStream(RequestPriority priority) { | 62 SpdyStream* MakeTestStream(RequestPriority priority) { |
| 63 return new SpdyStream(NULL, "", priority, 0, 0, false, BoundNetLog()); | 63 return new SpdyStream( |
| 64 NULL, std::string(), priority, 0, 0, false, BoundNetLog()); |
| 64 } | 65 } |
| 65 | 66 |
| 66 // Add some frame producers of different priority. The producers | 67 // Add some frame producers of different priority. The producers |
| 67 // should be dequeued in priority order with their associated stream. | 68 // should be dequeued in priority order with their associated stream. |
| 68 TEST_F(SpdyWriteQueueTest, DequeuesByPriority) { | 69 TEST_F(SpdyWriteQueueTest, DequeuesByPriority) { |
| 69 SpdyWriteQueue write_queue; | 70 SpdyWriteQueue write_queue; |
| 70 | 71 |
| 71 scoped_ptr<SpdyFrameProducer> producer_low = StringToProducer("LOW"); | 72 scoped_ptr<SpdyFrameProducer> producer_low = StringToProducer("LOW"); |
| 72 scoped_ptr<SpdyFrameProducer> producer_medium = StringToProducer("MEDIUM"); | 73 scoped_ptr<SpdyFrameProducer> producer_medium = StringToProducer("MEDIUM"); |
| 73 scoped_ptr<SpdyFrameProducer> producer_highest = StringToProducer("HIGHEST"); | 74 scoped_ptr<SpdyFrameProducer> producer_highest = StringToProducer("HIGHEST"); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 write_queue.Clear(); | 175 write_queue.Clear(); |
| 175 | 176 |
| 176 scoped_ptr<SpdyFrameProducer> frame_producer; | 177 scoped_ptr<SpdyFrameProducer> frame_producer; |
| 177 scoped_refptr<SpdyStream> stream; | 178 scoped_refptr<SpdyStream> stream; |
| 178 EXPECT_FALSE(write_queue.Dequeue(&frame_producer, &stream)); | 179 EXPECT_FALSE(write_queue.Dequeue(&frame_producer, &stream)); |
| 179 } | 180 } |
| 180 | 181 |
| 181 } | 182 } |
| 182 | 183 |
| 183 } // namespace net | 184 } // namespace net |
| OLD | NEW |