| 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 <cmath> | 5 #include <cmath> |
| 6 #include <memory> | 6 #include <memory> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 3221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3232 SpdySerializedFrame req( | 3232 SpdySerializedFrame req( |
| 3233 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 3233 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 3234 SpdySerializedFrame goaway(spdy_util_.ConstructSpdyGoAway( | 3234 SpdySerializedFrame goaway(spdy_util_.ConstructSpdyGoAway( |
| 3235 0, GOAWAY_COMPRESSION_ERROR, "Framer error: 6 (DECOMPRESS_FAILURE).")); | 3235 0, GOAWAY_COMPRESSION_ERROR, "Framer error: 6 (DECOMPRESS_FAILURE).")); |
| 3236 MockWrite writes[] = {CreateMockWrite(req, 0), CreateMockWrite(goaway, 2)}; | 3236 MockWrite writes[] = {CreateMockWrite(req, 0), CreateMockWrite(goaway, 2)}; |
| 3237 | 3237 |
| 3238 // This is the length field that's too short. | 3238 // This is the length field that's too short. |
| 3239 SpdySerializedFrame reply_wrong_length( | 3239 SpdySerializedFrame reply_wrong_length( |
| 3240 spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1)); | 3240 spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1)); |
| 3241 size_t right_size = | 3241 size_t right_size = |
| 3242 reply_wrong_length.size() - SpdyConstants::GetFrameHeaderSize(HTTP2); | 3242 reply_wrong_length.size() - SpdyConstants::kFrameHeaderSize; |
| 3243 size_t wrong_size = right_size - 4; | 3243 size_t wrong_size = right_size - 4; |
| 3244 test::SetFrameLength(&reply_wrong_length, wrong_size, HTTP2); | 3244 test::SetFrameLength(&reply_wrong_length, wrong_size); |
| 3245 | 3245 |
| 3246 MockRead reads[] = { | 3246 MockRead reads[] = { |
| 3247 MockRead(ASYNC, reply_wrong_length.data(), reply_wrong_length.size() - 4, | 3247 MockRead(ASYNC, reply_wrong_length.data(), reply_wrong_length.size() - 4, |
| 3248 1), | 3248 1), |
| 3249 }; | 3249 }; |
| 3250 | 3250 |
| 3251 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 3251 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 3252 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 3252 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 3253 NetLogWithSource(), NULL); | 3253 NetLogWithSource(), NULL); |
| 3254 helper.RunToCompletion(&data); | 3254 helper.RunToCompletion(&data); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3280 SpdySerializedFrame req( | 3280 SpdySerializedFrame req( |
| 3281 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 3281 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 3282 SpdySerializedFrame goaway(spdy_util_.ConstructSpdyGoAway( | 3282 SpdySerializedFrame goaway(spdy_util_.ConstructSpdyGoAway( |
| 3283 0, GOAWAY_FRAME_SIZE_ERROR, | 3283 0, GOAWAY_FRAME_SIZE_ERROR, |
| 3284 "Framer error: 15 (INVALID_CONTROL_FRAME_SIZE).")); | 3284 "Framer error: 15 (INVALID_CONTROL_FRAME_SIZE).")); |
| 3285 MockWrite writes[] = {CreateMockWrite(req, 0), CreateMockWrite(goaway, 2)}; | 3285 MockWrite writes[] = {CreateMockWrite(req, 0), CreateMockWrite(goaway, 2)}; |
| 3286 | 3286 |
| 3287 // Read WINDOW_UPDATE with incorrectly-sized payload. | 3287 // Read WINDOW_UPDATE with incorrectly-sized payload. |
| 3288 SpdySerializedFrame bad_window_update( | 3288 SpdySerializedFrame bad_window_update( |
| 3289 spdy_util_.ConstructSpdyWindowUpdate(1, 1)); | 3289 spdy_util_.ConstructSpdyWindowUpdate(1, 1)); |
| 3290 test::SetFrameLength(&bad_window_update, bad_window_update.size() - 1, HTTP2); | 3290 test::SetFrameLength(&bad_window_update, bad_window_update.size() - 1); |
| 3291 MockRead reads[] = {CreateMockRead(bad_window_update, 1)}; | 3291 MockRead reads[] = {CreateMockRead(bad_window_update, 1)}; |
| 3292 | 3292 |
| 3293 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 3293 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 3294 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 3294 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 3295 NetLogWithSource(), NULL); | 3295 NetLogWithSource(), NULL); |
| 3296 helper.RunToCompletion(&data); | 3296 helper.RunToCompletion(&data); |
| 3297 TransactionHelperResult out = helper.output(); | 3297 TransactionHelperResult out = helper.output(); |
| 3298 EXPECT_THAT(out.rv, IsError(ERR_SPDY_FRAME_SIZE_ERROR)); | 3298 EXPECT_THAT(out.rv, IsError(ERR_SPDY_FRAME_SIZE_ERROR)); |
| 3299 } | 3299 } |
| 3300 | 3300 |
| (...skipping 2894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6195 TEST_F(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6195 TEST_F(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
| 6196 std::unique_ptr<SSLSocketDataProvider> ssl_provider( | 6196 std::unique_ptr<SSLSocketDataProvider> ssl_provider( |
| 6197 new SSLSocketDataProvider(ASYNC, OK)); | 6197 new SSLSocketDataProvider(ASYNC, OK)); |
| 6198 // Set to TLS_RSA_WITH_NULL_MD5 | 6198 // Set to TLS_RSA_WITH_NULL_MD5 |
| 6199 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6199 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
| 6200 | 6200 |
| 6201 RunTLSUsageCheckTest(std::move(ssl_provider)); | 6201 RunTLSUsageCheckTest(std::move(ssl_provider)); |
| 6202 } | 6202 } |
| 6203 | 6203 |
| 6204 } // namespace net | 6204 } // namespace net |
| OLD | NEW |