| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_stream.h" | 5 #include "net/spdy/spdy_stream.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <limits> | 10 #include <limits> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 18 #include "base/strings/string_piece.h" | 18 #include "base/strings/string_piece.h" |
| 19 #include "net/base/completion_callback.h" | 19 #include "net/base/completion_callback.h" |
| 20 #include "net/base/request_priority.h" | 20 #include "net/base/request_priority.h" |
| 21 #include "net/log/net_log_event_type.h" |
| 21 #include "net/log/test_net_log.h" | 22 #include "net/log/test_net_log.h" |
| 22 #include "net/log/test_net_log_entry.h" | 23 #include "net/log/test_net_log_entry.h" |
| 23 #include "net/log/test_net_log_util.h" | 24 #include "net/log/test_net_log_util.h" |
| 24 #include "net/socket/socket_test_util.h" | 25 #include "net/socket/socket_test_util.h" |
| 25 #include "net/spdy/buffered_spdy_framer.h" | 26 #include "net/spdy/buffered_spdy_framer.h" |
| 26 #include "net/spdy/spdy_http_utils.h" | 27 #include "net/spdy/spdy_http_utils.h" |
| 27 #include "net/spdy/spdy_protocol.h" | 28 #include "net/spdy/spdy_protocol.h" |
| 28 #include "net/spdy/spdy_session.h" | 29 #include "net/spdy/spdy_session.h" |
| 29 #include "net/spdy/spdy_stream_test_util.h" | 30 #include "net/spdy/spdy_stream_test_util.h" |
| 30 #include "net/spdy/spdy_test_util_common.h" | 31 #include "net/spdy/spdy_test_util_common.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 delegate.TakeReceivedData()); | 390 delegate.TakeReceivedData()); |
| 390 EXPECT_TRUE(data.AllWriteDataConsumed()); | 391 EXPECT_TRUE(data.AllWriteDataConsumed()); |
| 391 | 392 |
| 392 // Check that the NetLog was filled reasonably. | 393 // Check that the NetLog was filled reasonably. |
| 393 TestNetLogEntry::List entries; | 394 TestNetLogEntry::List entries; |
| 394 log.GetEntries(&entries); | 395 log.GetEntries(&entries); |
| 395 EXPECT_LT(0u, entries.size()); | 396 EXPECT_LT(0u, entries.size()); |
| 396 | 397 |
| 397 // Check that we logged SPDY_STREAM_ERROR correctly. | 398 // Check that we logged SPDY_STREAM_ERROR correctly. |
| 398 int pos = ExpectLogContainsSomewhere( | 399 int pos = ExpectLogContainsSomewhere( |
| 399 entries, 0, NetLog::TYPE_HTTP2_STREAM_ERROR, NetLog::PHASE_NONE); | 400 entries, 0, NetLogEventType::HTTP2_STREAM_ERROR, NetLogEventPhase::NONE); |
| 400 | 401 |
| 401 int stream_id2; | 402 int stream_id2; |
| 402 ASSERT_TRUE(entries[pos].GetIntegerValue("stream_id", &stream_id2)); | 403 ASSERT_TRUE(entries[pos].GetIntegerValue("stream_id", &stream_id2)); |
| 403 EXPECT_EQ(static_cast<int>(stream_id), stream_id2); | 404 EXPECT_EQ(static_cast<int>(stream_id), stream_id2); |
| 404 } | 405 } |
| 405 | 406 |
| 406 // Make sure that large blocks of data are properly split up into | 407 // Make sure that large blocks of data are properly split up into |
| 407 // frame-sized chunks for a request/response (i.e., an HTTP-like) | 408 // frame-sized chunks for a request/response (i.e., an HTTP-like) |
| 408 // stream. | 409 // stream. |
| 409 TEST_F(SpdyStreamTest, SendLargeDataAfterOpenRequestResponse) { | 410 TEST_F(SpdyStreamTest, SendLargeDataAfterOpenRequestResponse) { |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 EXPECT_EQ(response_len, stream->raw_received_bytes()); | 1088 EXPECT_EQ(response_len, stream->raw_received_bytes()); |
| 1088 | 1089 |
| 1089 // FIN | 1090 // FIN |
| 1090 data.Resume(); | 1091 data.Resume(); |
| 1091 EXPECT_THAT(delegate.WaitForClose(), IsError(ERR_CONNECTION_CLOSED)); | 1092 EXPECT_THAT(delegate.WaitForClose(), IsError(ERR_CONNECTION_CLOSED)); |
| 1092 } | 1093 } |
| 1093 | 1094 |
| 1094 } // namespace test | 1095 } // namespace test |
| 1095 | 1096 |
| 1096 } // namespace net | 1097 } // namespace net |
| OLD | NEW |