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

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

Issue 13990005: [SPDY] Replace SpdyIOBuffer with new SpdyBuffer class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix missing include Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_websocket_stream_spdy2_unittest.cc ('k') | net/spdy/spdy_write_queue.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_websocket_stream.h" 5 #include "net/spdy/spdy_websocket_stream.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 virtual void OnSentSpdyData(size_t bytes_sent) OVERRIDE { 109 virtual void OnSentSpdyData(size_t bytes_sent) OVERRIDE {
110 events_.push_back( 110 events_.push_back(
111 SpdyWebSocketStreamEvent( 111 SpdyWebSocketStreamEvent(
112 SpdyWebSocketStreamEvent::EVENT_SENT_DATA, 112 SpdyWebSocketStreamEvent::EVENT_SENT_DATA,
113 SpdyHeaderBlock(), 113 SpdyHeaderBlock(),
114 static_cast<int>(bytes_sent), 114 static_cast<int>(bytes_sent),
115 std::string())); 115 std::string()));
116 if (!on_sent_data_.is_null()) 116 if (!on_sent_data_.is_null())
117 on_sent_data_.Run(&events_.back()); 117 on_sent_data_.Run(&events_.back());
118 } 118 }
119 virtual void OnReceivedSpdyData(const char* data, int length) OVERRIDE { 119 virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) OVERRIDE {
120 std::string buffer_data;
121 size_t buffer_len = 0;
122 if (buffer) {
123 buffer_len = buffer->GetRemainingSize();
124 buffer_data.append(buffer->GetRemainingData(), buffer_len);
125 }
120 events_.push_back( 126 events_.push_back(
121 SpdyWebSocketStreamEvent( 127 SpdyWebSocketStreamEvent(
122 SpdyWebSocketStreamEvent::EVENT_RECEIVED_DATA, 128 SpdyWebSocketStreamEvent::EVENT_RECEIVED_DATA,
123 SpdyHeaderBlock(), 129 SpdyHeaderBlock(),
124 length, 130 buffer_len,
125 std::string(data, length))); 131 buffer_data));
126 if (!on_received_data_.is_null()) 132 if (!on_received_data_.is_null())
127 on_received_data_.Run(&events_.back()); 133 on_received_data_.Run(&events_.back());
128 } 134 }
129 virtual void OnCloseSpdyStream() OVERRIDE { 135 virtual void OnCloseSpdyStream() OVERRIDE {
130 events_.push_back( 136 events_.push_back(
131 SpdyWebSocketStreamEvent( 137 SpdyWebSocketStreamEvent(
132 SpdyWebSocketStreamEvent::EVENT_CLOSE, 138 SpdyWebSocketStreamEvent::EVENT_CLOSE,
133 SpdyHeaderBlock(), 139 SpdyHeaderBlock(),
134 OK, 140 OK,
135 std::string())); 141 std::string()));
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 EXPECT_EQ(OK, events[7].result); 612 EXPECT_EQ(OK, events[7].result);
607 613
608 // EOF close SPDY session. 614 // EOF close SPDY session.
609 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( 615 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession(
610 host_port_proxy_pair_)); 616 host_port_proxy_pair_));
611 EXPECT_TRUE(data()->at_read_eof()); 617 EXPECT_TRUE(data()->at_read_eof());
612 EXPECT_TRUE(data()->at_write_eof()); 618 EXPECT_TRUE(data()->at_write_eof());
613 } 619 }
614 620
615 } // namespace net 621 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_websocket_stream_spdy2_unittest.cc ('k') | net/spdy/spdy_write_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698