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

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

Issue 2944833002: cpplint fixes for //net/websockets (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | net/websockets/websocket_deflate_stream_fuzzer.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_channel.h" 5 #include "net/websockets/websocket_channel.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <string.h> 9 #include <string.h>
10 10
11 #include <algorithm>
11 #include <iostream> 12 #include <iostream>
12 #include <iterator> 13 #include <iterator>
13 #include <memory> 14 #include <memory>
14 #include <string> 15 #include <string>
15 #include <utility> 16 #include <utility>
16 #include <vector> 17 #include <vector>
17 18
18 #include "base/bind.h" 19 #include "base/bind.h"
19 #include "base/bind_helpers.h" 20 #include "base/bind_helpers.h"
20 #include "base/callback.h" 21 #include "base/callback.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // The implementation of a GoogleMock matcher which can be used to compare a 373 // The implementation of a GoogleMock matcher which can be used to compare a
373 // std::vector<std::unique_ptr<WebSocketFrame>>* against an expectation defined 374 // std::vector<std::unique_ptr<WebSocketFrame>>* against an expectation defined
374 // as an 375 // as an
375 // array of InitFrame objects. Although it is possible to compose built-in 376 // array of InitFrame objects. Although it is possible to compose built-in
376 // GoogleMock matchers to check the contents of a WebSocketFrame, the results 377 // GoogleMock matchers to check the contents of a WebSocketFrame, the results
377 // are so unreadable that it is better to use this matcher. 378 // are so unreadable that it is better to use this matcher.
378 template <size_t N> 379 template <size_t N>
379 class EqualsFramesMatcher : public ::testing::MatcherInterface< 380 class EqualsFramesMatcher : public ::testing::MatcherInterface<
380 std::vector<std::unique_ptr<WebSocketFrame>>*> { 381 std::vector<std::unique_ptr<WebSocketFrame>>*> {
381 public: 382 public:
382 EqualsFramesMatcher(const InitFrame (*expect_frames)[N]) 383 explicit EqualsFramesMatcher(const InitFrame (*expect_frames)[N])
383 : expect_frames_(expect_frames) {} 384 : expect_frames_(expect_frames) {}
384 385
385 virtual bool MatchAndExplain( 386 virtual bool MatchAndExplain(
386 std::vector<std::unique_ptr<WebSocketFrame>>* actual_frames, 387 std::vector<std::unique_ptr<WebSocketFrame>>* actual_frames,
387 ::testing::MatchResultListener* listener) const { 388 ::testing::MatchResultListener* listener) const {
388 if (actual_frames->size() != N) { 389 if (actual_frames->size() != N) {
389 *listener << "the vector size is " << actual_frames->size(); 390 *listener << "the vector size is " << actual_frames->size();
390 return false; 391 return false;
391 } 392 }
392 for (size_t i = 0; i < N; ++i) { 393 for (size_t i = 0; i < N; ++i) {
(...skipping 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3559 channel_->SendFrame( 3560 channel_->SendFrame(
3560 true, WebSocketFrameHeader::kOpCodeText, 3561 true, WebSocketFrameHeader::kOpCodeText,
3561 AsIOBuffer(std::string(static_cast<size_t>(kMessageSize), 'a')), 3562 AsIOBuffer(std::string(static_cast<size_t>(kMessageSize), 'a')),
3562 static_cast<size_t>(kMessageSize)); 3563 static_cast<size_t>(kMessageSize));
3563 int new_send_quota = channel_->current_send_quota(); 3564 int new_send_quota = channel_->current_send_quota();
3564 EXPECT_EQ(kMessageSize, initial_send_quota - new_send_quota); 3565 EXPECT_EQ(kMessageSize, initial_send_quota - new_send_quota);
3565 } 3566 }
3566 3567
3567 } // namespace 3568 } // namespace
3568 } // namespace net 3569 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/websockets/websocket_deflate_stream_fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698