| 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/quic/core/quic_client_promised_info.h" | 5 #include "net/quic/core/quic_client_promised_info.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "net/quic/core/spdy_utils.h" | 10 #include "net/quic/core/spdy_utils.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 TEST_F(QuicClientPromisedInfoTest, PushPromiseCleanupAlarm) { | 119 TEST_F(QuicClientPromisedInfoTest, PushPromiseCleanupAlarm) { |
| 120 ReceivePromise(promise_id_); | 120 ReceivePromise(promise_id_); |
| 121 | 121 |
| 122 // Verify that the promise is in the unclaimed streams map. | 122 // Verify that the promise is in the unclaimed streams map. |
| 123 QuicClientPromisedInfo* promised = session_.GetPromisedById(promise_id_); | 123 QuicClientPromisedInfo* promised = session_.GetPromisedById(promise_id_); |
| 124 ASSERT_NE(promised, nullptr); | 124 ASSERT_NE(promised, nullptr); |
| 125 | 125 |
| 126 // Fire the alarm that will cancel the promised stream. | 126 // Fire the alarm that will cancel the promised stream. |
| 127 if (FLAGS_quic_send_push_stream_timed_out_error) { | 127 EXPECT_CALL(*connection_, |
| 128 EXPECT_CALL(*connection_, | 128 SendRstStream(promise_id_, QUIC_PUSH_STREAM_TIMED_OUT, 0)); |
| 129 SendRstStream(promise_id_, QUIC_PUSH_STREAM_TIMED_OUT, 0)); | |
| 130 } else { | |
| 131 EXPECT_CALL(*connection_, | |
| 132 SendRstStream(promise_id_, QUIC_STREAM_CANCELLED, 0)); | |
| 133 } | |
| 134 alarm_factory_.FireAlarm(QuicClientPromisedInfoPeer::GetAlarm(promised)); | 129 alarm_factory_.FireAlarm(QuicClientPromisedInfoPeer::GetAlarm(promised)); |
| 135 | 130 |
| 136 // Verify that the promise is gone after the alarm fires. | 131 // Verify that the promise is gone after the alarm fires. |
| 137 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); | 132 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); |
| 138 EXPECT_EQ(session_.GetPromisedByUrl(promise_url_), nullptr); | 133 EXPECT_EQ(session_.GetPromisedByUrl(promise_url_), nullptr); |
| 139 } | 134 } |
| 140 | 135 |
| 141 TEST_F(QuicClientPromisedInfoTest, PushPromiseInvalidMethod) { | 136 TEST_F(QuicClientPromisedInfoTest, PushPromiseInvalidMethod) { |
| 142 // Promise with an unsafe method | 137 // Promise with an unsafe method |
| 143 push_promise_[":method"] = "PUT"; | 138 push_promise_[":method"] = "PUT"; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 EXPECT_FALSE(delegate.rendezvous_fired()); | 303 EXPECT_FALSE(delegate.rendezvous_fired()); |
| 309 EXPECT_EQ(delegate.rendezvous_stream(), nullptr); | 304 EXPECT_EQ(delegate.rendezvous_stream(), nullptr); |
| 310 | 305 |
| 311 // Promise is gone | 306 // Promise is gone |
| 312 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); | 307 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); |
| 313 } | 308 } |
| 314 | 309 |
| 315 } // namespace | 310 } // namespace |
| 316 } // namespace test | 311 } // namespace test |
| 317 } // namespace net | 312 } // namespace net |
| OLD | NEW |