OLD | NEW |
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 2969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2980 } | 2980 } |
2981 | 2981 |
2982 TEST_P(SpdyFramerTest, CreatePriority) { | 2982 TEST_P(SpdyFramerTest, CreatePriority) { |
2983 if (spdy_version_ <= SPDY3) { | 2983 if (spdy_version_ <= SPDY3) { |
2984 return; | 2984 return; |
2985 } | 2985 } |
2986 | 2986 |
2987 SpdyFramer framer(spdy_version_); | 2987 SpdyFramer framer(spdy_version_); |
2988 | 2988 |
2989 const char kDescription[] = "PRIORITY frame"; | 2989 const char kDescription[] = "PRIORITY frame"; |
2990 const char kType = static_cast<unsigned char>( | 2990 const unsigned char kType = static_cast<unsigned char>( |
2991 SpdyConstants::SerializeFrameType(spdy_version_, PRIORITY)); | 2991 SpdyConstants::SerializeFrameType(spdy_version_, PRIORITY)); |
2992 const unsigned char kFrameData[] = { | 2992 const unsigned char kFrameData[] = { |
2993 0x00, 0x05, kType, 0x00, | 2993 0x00, 0x05, kType, 0x00, |
2994 0x00, 0x00, 0x00, 0x02, // Stream ID = 2 | 2994 0x00, 0x00, 0x00, 0x02, // Stream ID = 2 |
2995 0x80, 0x00, 0x00, 0x01, // Exclusive dependency, parent stream ID = 1 | 2995 0x80, 0x00, 0x00, 0x01, // Exclusive dependency, parent stream ID = 1 |
2996 0x10, // Weight = 16 | 2996 0x10, // Weight = 16 |
2997 }; | 2997 }; |
2998 SpdyPriorityIR priority_ir(2, 1, 16, true); | 2998 SpdyPriorityIR priority_ir(2, 1, 16, true); |
2999 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(priority_ir)); | 2999 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(priority_ir)); |
3000 CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData)); | 3000 CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData)); |
(...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5362 EXPECT_EQ(4u, framer.MapWeightToPriority(109)); | 5362 EXPECT_EQ(4u, framer.MapWeightToPriority(109)); |
5363 EXPECT_EQ(4u, framer.MapWeightToPriority(74)); | 5363 EXPECT_EQ(4u, framer.MapWeightToPriority(74)); |
5364 EXPECT_EQ(5u, framer.MapWeightToPriority(73)); | 5364 EXPECT_EQ(5u, framer.MapWeightToPriority(73)); |
5365 EXPECT_EQ(5u, framer.MapWeightToPriority(37)); | 5365 EXPECT_EQ(5u, framer.MapWeightToPriority(37)); |
5366 EXPECT_EQ(6u, framer.MapWeightToPriority(36)); | 5366 EXPECT_EQ(6u, framer.MapWeightToPriority(36)); |
5367 EXPECT_EQ(6u, framer.MapWeightToPriority(1)); | 5367 EXPECT_EQ(6u, framer.MapWeightToPriority(1)); |
5368 EXPECT_EQ(7u, framer.MapWeightToPriority(0)); | 5368 EXPECT_EQ(7u, framer.MapWeightToPriority(0)); |
5369 } | 5369 } |
5370 | 5370 |
5371 } // namespace net | 5371 } // namespace net |
OLD | NEW |