Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: net/spdy/spdy_write_queue_unittest.cc

Issue 1852423004: Implement SpdySerializedFrame move semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_test_utils.cc ('k') | net/tools/flip_server/spdy_interface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <utility> 10 #include <utility>
(...skipping 17 matching lines...) Expand all
28 const char kOriginal[] = "original"; 28 const char kOriginal[] = "original";
29 const char kRequeued[] = "requeued"; 29 const char kRequeued[] = "requeued";
30 30
31 class SpdyWriteQueueTest : public ::testing::Test {}; 31 class SpdyWriteQueueTest : public ::testing::Test {};
32 32
33 // Makes a SpdyFrameProducer producing a frame with the data in the 33 // Makes a SpdyFrameProducer producing a frame with the data in the
34 // given string. 34 // given string.
35 scoped_ptr<SpdyBufferProducer> StringToProducer(const std::string& s) { 35 scoped_ptr<SpdyBufferProducer> StringToProducer(const std::string& s) {
36 scoped_ptr<char[]> data(new char[s.size()]); 36 scoped_ptr<char[]> data(new char[s.size()]);
37 std::memcpy(data.get(), s.data(), s.size()); 37 std::memcpy(data.get(), s.data(), s.size());
38 return scoped_ptr<SpdyBufferProducer>( 38 return scoped_ptr<SpdyBufferProducer>(new SimpleBufferProducer(
39 new SimpleBufferProducer( 39 scoped_ptr<SpdyBuffer>(new SpdyBuffer(scoped_ptr<SpdySerializedFrame>(
40 scoped_ptr<SpdyBuffer>( 40 new SpdySerializedFrame(data.release(), s.size(), true))))));
41 new SpdyBuffer(
42 scoped_ptr<SpdyFrame>(
43 new SpdyFrame(data.release(), s.size(), true))))));
44 } 41 }
45 42
46 // Makes a SpdyBufferProducer producing a frame with the data in the 43 // Makes a SpdyBufferProducer producing a frame with the data in the
47 // given int (converted to a string). 44 // given int (converted to a string).
48 scoped_ptr<SpdyBufferProducer> IntToProducer(int i) { 45 scoped_ptr<SpdyBufferProducer> IntToProducer(int i) {
49 return StringToProducer(base::IntToString(i)); 46 return StringToProducer(base::IntToString(i));
50 } 47 }
51 48
52 // Producer whose produced buffer will enqueue yet another buffer into the 49 // Producer whose produced buffer will enqueue yet another buffer into the
53 // SpdyWriteQueue upon destruction. 50 // SpdyWriteQueue upon destruction.
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 scoped_ptr<SpdyBufferProducer> producer; 361 scoped_ptr<SpdyBufferProducer> producer;
365 base::WeakPtr<SpdyStream> weak_stream; 362 base::WeakPtr<SpdyStream> weak_stream;
366 363
367 EXPECT_TRUE(queue.Dequeue(&frame_type, &producer, &weak_stream)); 364 EXPECT_TRUE(queue.Dequeue(&frame_type, &producer, &weak_stream));
368 EXPECT_EQ(string(kRequeued), producer->ProduceBuffer()->GetRemainingData()); 365 EXPECT_EQ(string(kRequeued), producer->ProduceBuffer()->GetRemainingData());
369 } 366 }
370 367
371 } // namespace 368 } // namespace
372 369
373 } // namespace net 370 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_test_utils.cc ('k') | net/tools/flip_server/spdy_interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698