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

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

Issue 663043004: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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_test.cc ('k') | net/websockets/websocket_job_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_deflate_stream.h" 5 #include "net/websockets/websocket_deflate_stream.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 10
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 std::deque<const WebSocketFrame*> frames_written_; 205 std::deque<const WebSocketFrame*> frames_written_;
206 206
207 DISALLOW_COPY_AND_ASSIGN(WebSocketDeflatePredictorMock); 207 DISALLOW_COPY_AND_ASSIGN(WebSocketDeflatePredictorMock);
208 }; 208 };
209 209
210 class WebSocketDeflateStreamTest : public ::testing::Test { 210 class WebSocketDeflateStreamTest : public ::testing::Test {
211 public: 211 public:
212 WebSocketDeflateStreamTest() 212 WebSocketDeflateStreamTest()
213 : mock_stream_(NULL), 213 : mock_stream_(NULL),
214 predictor_(NULL) {} 214 predictor_(NULL) {}
215 virtual ~WebSocketDeflateStreamTest() {} 215 ~WebSocketDeflateStreamTest() override {}
216 216
217 virtual void SetUp() { 217 void SetUp() override {
218 Initialize(WebSocketDeflater::TAKE_OVER_CONTEXT, kWindowBits); 218 Initialize(WebSocketDeflater::TAKE_OVER_CONTEXT, kWindowBits);
219 } 219 }
220 220
221 protected: 221 protected:
222 // Initialize deflate_stream_ with the given parameters. 222 // Initialize deflate_stream_ with the given parameters.
223 void Initialize(WebSocketDeflater::ContextTakeOverMode mode, 223 void Initialize(WebSocketDeflater::ContextTakeOverMode mode,
224 int window_bits) { 224 int window_bits) {
225 mock_stream_ = new testing::StrictMock<MockWebSocketStream>; 225 mock_stream_ = new testing::StrictMock<MockWebSocketStream>;
226 predictor_ = new WebSocketDeflatePredictorMock; 226 predictor_ = new WebSocketDeflatePredictorMock;
227 deflate_stream_.reset(new WebSocketDeflateStream( 227 deflate_stream_.reset(new WebSocketDeflateStream(
(...skipping 10 matching lines...) Expand all
238 WebSocketDeflatePredictorMock* predictor_; 238 WebSocketDeflatePredictorMock* predictor_;
239 }; 239 };
240 240
241 // Since WebSocketDeflater with DoNotTakeOverContext is well tested at 241 // Since WebSocketDeflater with DoNotTakeOverContext is well tested at
242 // websocket_deflater_test.cc, we have only a few tests for this configuration 242 // websocket_deflater_test.cc, we have only a few tests for this configuration
243 // here. 243 // here.
244 class WebSocketDeflateStreamWithDoNotTakeOverContextTest 244 class WebSocketDeflateStreamWithDoNotTakeOverContextTest
245 : public WebSocketDeflateStreamTest { 245 : public WebSocketDeflateStreamTest {
246 public: 246 public:
247 WebSocketDeflateStreamWithDoNotTakeOverContextTest() {} 247 WebSocketDeflateStreamWithDoNotTakeOverContextTest() {}
248 virtual ~WebSocketDeflateStreamWithDoNotTakeOverContextTest() {} 248 ~WebSocketDeflateStreamWithDoNotTakeOverContextTest() override {}
249 249
250 virtual void SetUp() { 250 void SetUp() override {
251 Initialize(WebSocketDeflater::DO_NOT_TAKE_OVER_CONTEXT, kWindowBits); 251 Initialize(WebSocketDeflater::DO_NOT_TAKE_OVER_CONTEXT, kWindowBits);
252 } 252 }
253 }; 253 };
254 254
255 class WebSocketDeflateStreamWithClientWindowBitsTest 255 class WebSocketDeflateStreamWithClientWindowBitsTest
256 : public WebSocketDeflateStreamTest { 256 : public WebSocketDeflateStreamTest {
257 public: 257 public:
258 WebSocketDeflateStreamWithClientWindowBitsTest() {} 258 WebSocketDeflateStreamWithClientWindowBitsTest() {}
259 virtual ~WebSocketDeflateStreamWithClientWindowBitsTest() {} 259 ~WebSocketDeflateStreamWithClientWindowBitsTest() override {}
260 260
261 // Overridden to postpone the call to Initialize(). 261 // Overridden to postpone the call to Initialize().
262 virtual void SetUp() {} 262 void SetUp() override {}
263 263
264 // This needs to be called explicitly from the tests. 264 // This needs to be called explicitly from the tests.
265 void SetUpWithWindowBits(int window_bits) { 265 void SetUpWithWindowBits(int window_bits) {
266 Initialize(WebSocketDeflater::TAKE_OVER_CONTEXT, window_bits); 266 Initialize(WebSocketDeflater::TAKE_OVER_CONTEXT, window_bits);
267 } 267 }
268 268
269 // Add a frame which will be compressed to a smaller size if the window 269 // Add a frame which will be compressed to a smaller size if the window
270 // size is large enough. 270 // size is large enough.
271 void AddCompressibleFrameString() { 271 void AddCompressibleFrameString() {
272 const std::string word = "Chromium"; 272 const std::string word = "Chromium";
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 const ScopedVector<WebSocketFrame>& frames_passed = *stub.frames(); 1340 const ScopedVector<WebSocketFrame>& frames_passed = *stub.frames();
1341 ASSERT_EQ(1u, frames_passed.size()); 1341 ASSERT_EQ(1u, frames_passed.size());
1342 EXPECT_EQ( 1342 EXPECT_EQ(
1343 std::string("r\xce(\xca\xcf\xcd,\xcdM\x1c\xe1\xc0\x19\x1a\x0e\0\0", 17), 1343 std::string("r\xce(\xca\xcf\xcd,\xcdM\x1c\xe1\xc0\x19\x1a\x0e\0\0", 17),
1344 ToString(frames_passed[0])); 1344 ToString(frames_passed[0]));
1345 } 1345 }
1346 1346
1347 } // namespace 1347 } // namespace
1348 1348
1349 } // namespace net 1349 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket_channel_test.cc ('k') | net/websockets/websocket_job_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698