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

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

Issue 1399303002: net/websockets: Convert int types from basictypes.h to the ones from stdint.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: websocket_deflate_stream.cc Created 5 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_basic_stream.cc ('k') | net/websockets/websocket_channel.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 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 // Tests for WebSocketBasicStream. Note that we do not attempt to verify that 5 // Tests for WebSocketBasicStream. Note that we do not attempt to verify that
6 // frame parsing itself functions correctly, as that is covered by the 6 // frame parsing itself functions correctly, as that is covered by the
7 // WebSocketFrameParser tests. 7 // WebSocketFrameParser tests.
8 8
9 #include "net/websockets/websocket_basic_stream.h" 9 #include "net/websockets/websocket_basic_stream.h"
10 10
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 EXPECT_EQ(OK, cb_.WaitForResult()); 788 EXPECT_EQ(OK, cb_.WaitForResult());
789 ASSERT_EQ(1U, frames_.size()); 789 ASSERT_EQ(1U, frames_.size());
790 EXPECT_EQ(WebSocketFrameHeader::kOpCodeClose, frames_[0]->header.opcode); 790 EXPECT_EQ(WebSocketFrameHeader::kOpCodeClose, frames_[0]->header.opcode);
791 } 791 }
792 792
793 // A frame with a 1MB payload that has to be read in chunks. 793 // A frame with a 1MB payload that has to be read in chunks.
794 TEST_F(WebSocketBasicStreamSocketChunkedReadTest, OneMegFrame) { 794 TEST_F(WebSocketBasicStreamSocketChunkedReadTest, OneMegFrame) {
795 // This should be equal to the definition of kReadBufferSize in 795 // This should be equal to the definition of kReadBufferSize in
796 // websocket_basic_stream.cc. 796 // websocket_basic_stream.cc.
797 const int kReadBufferSize = 32 * 1024; 797 const int kReadBufferSize = 32 * 1024;
798 const uint64 kPayloadSize = 1 << 20; 798 const uint64_t kPayloadSize = 1 << 20;
799 const size_t kWireSize = kPayloadSize + kLargeFrameHeaderSize; 799 const size_t kWireSize = kPayloadSize + kLargeFrameHeaderSize;
800 const size_t kExpectedFrameCount = 800 const size_t kExpectedFrameCount =
801 (kWireSize + kReadBufferSize - 1) / kReadBufferSize; 801 (kWireSize + kReadBufferSize - 1) / kReadBufferSize;
802 scoped_ptr<char[]> big_frame(new char[kWireSize]); 802 scoped_ptr<char[]> big_frame(new char[kWireSize]);
803 memcpy(big_frame.get(), "\x81\x7F", 2); 803 memcpy(big_frame.get(), "\x81\x7F", 2);
804 base::WriteBigEndian(big_frame.get() + 2, kPayloadSize); 804 base::WriteBigEndian(big_frame.get() + 2, kPayloadSize);
805 memset(big_frame.get() + kLargeFrameHeaderSize, 'A', kPayloadSize); 805 memset(big_frame.get() + kLargeFrameHeaderSize, 'A', kPayloadSize);
806 806
807 CreateChunkedRead(ASYNC, 807 CreateChunkedRead(ASYNC,
808 big_frame.get(), 808 big_frame.get(),
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 934
935 TEST_F(WebSocketBasicStreamSocketTest, GetSubProtocolWorks) { 935 TEST_F(WebSocketBasicStreamSocketTest, GetSubProtocolWorks) {
936 sub_protocol_ = "cyberchat"; 936 sub_protocol_ = "cyberchat";
937 CreateNullStream(); 937 CreateNullStream();
938 938
939 EXPECT_EQ("cyberchat", stream_->GetSubProtocol()); 939 EXPECT_EQ("cyberchat", stream_->GetSubProtocol());
940 } 940 }
941 941
942 } // namespace 942 } // namespace
943 } // namespace net 943 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket_basic_stream.cc ('k') | net/websockets/websocket_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698