| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/bidirectional_stream_spdy_impl.h" | 5 #include "net/spdy/bidirectional_stream_spdy_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "base/timer/mock_timer.h" | 15 #include "base/timer/mock_timer.h" |
| 16 #include "net/base/load_timing_info.h" | 16 #include "net/base/load_timing_info.h" |
| 17 #include "net/base/load_timing_info_test_util.h" | 17 #include "net/base/load_timing_info_test_util.h" |
| 18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 19 #include "net/http/http_request_info.h" | 19 #include "net/http/http_request_info.h" |
| 20 #include "net/http/http_response_headers.h" | 20 #include "net/http/http_response_headers.h" |
| 21 #include "net/http/http_response_info.h" | 21 #include "net/http/http_response_info.h" |
| 22 #include "net/log/net_log_source.h" | |
| 23 #include "net/log/test_net_log.h" | 22 #include "net/log/test_net_log.h" |
| 24 #include "net/socket/socket_test_util.h" | 23 #include "net/socket/socket_test_util.h" |
| 25 #include "net/spdy/spdy_session.h" | 24 #include "net/spdy/spdy_session.h" |
| 26 #include "net/spdy/spdy_test_util_common.h" | 25 #include "net/spdy/spdy_test_util_common.h" |
| 27 #include "net/test/cert_test_util.h" | 26 #include "net/test/cert_test_util.h" |
| 28 #include "net/test/gtest_util.h" | 27 #include "net/test/gtest_util.h" |
| 29 #include "net/test/test_data_directory.h" | 28 #include "net/test/test_data_directory.h" |
| 30 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 32 | 31 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 62 load_timing_info.connect_timing, | 61 load_timing_info.connect_timing, |
| 63 CONNECT_TIMING_HAS_SSL_TIMES | CONNECT_TIMING_HAS_DNS_TIMES); | 62 CONNECT_TIMING_HAS_SSL_TIMES | CONNECT_TIMING_HAS_DNS_TIMES); |
| 64 ExpectLoadTimingHasOnlyConnectionTimes(load_timing_info); | 63 ExpectLoadTimingHasOnlyConnectionTimes(load_timing_info); |
| 65 } | 64 } |
| 66 | 65 |
| 67 class TestDelegateBase : public BidirectionalStreamImpl::Delegate { | 66 class TestDelegateBase : public BidirectionalStreamImpl::Delegate { |
| 68 public: | 67 public: |
| 69 TestDelegateBase(base::WeakPtr<SpdySession> session, | 68 TestDelegateBase(base::WeakPtr<SpdySession> session, |
| 70 IOBuffer* read_buf, | 69 IOBuffer* read_buf, |
| 71 int read_buf_len) | 70 int read_buf_len) |
| 72 : stream_(new BidirectionalStreamSpdyImpl(session)), | 71 : stream_(new BidirectionalStreamSpdyImpl(session, NetLogSource())), |
| 73 read_buf_(read_buf), | 72 read_buf_(read_buf), |
| 74 read_buf_len_(read_buf_len), | 73 read_buf_len_(read_buf_len), |
| 75 loop_(nullptr), | 74 loop_(nullptr), |
| 76 error_(OK), | 75 error_(OK), |
| 77 bytes_read_(0), | 76 bytes_read_(0), |
| 78 on_data_read_count_(0), | 77 on_data_read_count_(0), |
| 79 on_data_sent_count_(0), | 78 on_data_sent_count_(0), |
| 80 do_not_start_read_(false), | 79 do_not_start_read_(false), |
| 81 run_until_completion_(false), | 80 run_until_completion_(false), |
| 82 not_expect_callback_(false), | 81 not_expect_callback_(false), |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } else { | 511 } else { |
| 513 delegate->SendData(write_buffer.get(), write_buffer->size(), true); | 512 delegate->SendData(write_buffer.get(), write_buffer->size(), true); |
| 514 } | 513 } |
| 515 base::RunLoop().RunUntilIdle(); | 514 base::RunLoop().RunUntilIdle(); |
| 516 EXPECT_THAT(delegate->error(), IsError(ERR_UNEXPECTED)); | 515 EXPECT_THAT(delegate->error(), IsError(ERR_UNEXPECTED)); |
| 517 EXPECT_TRUE(delegate->on_failed_called()); | 516 EXPECT_TRUE(delegate->on_failed_called()); |
| 518 EXPECT_EQ(is_test_sendv ? 2 : 4, delegate->on_data_sent_count()); | 517 EXPECT_EQ(is_test_sendv ? 2 : 4, delegate->on_data_sent_count()); |
| 519 } | 518 } |
| 520 | 519 |
| 521 } // namespace net | 520 } // namespace net |
| OLD | NEW |