| 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 // 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 class StrictStaticSocketDataProvider : public StaticSocketDataProvider { | 83 class StrictStaticSocketDataProvider : public StaticSocketDataProvider { |
| 84 public: | 84 public: |
| 85 StrictStaticSocketDataProvider(MockRead* reads, | 85 StrictStaticSocketDataProvider(MockRead* reads, |
| 86 size_t reads_count, | 86 size_t reads_count, |
| 87 MockWrite* writes, | 87 MockWrite* writes, |
| 88 size_t writes_count, | 88 size_t writes_count, |
| 89 bool strict_mode) | 89 bool strict_mode) |
| 90 : StaticSocketDataProvider(reads, reads_count, writes, writes_count), | 90 : StaticSocketDataProvider(reads, reads_count, writes, writes_count), |
| 91 strict_mode_(strict_mode) {} | 91 strict_mode_(strict_mode) {} |
| 92 | 92 |
| 93 virtual ~StrictStaticSocketDataProvider() { | 93 ~StrictStaticSocketDataProvider() override { |
| 94 if (strict_mode_) { | 94 if (strict_mode_) { |
| 95 EXPECT_EQ(read_count(), read_index()); | 95 EXPECT_EQ(read_count(), read_index()); |
| 96 EXPECT_EQ(write_count(), write_index()); | 96 EXPECT_EQ(write_count(), write_index()); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 const bool strict_mode_; | 101 const bool strict_mode_; |
| 102 }; | 102 }; |
| 103 | 103 |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 | 936 |
| 937 TEST_F(WebSocketBasicStreamSocketTest, GetSubProtocolWorks) { | 937 TEST_F(WebSocketBasicStreamSocketTest, GetSubProtocolWorks) { |
| 938 sub_protocol_ = "cyberchat"; | 938 sub_protocol_ = "cyberchat"; |
| 939 CreateNullStream(); | 939 CreateNullStream(); |
| 940 | 940 |
| 941 EXPECT_EQ("cyberchat", stream_->GetSubProtocol()); | 941 EXPECT_EQ("cyberchat", stream_->GetSubProtocol()); |
| 942 } | 942 } |
| 943 | 943 |
| 944 } // namespace | 944 } // namespace |
| 945 } // namespace net | 945 } // namespace net |
| OLD | NEW |