| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 | 161 |
| 162 TEST_F(QuicClientPromisedInfoTest, PushPromiseCleanupAlarm) { | 162 TEST_F(QuicClientPromisedInfoTest, PushPromiseCleanupAlarm) { |
| 163 ReceivePromise(promise_id_); | 163 ReceivePromise(promise_id_); |
| 164 | 164 |
| 165 // Verify that the promise is in the unclaimed streams map. | 165 // Verify that the promise is in the unclaimed streams map. |
| 166 QuicClientPromisedInfo* promised = session_.GetPromisedById(promise_id_); | 166 QuicClientPromisedInfo* promised = session_.GetPromisedById(promise_id_); |
| 167 ASSERT_NE(promised, nullptr); | 167 ASSERT_NE(promised, nullptr); |
| 168 | 168 |
| 169 // Fire the alarm that will cancel the promised stream. | 169 // Fire the alarm that will cancel the promised stream. |
| 170 EXPECT_CALL(*connection_, | 170 if (FLAGS_quic_send_push_stream_timed_out_error) { |
| 171 SendRstStream(promise_id_, QUIC_STREAM_CANCELLED, 0)); | 171 EXPECT_CALL(*connection_, |
| 172 SendRstStream(promise_id_, QUIC_PUSH_STREAM_TIMED_OUT, 0)); |
| 173 } else { |
| 174 EXPECT_CALL(*connection_, |
| 175 SendRstStream(promise_id_, QUIC_STREAM_CANCELLED, 0)); |
| 176 } |
| 172 alarm_factory_.FireAlarm(QuicClientPromisedInfoPeer::GetAlarm(promised)); | 177 alarm_factory_.FireAlarm(QuicClientPromisedInfoPeer::GetAlarm(promised)); |
| 173 | 178 |
| 174 // Verify that the promise is gone after the alarm fires. | 179 // Verify that the promise is gone after the alarm fires. |
| 175 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); | 180 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); |
| 176 EXPECT_EQ(session_.GetPromisedByUrl(promise_url_), nullptr); | 181 EXPECT_EQ(session_.GetPromisedByUrl(promise_url_), nullptr); |
| 177 } | 182 } |
| 178 | 183 |
| 179 TEST_F(QuicClientPromisedInfoTest, PushPromiseInvalidMethod) { | 184 TEST_F(QuicClientPromisedInfoTest, PushPromiseInvalidMethod) { |
| 180 // Promise with an unsafe method | 185 // Promise with an unsafe method |
| 181 push_promise_[":method"] = "PUT"; | 186 push_promise_[":method"] = "PUT"; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 EXPECT_FALSE(delegate.rendezvous_fired()); | 349 EXPECT_FALSE(delegate.rendezvous_fired()); |
| 345 EXPECT_EQ(delegate.rendezvous_stream(), nullptr); | 350 EXPECT_EQ(delegate.rendezvous_stream(), nullptr); |
| 346 | 351 |
| 347 // Promise is gone | 352 // Promise is gone |
| 348 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); | 353 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); |
| 349 } | 354 } |
| 350 | 355 |
| 351 } // namespace | 356 } // namespace |
| 352 } // namespace test | 357 } // namespace test |
| 353 } // namespace net | 358 } // namespace net |
| OLD | NEW |