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 <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 int ProducerToInt(std::unique_ptr<SpdyBufferProducer> producer) { | 88 int ProducerToInt(std::unique_ptr<SpdyBufferProducer> producer) { |
89 int i = 0; | 89 int i = 0; |
90 EXPECT_TRUE(base::StringToInt(ProducerToString(std::move(producer)), &i)); | 90 EXPECT_TRUE(base::StringToInt(ProducerToString(std::move(producer)), &i)); |
91 return i; | 91 return i; |
92 } | 92 } |
93 | 93 |
94 // Makes a SpdyStream with the given priority and a NULL SpdySession | 94 // Makes a SpdyStream with the given priority and a NULL SpdySession |
95 // -- be careful to not call any functions that expect the session to | 95 // -- be careful to not call any functions that expect the session to |
96 // be there. | 96 // be there. |
97 SpdyStream* MakeTestStream(RequestPriority priority) { | 97 SpdyStream* MakeTestStream(RequestPriority priority) { |
98 return new SpdyStream( | 98 return new SpdyStream(SPDY_BIDIRECTIONAL_STREAM, base::WeakPtr<SpdySession>(), |
99 SPDY_BIDIRECTIONAL_STREAM, base::WeakPtr<SpdySession>(), | 99 GURL(), priority, 0, 0, NetLogWithSource()); |
100 GURL(), priority, 0, 0, BoundNetLog()); | |
101 } | 100 } |
102 | 101 |
103 // Add some frame producers of different priority. The producers | 102 // Add some frame producers of different priority. The producers |
104 // should be dequeued in priority order with their associated stream. | 103 // should be dequeued in priority order with their associated stream. |
105 TEST_F(SpdyWriteQueueTest, DequeuesByPriority) { | 104 TEST_F(SpdyWriteQueueTest, DequeuesByPriority) { |
106 SpdyWriteQueue write_queue; | 105 SpdyWriteQueue write_queue; |
107 | 106 |
108 std::unique_ptr<SpdyBufferProducer> producer_low = StringToProducer("LOW"); | 107 std::unique_ptr<SpdyBufferProducer> producer_low = StringToProducer("LOW"); |
109 std::unique_ptr<SpdyBufferProducer> producer_medium = | 108 std::unique_ptr<SpdyBufferProducer> producer_medium = |
110 StringToProducer("MEDIUM"); | 109 StringToProducer("MEDIUM"); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 std::unique_ptr<SpdyBufferProducer> producer; | 361 std::unique_ptr<SpdyBufferProducer> producer; |
363 base::WeakPtr<SpdyStream> weak_stream; | 362 base::WeakPtr<SpdyStream> weak_stream; |
364 | 363 |
365 EXPECT_TRUE(queue.Dequeue(&frame_type, &producer, &weak_stream)); | 364 EXPECT_TRUE(queue.Dequeue(&frame_type, &producer, &weak_stream)); |
366 EXPECT_EQ(string(kRequeued), producer->ProduceBuffer()->GetRemainingData()); | 365 EXPECT_EQ(string(kRequeued), producer->ProduceBuffer()->GetRemainingData()); |
367 } | 366 } |
368 | 367 |
369 } // namespace | 368 } // namespace |
370 | 369 |
371 } // namespace net | 370 } // namespace net |
OLD | NEW |