OLD | NEW |
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 <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <iostream> | 10 #include <iostream> |
(...skipping 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2399 | 2399 |
2400 // An empty message handled when we are out of quota must not be delivered | 2400 // An empty message handled when we are out of quota must not be delivered |
2401 // out-of-order with respect to other messages. | 2401 // out-of-order with respect to other messages. |
2402 TEST_F(WebSocketChannelFlowControlTest, EmptyMessageNoQuota) { | 2402 TEST_F(WebSocketChannelFlowControlTest, EmptyMessageNoQuota) { |
2403 scoped_ptr<ReadableFakeWebSocketStream> stream( | 2403 scoped_ptr<ReadableFakeWebSocketStream> stream( |
2404 new ReadableFakeWebSocketStream); | 2404 new ReadableFakeWebSocketStream); |
2405 static const InitFrame frames[] = { | 2405 static const InitFrame frames[] = { |
2406 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, | 2406 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, |
2407 NOT_MASKED, "FIRST MESSAGE"}, | 2407 NOT_MASKED, "FIRST MESSAGE"}, |
2408 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, | 2408 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, |
2409 NOT_MASKED, ""}, | 2409 NOT_MASKED, NULL}, |
2410 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, | 2410 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, |
2411 NOT_MASKED, "THIRD MESSAGE"}}; | 2411 NOT_MASKED, "THIRD MESSAGE"}}; |
2412 stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); | 2412 stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); |
2413 set_stream(stream.Pass()); | 2413 set_stream(stream.Pass()); |
2414 { | 2414 { |
2415 InSequence s; | 2415 InSequence s; |
2416 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, _, _)); | 2416 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, _, _)); |
2417 EXPECT_CALL(*event_interface_, OnFlowControl(_)); | 2417 EXPECT_CALL(*event_interface_, OnFlowControl(_)); |
2418 EXPECT_CALL(*event_interface_, | 2418 EXPECT_CALL(*event_interface_, |
2419 OnDataFrame(false, | 2419 OnDataFrame(false, |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3374 channel_->StartClosingHandshake(kWebSocketNormalClosure, "OK"); | 3374 channel_->StartClosingHandshake(kWebSocketNormalClosure, "OK"); |
3375 ASSERT_TRUE(read_frames); | 3375 ASSERT_TRUE(read_frames); |
3376 // Provide the "Close" message from the server. | 3376 // Provide the "Close" message from the server. |
3377 *read_frames = CreateFrameVector(frames); | 3377 *read_frames = CreateFrameVector(frames); |
3378 read_callback.Run(OK); | 3378 read_callback.Run(OK); |
3379 completion.WaitForResult(); | 3379 completion.WaitForResult(); |
3380 } | 3380 } |
3381 | 3381 |
3382 } // namespace | 3382 } // namespace |
3383 } // namespace net | 3383 } // namespace net |
OLD | NEW |