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

Side by Side Diff: net/spdy/spdy_framer_test.cc

Issue 294523007: Fix kType narrowing conversion in the `{}` (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <iostream> 6 #include <iostream>
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 2894 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 } 2905 }
2906 2906
2907 TEST_P(SpdyFramerTest, SerializeBlocked) { 2907 TEST_P(SpdyFramerTest, SerializeBlocked) {
2908 if (spdy_version_ <= SPDY3) { 2908 if (spdy_version_ <= SPDY3) {
2909 return; 2909 return;
2910 } 2910 }
2911 2911
2912 SpdyFramer framer(spdy_version_); 2912 SpdyFramer framer(spdy_version_);
2913 2913
2914 const char kDescription[] = "BLOCKED frame"; 2914 const char kDescription[] = "BLOCKED frame";
2915 const char kType = static_cast<unsigned char>( 2915 const unsigned char kType = static_cast<unsigned char>(
2916 SpdyConstants::SerializeFrameType(spdy_version_, BLOCKED)); 2916 SpdyConstants::SerializeFrameType(spdy_version_, BLOCKED));
2917 const unsigned char kFrameData[] = { 2917 const unsigned char kFrameData[] = {
2918 0x00, 0x00, kType, 0x00, 2918 0x00, 0x00, kType, 0x00,
2919 0x00, 0x00, 0x00, 0x00, 2919 0x00, 0x00, 0x00, 0x00,
2920 }; 2920 };
2921 SpdyBlockedIR blocked_ir(0); 2921 SpdyBlockedIR blocked_ir(0);
2922 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir)); 2922 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir));
2923 CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData)); 2923 CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData));
2924 } 2924 }
2925 2925
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 } 2971 }
2972 2972
2973 TEST_P(SpdyFramerTest, CreateAltSvc) { 2973 TEST_P(SpdyFramerTest, CreateAltSvc) {
2974 if (spdy_version_ <= SPDY3) { 2974 if (spdy_version_ <= SPDY3) {
2975 return; 2975 return;
2976 } 2976 }
2977 2977
2978 SpdyFramer framer(spdy_version_); 2978 SpdyFramer framer(spdy_version_);
2979 2979
2980 const char kDescription[] = "ALTSVC frame"; 2980 const char kDescription[] = "ALTSVC frame";
2981 const char kType = static_cast<unsigned char>( 2981 const unsigned char kType = static_cast<unsigned char>(
2982 SpdyConstants::SerializeFrameType(spdy_version_, ALTSVC)); 2982 SpdyConstants::SerializeFrameType(spdy_version_, ALTSVC));
2983 const unsigned char kFrameData[] = { 2983 const unsigned char kFrameData[] = {
2984 0x00, 0x17, kType, 0x00, 2984 0x00, 0x17, kType, 0x00,
2985 0x00, 0x00, 0x00, 0x03, 2985 0x00, 0x00, 0x00, 0x03,
2986 0x00, 0x00, 0x00, 0x05, 2986 0x00, 0x00, 0x00, 0x05,
2987 0x01, 0xbb, 0x00, 0x04, // Port = 443 2987 0x01, 0xbb, 0x00, 0x04, // Port = 443
2988 'p', 'i', 'd', '1', // Protocol-ID 2988 'p', 'i', 'd', '1', // Protocol-ID
2989 0x04, 'h', 'o', 's', 2989 0x04, 'h', 'o', 's',
2990 't', 'o', 'r', 'i', 2990 't', 'o', 'r', 'i',
2991 'g', 'i', 'n', 2991 'g', 'i', 'n',
(...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after
5217 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); 5217 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state());
5218 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) 5218 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
5219 << SpdyFramer::ErrorCodeToString(framer.error_code()); 5219 << SpdyFramer::ErrorCodeToString(framer.error_code());
5220 } 5220 }
5221 5221
5222 TEST_P(SpdyFramerTest, OnAltSvcBadLengths) { 5222 TEST_P(SpdyFramerTest, OnAltSvcBadLengths) {
5223 if (spdy_version_ <= SPDY3) { 5223 if (spdy_version_ <= SPDY3) {
5224 return; 5224 return;
5225 } 5225 }
5226 5226
5227 const char kType = static_cast<unsigned char>( 5227 const unsigned char kType = static_cast<unsigned char>(
5228 SpdyConstants::SerializeFrameType(spdy_version_, ALTSVC)); 5228 SpdyConstants::SerializeFrameType(spdy_version_, ALTSVC));
5229 { 5229 {
5230 TestSpdyVisitor visitor(spdy_version_); 5230 TestSpdyVisitor visitor(spdy_version_);
5231 SpdyFramer framer(spdy_version_); 5231 SpdyFramer framer(spdy_version_);
5232 framer.set_visitor(&visitor); 5232 framer.set_visitor(&visitor);
5233 5233
5234 const unsigned char kFrameDataLargePIDLen[] = { 5234 const unsigned char kFrameDataLargePIDLen[] = {
5235 0x00, 0x17, kType, 0x00, 5235 0x00, 0x17, kType, 0x00,
5236 0x00, 0x00, 0x00, 0x03, 5236 0x00, 0x00, 0x00, 0x03,
5237 0x00, 0x00, 0x00, 0x05, 5237 0x00, 0x00, 0x00, 0x05,
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
5390 TestSpdyVisitor visitor(spdy_version_); 5390 TestSpdyVisitor visitor(spdy_version_);
5391 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData)); 5391 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData));
5392 5392
5393 EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state()); 5393 EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state());
5394 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, 5394 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME,
5395 visitor.framer_.error_code()) 5395 visitor.framer_.error_code())
5396 << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code()); 5396 << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code());
5397 } 5397 }
5398 5398
5399 } // namespace net 5399 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698