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

Side by Side Diff: net/websockets/websocket_channel_test.cc

Issue 2397393002: Provide child/frame IDs for WebSocket handshake request (Closed)
Patch Set: fix Created 4 years, 2 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/websockets/websocket_channel.cc ('k') | net/websockets/websocket_end_to_end_test.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/websockets/websocket_channel.h" 5 #include "net/websockets/websocket_channel.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 ChannelState OnDataFrame(bool fin, 161 ChannelState OnDataFrame(bool fin,
162 WebSocketMessageType type, 162 WebSocketMessageType type,
163 scoped_refptr<IOBuffer> buffer, 163 scoped_refptr<IOBuffer> buffer,
164 size_t buffer_size) override { 164 size_t buffer_size) override {
165 const char* data = buffer ? buffer->data() : nullptr; 165 const char* data = buffer ? buffer->data() : nullptr;
166 return OnDataFrameVector(fin, type, 166 return OnDataFrameVector(fin, type,
167 std::vector<char>(data, data + buffer_size)); 167 std::vector<char>(data, data + buffer_size));
168 } 168 }
169 169
170 MOCK_METHOD1(OnCreateURLRequest, void(URLRequest*));
170 MOCK_METHOD2(OnAddChannelResponse, 171 MOCK_METHOD2(OnAddChannelResponse,
171 ChannelState(const std::string&, 172 ChannelState(const std::string&,
172 const std::string&)); // NOLINT 173 const std::string&)); // NOLINT
173 MOCK_METHOD3(OnDataFrameVector, 174 MOCK_METHOD3(OnDataFrameVector,
174 ChannelState(bool, 175 ChannelState(bool,
175 WebSocketMessageType, 176 WebSocketMessageType,
176 const std::vector<char>&)); // NOLINT 177 const std::vector<char>&)); // NOLINT
177 MOCK_METHOD1(OnFlowControl, ChannelState(int64_t)); // NOLINT 178 MOCK_METHOD1(OnFlowControl, ChannelState(int64_t)); // NOLINT
178 MOCK_METHOD0(OnClosingHandshake, ChannelState(void)); // NOLINT 179 MOCK_METHOD0(OnClosingHandshake, ChannelState(void)); // NOLINT
179 MOCK_METHOD1(OnFailChannel, ChannelState(const std::string&)); // NOLINT 180 MOCK_METHOD1(OnFailChannel, ChannelState(const std::string&)); // NOLINT
(...skipping 24 matching lines...) Expand all
204 MOCK_METHOD0(OnStartOpeningHandshakeCalled, void()); // NOLINT 205 MOCK_METHOD0(OnStartOpeningHandshakeCalled, void()); // NOLINT
205 MOCK_METHOD0(OnFinishOpeningHandshakeCalled, void()); // NOLINT 206 MOCK_METHOD0(OnFinishOpeningHandshakeCalled, void()); // NOLINT
206 MOCK_METHOD4( 207 MOCK_METHOD4(
207 OnSSLCertificateErrorCalled, 208 OnSSLCertificateErrorCalled,
208 void(SSLErrorCallbacks*, const GURL&, const SSLInfo&, bool)); // NOLINT 209 void(SSLErrorCallbacks*, const GURL&, const SSLInfo&, bool)); // NOLINT
209 }; 210 };
210 211
211 // This fake EventInterface is for tests which need a WebSocketEventInterface 212 // This fake EventInterface is for tests which need a WebSocketEventInterface
212 // implementation but are not verifying how it is used. 213 // implementation but are not verifying how it is used.
213 class FakeWebSocketEventInterface : public WebSocketEventInterface { 214 class FakeWebSocketEventInterface : public WebSocketEventInterface {
215 void OnCreateURLRequest(URLRequest* request) override {}
214 ChannelState OnAddChannelResponse(const std::string& selected_protocol, 216 ChannelState OnAddChannelResponse(const std::string& selected_protocol,
215 const std::string& extensions) override { 217 const std::string& extensions) override {
216 return CHANNEL_ALIVE; 218 return CHANNEL_ALIVE;
217 } 219 }
218 ChannelState OnDataFrame(bool fin, 220 ChannelState OnDataFrame(bool fin,
219 WebSocketMessageType type, 221 WebSocketMessageType type,
220 scoped_refptr<IOBuffer> data, 222 scoped_refptr<IOBuffer> data,
221 size_t data_size) override { 223 size_t data_size) override {
222 return CHANNEL_ALIVE; 224 return CHANNEL_ALIVE;
223 } 225 }
(...skipping 3301 matching lines...) Expand 10 before | Expand all | Expand 10 after
3525 channel_->SendFrame( 3527 channel_->SendFrame(
3526 true, WebSocketFrameHeader::kOpCodeText, 3528 true, WebSocketFrameHeader::kOpCodeText,
3527 AsIOBuffer(std::string(static_cast<size_t>(kMessageSize), 'a')), 3529 AsIOBuffer(std::string(static_cast<size_t>(kMessageSize), 'a')),
3528 static_cast<size_t>(kMessageSize)); 3530 static_cast<size_t>(kMessageSize));
3529 int new_send_quota = channel_->current_send_quota(); 3531 int new_send_quota = channel_->current_send_quota();
3530 EXPECT_EQ(kMessageSize, initial_send_quota - new_send_quota); 3532 EXPECT_EQ(kMessageSize, initial_send_quota - new_send_quota);
3531 } 3533 }
3532 3534
3533 } // namespace 3535 } // namespace
3534 } // namespace net 3536 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket_channel.cc ('k') | net/websockets/websocket_end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698