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/quic_client_promised_info.h" | 5 #include "net/quic/quic_client_promised_info.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "net/gfe2/balsa_headers.h" | 9 #include "net/gfe2/balsa_headers.h" |
10 #include "net/quic/quic_client.h" | 10 #include "net/quic/quic_client.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 EXPECT_CALL(*connection_, | 192 EXPECT_CALL(*connection_, |
193 SendRstStream(promise_id_, QUIC_INVALID_PROMISE_URL, 0)); | 193 SendRstStream(promise_id_, QUIC_INVALID_PROMISE_URL, 0)); |
194 ReceivePromise(promise_id_); | 194 ReceivePromise(promise_id_); |
195 | 195 |
196 // Verify that the promise headers were ignored | 196 // Verify that the promise headers were ignored |
197 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); | 197 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); |
198 EXPECT_EQ(session_.GetPromisedByUrl(promise_url_), nullptr); | 198 EXPECT_EQ(session_.GetPromisedByUrl(promise_url_), nullptr); |
199 } | 199 } |
200 | 200 |
| 201 TEST_F(QuicClientPromisedInfoTest, PushPromiseInvalidUrl) { |
| 202 // Promise with an unsafe method |
| 203 push_promise_[":method"] = "PUT"; |
| 204 serialized_push_promise_ = |
| 205 SpdyUtils::SerializeUncompressedHeaders(push_promise_); |
| 206 |
| 207 EXPECT_CALL(*connection_, |
| 208 SendRstStream(promise_id_, QUIC_INVALID_PROMISE_METHOD, 0)); |
| 209 ReceivePromise(promise_id_); |
| 210 |
| 211 // Verify that the promise headers were ignored |
| 212 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); |
| 213 EXPECT_EQ(session_.GetPromisedByUrl(promise_url_), nullptr); |
| 214 } |
| 215 |
201 TEST_F(QuicClientPromisedInfoTest, PushPromiseUnauthorizedUrl) { | 216 TEST_F(QuicClientPromisedInfoTest, PushPromiseUnauthorizedUrl) { |
202 session_.set_authorized(false); | 217 session_.set_authorized(false); |
203 | 218 |
204 EXPECT_CALL(*connection_, | 219 EXPECT_CALL(*connection_, |
205 SendRstStream(promise_id_, QUIC_UNAUTHORIZED_PROMISE_URL, 0)); | 220 SendRstStream(promise_id_, QUIC_UNAUTHORIZED_PROMISE_URL, 0)); |
206 | 221 |
207 ReceivePromise(promise_id_); | 222 ReceivePromise(promise_id_); |
208 | 223 |
209 QuicClientPromisedInfo* promised = session_.GetPromisedById(promise_id_); | 224 QuicClientPromisedInfo* promised = session_.GetPromisedById(promise_id_); |
210 ASSERT_EQ(promised, nullptr); | 225 ASSERT_EQ(promised, nullptr); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 EXPECT_FALSE(delegate.rendezvous_fired()); | 352 EXPECT_FALSE(delegate.rendezvous_fired()); |
338 EXPECT_EQ(delegate.rendezvous_stream(), nullptr); | 353 EXPECT_EQ(delegate.rendezvous_stream(), nullptr); |
339 | 354 |
340 // Promise is gone | 355 // Promise is gone |
341 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); | 356 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); |
342 } | 357 } |
343 | 358 |
344 } // namespace | 359 } // namespace |
345 } // namespace test | 360 } // namespace test |
346 } // namespace net | 361 } // namespace net |
OLD | NEW |