Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: net/quic/quic_client_promised_info_test.cc

Issue 1692253004: QUIC - chromium server push support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review feedback round 2. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_chromium_client_session.cc ('k') | net/quic/quic_client_push_promise_index.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 EXPECT_CALL(*connection_, 207 EXPECT_CALL(*connection_,
208 SendRstStream(promise_id_, QUIC_INVALID_PROMISE_URL, 0)); 208 SendRstStream(promise_id_, QUIC_INVALID_PROMISE_URL, 0));
209 ReceivePromise(promise_id_); 209 ReceivePromise(promise_id_);
210 210
211 // Verify that the promise headers were ignored 211 // Verify that the promise headers were ignored
212 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); 212 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr);
213 EXPECT_EQ(session_.GetPromisedByUrl(promise_url_), nullptr); 213 EXPECT_EQ(session_.GetPromisedByUrl(promise_url_), nullptr);
214 } 214 }
215 215
216 TEST_F(QuicClientPromisedInfoTest, PushPromiseInvalidUrl) {
217 // Promise with an unsafe method
218 push_promise_[":method"] = "PUT";
219 serialized_push_promise_ =
220 SpdyUtils::SerializeUncompressedHeaders(push_promise_);
221
222 EXPECT_CALL(*connection_,
223 SendRstStream(promise_id_, QUIC_INVALID_PROMISE_METHOD, 0));
224 ReceivePromise(promise_id_);
225
226 // Verify that the promise headers were ignored
227 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr);
228 EXPECT_EQ(session_.GetPromisedByUrl(promise_url_), nullptr);
229 }
230
216 TEST_F(QuicClientPromisedInfoTest, PushPromiseUnauthorizedUrl) { 231 TEST_F(QuicClientPromisedInfoTest, PushPromiseUnauthorizedUrl) {
217 session_.set_authorized(false); 232 session_.set_authorized(false);
218 233
219 EXPECT_CALL(*connection_, 234 EXPECT_CALL(*connection_,
220 SendRstStream(promise_id_, QUIC_UNAUTHORIZED_PROMISE_URL, 0)); 235 SendRstStream(promise_id_, QUIC_UNAUTHORIZED_PROMISE_URL, 0));
221 236
222 ReceivePromise(promise_id_); 237 ReceivePromise(promise_id_);
223 238
224 QuicClientPromisedInfo* promised = session_.GetPromisedById(promise_id_); 239 QuicClientPromisedInfo* promised = session_.GetPromisedById(promise_id_);
225 ASSERT_EQ(promised, nullptr); 240 ASSERT_EQ(promised, nullptr);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 EXPECT_FALSE(delegate.rendezvous_fired()); 367 EXPECT_FALSE(delegate.rendezvous_fired());
353 EXPECT_EQ(delegate.rendezvous_stream(), nullptr); 368 EXPECT_EQ(delegate.rendezvous_stream(), nullptr);
354 369
355 // Promise is gone 370 // Promise is gone
356 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); 371 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr);
357 } 372 }
358 373
359 } // namespace 374 } // namespace
360 } // namespace test 375 } // namespace test
361 } // namespace net 376 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_chromium_client_session.cc ('k') | net/quic/quic_client_push_promise_index.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698