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

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

Issue 2862563003: Landing Recent QUIC changes until Sat Apr 29 00:22:04 2017 +0000 (Closed)
Patch Set: rebase and fix test bugs detected by swarm bot. Created 3 years, 7 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
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/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"
11 #include "net/quic/platform/api/quic_logging.h" 11 #include "net/quic/platform/api/quic_logging.h"
12 #include "net/quic/platform/api/quic_socket_address.h" 12 #include "net/quic/platform/api/quic_socket_address.h"
13 #include "net/quic/platform/api/quic_test.h" 13 #include "net/quic/platform/api/quic_test.h"
14 #include "net/quic/test_tools/crypto_test_utils.h" 14 #include "net/quic/test_tools/crypto_test_utils.h"
15 #include "net/quic/test_tools/quic_client_promised_info_peer.h" 15 #include "net/quic/test_tools/quic_client_promised_info_peer.h"
16 #include "net/quic/test_tools/quic_spdy_session_peer.h"
16 #include "net/test/gtest_util.h" 17 #include "net/test/gtest_util.h"
17 #include "net/tools/quic/quic_client_session.h" 18 #include "net/tools/quic/quic_client_session.h"
18 19
19 using std::string; 20 using std::string;
20 using testing::StrictMock; 21 using testing::StrictMock;
21 22
22 namespace net { 23 namespace net {
23 namespace test { 24 namespace test {
24 namespace { 25 namespace {
25 26
(...skipping 28 matching lines...) Expand all
54 class QuicClientPromisedInfoTest : public QuicTest { 55 class QuicClientPromisedInfoTest : public QuicTest {
55 public: 56 public:
56 class StreamVisitor; 57 class StreamVisitor;
57 58
58 QuicClientPromisedInfoTest() 59 QuicClientPromisedInfoTest()
59 : connection_(new StrictMock<MockQuicConnection>(&helper_, 60 : connection_(new StrictMock<MockQuicConnection>(&helper_,
60 &alarm_factory_, 61 &alarm_factory_,
61 Perspective::IS_CLIENT)), 62 Perspective::IS_CLIENT)),
62 session_(connection_, &push_promise_index_), 63 session_(connection_, &push_promise_index_),
63 body_("hello world"), 64 body_("hello world"),
64 promise_id_(kServerDataStreamId1) { 65 promise_id_(kInvalidStreamId) {
65 session_.Initialize(); 66 session_.Initialize();
66 67
67 headers_[":status"] = "200"; 68 headers_[":status"] = "200";
68 headers_["content-length"] = "11"; 69 headers_["content-length"] = "11";
69 70
70 stream_.reset(new QuicSpdyClientStream(kClientDataStreamId1, &session_)); 71 stream_.reset(new QuicSpdyClientStream(
72 QuicSpdySessionPeer::GetNthClientInitiatedStreamId(session_, 0),
73 &session_));
71 stream_visitor_.reset(new StreamVisitor()); 74 stream_visitor_.reset(new StreamVisitor());
72 stream_->set_visitor(stream_visitor_.get()); 75 stream_->set_visitor(stream_visitor_.get());
73 76
74 push_promise_[":path"] = "/bar"; 77 push_promise_[":path"] = "/bar";
75 push_promise_[":authority"] = "www.google.com"; 78 push_promise_[":authority"] = "www.google.com";
76 push_promise_[":version"] = "HTTP/1.1"; 79 push_promise_[":version"] = "HTTP/1.1";
77 push_promise_[":method"] = "GET"; 80 push_promise_[":method"] = "GET";
78 push_promise_[":scheme"] = "https"; 81 push_promise_[":scheme"] = "https";
79 82
80 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_); 83 promise_url_ = SpdyUtils::GetUrlFromHeaderBlock(push_promise_);
81 84
82 client_request_ = push_promise_.Clone(); 85 client_request_ = push_promise_.Clone();
86 promise_id_ =
87 QuicSpdySessionPeer::GetNthServerInitiatedStreamId(session_, 0);
83 } 88 }
84 89
85 class StreamVisitor : public QuicSpdyClientStream::Visitor { 90 class StreamVisitor : public QuicSpdyClientStream::Visitor {
86 void OnClose(QuicSpdyStream* stream) override { 91 void OnClose(QuicSpdyStream* stream) override {
87 QUIC_DVLOG(1) << "stream " << stream->id(); 92 QUIC_DVLOG(1) << "stream " << stream->id();
88 } 93 }
89 }; 94 };
90 95
91 void ReceivePromise(QuicStreamId id) { 96 void ReceivePromise(QuicStreamId id) {
92 auto headers = AsHeaderList(push_promise_); 97 auto headers = AsHeaderList(push_promise_);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 EXPECT_FALSE(delegate.rendezvous_fired()); 310 EXPECT_FALSE(delegate.rendezvous_fired());
306 EXPECT_EQ(delegate.rendezvous_stream(), nullptr); 311 EXPECT_EQ(delegate.rendezvous_stream(), nullptr);
307 312
308 // Promise is gone 313 // Promise is gone
309 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); 314 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr);
310 } 315 }
311 316
312 } // namespace 317 } // namespace
313 } // namespace test 318 } // namespace test
314 } // namespace net 319 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/frames/quic_window_update_frame.h ('k') | net/quic/core/quic_client_push_promise_index_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698