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 "net/quic/chromium/quic_chromium_client_session.h" | 5 #include "net/quic/chromium/quic_chromium_client_session.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "net/quic/test_tools/quic_client_promised_info_peer.h" | 37 #include "net/quic/test_tools/quic_client_promised_info_peer.h" |
38 #include "net/quic/test_tools/quic_spdy_session_peer.h" | 38 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
39 #include "net/quic/test_tools/quic_test_packet_maker.h" | 39 #include "net/quic/test_tools/quic_test_packet_maker.h" |
40 #include "net/quic/test_tools/quic_test_utils.h" | 40 #include "net/quic/test_tools/quic_test_utils.h" |
41 #include "net/quic/test_tools/simple_quic_framer.h" | 41 #include "net/quic/test_tools/simple_quic_framer.h" |
42 #include "net/socket/socket_test_util.h" | 42 #include "net/socket/socket_test_util.h" |
43 #include "net/spdy/spdy_test_utils.h" | 43 #include "net/spdy/spdy_test_utils.h" |
44 #include "net/test/cert_test_util.h" | 44 #include "net/test/cert_test_util.h" |
45 #include "net/test/gtest_util.h" | 45 #include "net/test/gtest_util.h" |
46 #include "net/test/test_data_directory.h" | 46 #include "net/test/test_data_directory.h" |
47 #include "net/tools/quic/test_tools/push_promise_delegate.h" | |
48 #include "net/udp/datagram_client_socket.h" | 47 #include "net/udp/datagram_client_socket.h" |
49 #include "testing/gmock/include/gmock/gmock.h" | 48 #include "testing/gmock/include/gmock/gmock.h" |
50 | 49 |
51 using testing::_; | 50 using testing::_; |
52 | 51 |
53 namespace net { | 52 namespace net { |
54 namespace test { | 53 namespace test { |
55 namespace { | 54 namespace { |
56 | 55 |
57 const IPEndPoint kIpEndPoint = IPEndPoint(IPAddress::IPv4AllZeros(), 0); | 56 const IPEndPoint kIpEndPoint = IPEndPoint(IPAddress::IPv4AllZeros(), 0); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 // Receive a PUSH PROMISE from the server. | 347 // Receive a PUSH PROMISE from the server. |
349 EXPECT_TRUE(session_->HandlePromised(stream->id(), kServerDataStreamId1, | 348 EXPECT_TRUE(session_->HandlePromised(stream->id(), kServerDataStreamId1, |
350 promise_headers)); | 349 promise_headers)); |
351 | 350 |
352 QuicClientPromisedInfo* promised = | 351 QuicClientPromisedInfo* promised = |
353 session_->GetPromisedById(kServerDataStreamId1); | 352 session_->GetPromisedById(kServerDataStreamId1); |
354 EXPECT_TRUE(promised); | 353 EXPECT_TRUE(promised); |
355 | 354 |
356 // Initiate rendezvous. | 355 // Initiate rendezvous. |
357 SpdyHeaderBlock client_request = promise_headers.Clone(); | 356 SpdyHeaderBlock client_request = promise_headers.Clone(); |
358 PushPromiseDelegate delegate(/*match=*/true); | 357 TestPushPromiseDelegate delegate(/*match=*/true); |
359 promised->HandleClientRequest(client_request, &delegate); | 358 promised->HandleClientRequest(client_request, &delegate); |
360 | 359 |
361 // Cancel the push before receiving the response to the pushed request. | 360 // Cancel the push before receiving the response to the pushed request. |
362 GURL pushed_url("https://www.example.org/pushed.jpg"); | 361 GURL pushed_url("https://www.example.org/pushed.jpg"); |
363 test_push_delegate_.CancelPush(pushed_url); | 362 test_push_delegate_.CancelPush(pushed_url); |
364 EXPECT_TRUE(session_->GetPromisedByUrl(pushed_url.spec())); | 363 EXPECT_TRUE(session_->GetPromisedByUrl(pushed_url.spec())); |
365 | 364 |
366 // Reset the stream now before tear down. | 365 // Reset the stream now before tear down. |
367 session_->CloseStream(kClientDataStreamId1); | 366 session_->CloseStream(kClientDataStreamId1); |
368 } | 367 } |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 | 810 |
812 EXPECT_TRUE(socket_data_->AllReadDataConsumed()); | 811 EXPECT_TRUE(socket_data_->AllReadDataConsumed()); |
813 EXPECT_TRUE(socket_data_->AllWriteDataConsumed()); | 812 EXPECT_TRUE(socket_data_->AllWriteDataConsumed()); |
814 EXPECT_TRUE(new_socket_data.AllReadDataConsumed()); | 813 EXPECT_TRUE(new_socket_data.AllReadDataConsumed()); |
815 EXPECT_TRUE(new_socket_data.AllWriteDataConsumed()); | 814 EXPECT_TRUE(new_socket_data.AllWriteDataConsumed()); |
816 } | 815 } |
817 | 816 |
818 } // namespace | 817 } // namespace |
819 } // namespace test | 818 } // namespace test |
820 } // namespace net | 819 } // namespace net |
OLD | NEW |