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 "net/spdy/spdy_protocol.h" | 5 #include "net/spdy/spdy_protocol.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "net/spdy/spdy_bitmasks.h" | 8 #include "net/spdy/spdy_bitmasks.h" |
9 #include "net/spdy/spdy_framer.h" | 9 #include "net/spdy/spdy_framer.h" |
10 #include "testing/platform_test.h" | 10 #include "testing/platform_test.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // We'll add several different ID/Flag combinations and then verify | 223 // We'll add several different ID/Flag combinations and then verify |
224 // that they encode and decode properly. | 224 // that they encode and decode properly. |
225 SettingsFlagsAndId ids[] = { | 225 SettingsFlagsAndId ids[] = { |
226 SettingsFlagsAndId::FromWireFormat(spdy_version_, 0x00000000), | 226 SettingsFlagsAndId::FromWireFormat(spdy_version_, 0x00000000), |
227 SettingsFlagsAndId::FromWireFormat(spdy_version_, 0xffffffff), | 227 SettingsFlagsAndId::FromWireFormat(spdy_version_, 0xffffffff), |
228 SettingsFlagsAndId::FromWireFormat(spdy_version_, 0xff000001), | 228 SettingsFlagsAndId::FromWireFormat(spdy_version_, 0xff000001), |
229 SettingsFlagsAndId::FromWireFormat(spdy_version_, 0x01000002), | 229 SettingsFlagsAndId::FromWireFormat(spdy_version_, 0x01000002), |
230 SettingsFlagsAndId(6, 9) | 230 SettingsFlagsAndId(6, 9) |
231 }; | 231 }; |
232 | 232 |
233 for (size_t index = 0; index < arraysize(ids); ++index) { | 233 for (uint32 index = 0; index < arraysize(ids); ++index) { |
234 SettingsFlagsAndId flags_and_id = ids[index]; | 234 SettingsFlagsAndId flags_and_id = ids[index]; |
235 SpdySettingsIds id = static_cast<SpdySettingsIds>(flags_and_id.id()); | 235 SpdySettingsIds id = static_cast<SpdySettingsIds>(flags_and_id.id()); |
236 SpdySettingsFlags flags = | 236 SpdySettingsFlags flags = |
237 static_cast<SpdySettingsFlags>(flags_and_id.flags()); | 237 static_cast<SpdySettingsFlags>(flags_and_id.flags()); |
238 settings[id] = SettingsFlagsAndValue(flags, index); | 238 settings[id] = SettingsFlagsAndValue(flags, index); |
239 settings_frame.reset(framer.CreateSettings(settings)); | 239 settings_frame.reset(framer.CreateSettings(settings)); |
240 EXPECT_EQ(framer.protocol_version(), settings_frame->version()); | 240 EXPECT_EQ(framer.protocol_version(), settings_frame->version()); |
241 EXPECT_TRUE(settings_frame->is_control_frame()); | 241 EXPECT_TRUE(settings_frame->is_control_frame()); |
242 EXPECT_EQ(SETTINGS, settings_frame->type()); | 242 EXPECT_EQ(SETTINGS, settings_frame->type()); |
243 EXPECT_EQ(index + 1, settings_frame->num_entries()); | 243 EXPECT_EQ(index + 1, settings_frame->num_entries()); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 380 |
381 rst_frame->set_status( | 381 rst_frame->set_status( |
382 static_cast<SpdyStatusCodes>(INVALID - 1)); | 382 static_cast<SpdyStatusCodes>(INVALID - 1)); |
383 EXPECT_EQ(INVALID, rst_frame->status()); | 383 EXPECT_EQ(INVALID, rst_frame->status()); |
384 | 384 |
385 rst_frame->set_status(NUM_STATUS_CODES); | 385 rst_frame->set_status(NUM_STATUS_CODES); |
386 EXPECT_EQ(INVALID, rst_frame->status()); | 386 EXPECT_EQ(INVALID, rst_frame->status()); |
387 } | 387 } |
388 | 388 |
389 } // namespace net | 389 } // namespace net |
OLD | NEW |