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

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

Issue 511163002: Net-related fixups for scoped_refptr conversion operator cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix naming to match Created 6 years, 3 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/socket/ssl_client_socket_pool.cc ('k') | no next file » | 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_inflater.h" 5 #include "net/websockets/websocket_inflater.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 EXPECT_FALSE(inflater.AddBytes("\xf2\x48\xcd\xc9INVALID DATA", 16)); 86 EXPECT_FALSE(inflater.AddBytes("\xf2\x48\xcd\xc9INVALID DATA", 16));
87 } 87 }
88 88
89 TEST(WebSocketInflaterTest, ChokedInvalidData) { 89 TEST(WebSocketInflaterTest, ChokedInvalidData) {
90 WebSocketInflater inflater(1, 1); 90 WebSocketInflater inflater(1, 1);
91 ASSERT_TRUE(inflater.Initialize(15)); 91 ASSERT_TRUE(inflater.Initialize(15));
92 92
93 EXPECT_TRUE(inflater.AddBytes("\xf2\x48\xcd\xc9INVALID DATA", 16)); 93 EXPECT_TRUE(inflater.AddBytes("\xf2\x48\xcd\xc9INVALID DATA", 16));
94 EXPECT_TRUE(inflater.Finish()); 94 EXPECT_TRUE(inflater.Finish());
95 EXPECT_EQ(1u, inflater.CurrentOutputSize()); 95 EXPECT_EQ(1u, inflater.CurrentOutputSize());
96 EXPECT_FALSE(inflater.GetOutput(1024)); 96 EXPECT_FALSE(inflater.GetOutput(1024).get());
97 } 97 }
98 98
99 TEST(WebSocketInflaterTest, MultipleAddBytesCalls) { 99 TEST(WebSocketInflaterTest, MultipleAddBytesCalls) {
100 WebSocketInflater inflater; 100 WebSocketInflater inflater;
101 ASSERT_TRUE(inflater.Initialize(15)); 101 ASSERT_TRUE(inflater.Initialize(15));
102 std::string input("\xf2\x48\xcd\xc9\xc9\x07\x00", 7); 102 std::string input("\xf2\x48\xcd\xc9\xc9\x07\x00", 7);
103 scoped_refptr<IOBufferWithSize> actual; 103 scoped_refptr<IOBufferWithSize> actual;
104 104
105 for (size_t i = 0; i < input.size(); ++i) { 105 for (size_t i = 0; i < input.size(); ++i) {
106 ASSERT_TRUE(inflater.AddBytes(&input[i], 1)); 106 ASSERT_TRUE(inflater.AddBytes(&input[i], 1));
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 uncompressed->data(), 215 uncompressed->data(),
216 uncompressed->data() + uncompressed->size()); 216 uncompressed->data() + uncompressed->size());
217 } 217 }
218 218
219 EXPECT_EQ(output, input); 219 EXPECT_EQ(output, input);
220 } 220 }
221 221
222 } // unnamed namespace 222 } // unnamed namespace
223 223
224 } // namespace net 224 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698