| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 // Make sure that overflows both die in debug mode, and do not cause problems | 233 // Make sure that overflows both die in debug mode, and do not cause problems |
| 234 // in opt mode. Note: The EXPECT_DEBUG_DEATH call does not work on Win32 yet, | 234 // in opt mode. Note: The EXPECT_DEBUG_DEATH call does not work on Win32 yet, |
| 235 // so we comment it out. | 235 // so we comment it out. |
| 236 TEST(SpdyProtocolDeathTest, TestDataFrame) { | 236 TEST(SpdyProtocolDeathTest, TestDataFrame) { |
| 237 SpdyDataFrame frame; | 237 SpdyDataFrame frame; |
| 238 | 238 |
| 239 frame.set_stream_id(0); | 239 frame.set_stream_id(0); |
| 240 // TODO(mbelshe): implement EXPECT_DEBUG_DEATH on windows. | 240 // TODO(mbelshe): implement EXPECT_DEBUG_DEATH on windows. |
| 241 #ifndef WIN32 | 241 #ifndef WIN32 |
| 242 #if !defined(DCHECK_ALWAYS_ON) |
| 242 EXPECT_DEBUG_DEATH(frame.set_stream_id(~0), ""); | 243 EXPECT_DEBUG_DEATH(frame.set_stream_id(~0), ""); |
| 244 #else |
| 245 EXPECT_DEATH(frame.set_stream_id(~0), ""); |
| 246 #endif |
| 243 #endif | 247 #endif |
| 244 EXPECT_FALSE(frame.is_control_frame()); | 248 EXPECT_FALSE(frame.is_control_frame()); |
| 245 | 249 |
| 246 frame.set_flags(0); | 250 frame.set_flags(0); |
| 247 #ifndef WIN32 | 251 #ifndef WIN32 |
| 252 #if !defined(DCHECK_ALWAYS_ON) |
| 248 EXPECT_DEBUG_DEATH(frame.set_length(~0), ""); | 253 EXPECT_DEBUG_DEATH(frame.set_length(~0), ""); |
| 254 #else |
| 255 EXPECT_DEATH(frame.set_length(~0), ""); |
| 256 #endif |
| 249 #endif | 257 #endif |
| 250 EXPECT_EQ(0, frame.flags()); | 258 EXPECT_EQ(0, frame.flags()); |
| 251 } | 259 } |
| 252 | 260 |
| 253 TEST(SpdyProtocolDeathTest, TestSpdyControlFrameStreamId) { | 261 TEST(SpdyProtocolDeathTest, TestSpdyControlFrameStreamId) { |
| 254 SpdyControlFrame frame_store(SpdySynStreamControlFrame::size()); | 262 SpdyControlFrame frame_store(SpdySynStreamControlFrame::size()); |
| 255 memset(frame_store.data(), '1', SpdyControlFrame::size()); | 263 memset(frame_store.data(), '1', SpdyControlFrame::size()); |
| 256 SpdySynStreamControlFrame* frame = | 264 SpdySynStreamControlFrame* frame = |
| 257 reinterpret_cast<SpdySynStreamControlFrame*>(&frame_store); | 265 reinterpret_cast<SpdySynStreamControlFrame*>(&frame_store); |
| 258 | 266 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 frame.set_type(static_cast<SpdyControlType>(i)); | 307 frame.set_type(static_cast<SpdyControlType>(i)); |
| 300 EXPECT_EQ(i, static_cast<int>(frame.type())); | 308 EXPECT_EQ(i, static_cast<int>(frame.type())); |
| 301 EXPECT_TRUE(frame.AppearsToBeAValidControlFrame()); | 309 EXPECT_TRUE(frame.AppearsToBeAValidControlFrame()); |
| 302 // Make sure setting type does not alter the version block. | 310 // Make sure setting type does not alter the version block. |
| 303 EXPECT_EQ(version, frame.version()); | 311 EXPECT_EQ(version, frame.version()); |
| 304 EXPECT_TRUE(frame.is_control_frame()); | 312 EXPECT_TRUE(frame.is_control_frame()); |
| 305 } | 313 } |
| 306 } | 314 } |
| 307 | 315 |
| 308 } // namespace | 316 } // namespace |
| OLD | NEW |