| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 231 } |
| 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 #if !defined(WIN32) and GTEST_HAS_DEATH_TEST |
| 242 #if !defined(DCHECK_ALWAYS_ON) | 242 #if !defined(DCHECK_ALWAYS_ON) |
| 243 EXPECT_DEBUG_DEATH(frame.set_stream_id(~0), ""); | 243 EXPECT_DEBUG_DEATH(frame.set_stream_id(~0), ""); |
| 244 #else | 244 #else |
| 245 EXPECT_DEATH(frame.set_stream_id(~0), ""); | 245 EXPECT_DEATH(frame.set_stream_id(~0), ""); |
| 246 #endif | 246 #endif |
| 247 #endif | 247 #endif |
| 248 EXPECT_FALSE(frame.is_control_frame()); | 248 EXPECT_FALSE(frame.is_control_frame()); |
| 249 | 249 |
| 250 frame.set_flags(0); | 250 frame.set_flags(0); |
| 251 #ifndef WIN32 | 251 #if !defined(WIN32) and GTEST_HAS_DEATH_TEST |
| 252 #if !defined(DCHECK_ALWAYS_ON) | 252 #if !defined(DCHECK_ALWAYS_ON) |
| 253 EXPECT_DEBUG_DEATH(frame.set_length(~0), ""); | 253 EXPECT_DEBUG_DEATH(frame.set_length(~0), ""); |
| 254 #else | 254 #else |
| 255 EXPECT_DEATH(frame.set_length(~0), ""); | 255 EXPECT_DEATH(frame.set_length(~0), ""); |
| 256 #endif | 256 #endif |
| 257 #endif | 257 #endif |
| 258 EXPECT_EQ(0, frame.flags()); | 258 EXPECT_EQ(0, frame.flags()); |
| 259 } | 259 } |
| 260 | 260 |
| 261 TEST(SpdyProtocolDeathTest, TestSpdyControlFrameStreamId) { | 261 TEST(SpdyProtocolDeathTest, TestSpdyControlFrameStreamId) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 frame.set_type(static_cast<SpdyControlType>(i)); | 307 frame.set_type(static_cast<SpdyControlType>(i)); |
| 308 EXPECT_EQ(i, static_cast<int>(frame.type())); | 308 EXPECT_EQ(i, static_cast<int>(frame.type())); |
| 309 EXPECT_TRUE(frame.AppearsToBeAValidControlFrame()); | 309 EXPECT_TRUE(frame.AppearsToBeAValidControlFrame()); |
| 310 // Make sure setting type does not alter the version block. | 310 // Make sure setting type does not alter the version block. |
| 311 EXPECT_EQ(version, frame.version()); | 311 EXPECT_EQ(version, frame.version()); |
| 312 EXPECT_TRUE(frame.is_control_frame()); | 312 EXPECT_TRUE(frame.is_control_frame()); |
| 313 } | 313 } |
| 314 } | 314 } |
| 315 | 315 |
| 316 } // namespace | 316 } // namespace |
| OLD | NEW |