| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 bool authorized_; | 65 bool authorized_; |
| 66 | 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(MockQuicClientSession); | 67 DISALLOW_COPY_AND_ASSIGN(MockQuicClientSession); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 class QuicClientPromisedInfoTest : public ::testing::Test { | 70 class QuicClientPromisedInfoTest : public ::testing::Test { |
| 71 public: | 71 public: |
| 72 class StreamVisitor; | 72 class StreamVisitor; |
| 73 | 73 |
| 74 QuicClientPromisedInfoTest() | 74 QuicClientPromisedInfoTest() |
| 75 : connection_(new StrictMock<MockConnection>(&helper_, | 75 : connection_(new StrictMock<MockQuicConnection>(&helper_, |
| 76 &alarm_factory_, | 76 &alarm_factory_, |
| 77 Perspective::IS_CLIENT)), | 77 Perspective::IS_CLIENT)), |
| 78 session_(connection_, &push_promise_index_), | 78 session_(connection_, &push_promise_index_), |
| 79 body_("hello world"), | 79 body_("hello world"), |
| 80 promise_id_(gfe_quic::test::kServerDataStreamId1) { | 80 promise_id_(gfe_quic::test::kServerDataStreamId1) { |
| 81 FLAGS_quic_supports_push_promise = true; | 81 FLAGS_quic_supports_push_promise = true; |
| 82 | 82 |
| 83 session_.Initialize(); | 83 session_.Initialize(); |
| 84 | 84 |
| 85 headers_.SetResponseFirstline("HTTP/1.1", 200, "Ok"); | 85 headers_.SetResponseFirstline("HTTP/1.1", 200, "Ok"); |
| 86 headers_.ReplaceOrAppendHeader("content-length", "11"); | 86 headers_.ReplaceOrAppendHeader("content-length", "11"); |
| 87 headers_string_ = SpdyBalsaUtils::SerializeResponseHeaders(headers_); | 87 headers_string_ = SpdyBalsaUtils::SerializeResponseHeaders(headers_); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 bool rendezvous_fired_; | 137 bool rendezvous_fired_; |
| 138 QuicSpdyClientStream* rendezvous_stream_; | 138 QuicSpdyClientStream* rendezvous_stream_; |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 void ReceivePromise(QuicStreamId id) { | 141 void ReceivePromise(QuicStreamId id) { |
| 142 stream_->OnStreamHeaders(serialized_push_promise_); | 142 stream_->OnStreamHeaders(serialized_push_promise_); |
| 143 | 143 |
| 144 stream_->OnPromiseHeadersComplete(id, serialized_push_promise_.size()); | 144 stream_->OnPromiseHeadersComplete(id, serialized_push_promise_.size()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 MockConnectionHelper helper_; | 147 MockQuicConnectionHelper helper_; |
| 148 MockAlarmFactory alarm_factory_; | 148 MockAlarmFactory alarm_factory_; |
| 149 StrictMock<MockConnection>* connection_; | 149 StrictMock<MockQuicConnection>* connection_; |
| 150 QuicClientPushPromiseIndex push_promise_index_; | 150 QuicClientPushPromiseIndex push_promise_index_; |
| 151 | 151 |
| 152 MockQuicClientSession session_; | 152 MockQuicClientSession session_; |
| 153 std::unique_ptr<QuicSpdyClientStream> stream_; | 153 std::unique_ptr<QuicSpdyClientStream> stream_; |
| 154 std::unique_ptr<StreamVisitor> stream_visitor_; | 154 std::unique_ptr<StreamVisitor> stream_visitor_; |
| 155 std::unique_ptr<QuicSpdyClientStream> promised_stream_; | 155 std::unique_ptr<QuicSpdyClientStream> promised_stream_; |
| 156 BalsaHeaders headers_; | 156 BalsaHeaders headers_; |
| 157 string headers_string_; | 157 string headers_string_; |
| 158 string body_; | 158 string body_; |
| 159 SpdyHeaderBlock push_promise_; | 159 SpdyHeaderBlock push_promise_; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 EXPECT_FALSE(delegate.rendezvous_fired()); | 371 EXPECT_FALSE(delegate.rendezvous_fired()); |
| 372 EXPECT_EQ(delegate.rendezvous_stream(), nullptr); | 372 EXPECT_EQ(delegate.rendezvous_stream(), nullptr); |
| 373 | 373 |
| 374 // Promise is gone | 374 // Promise is gone |
| 375 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); | 375 EXPECT_EQ(session_.GetPromisedById(promise_id_), nullptr); |
| 376 } | 376 } |
| 377 | 377 |
| 378 } // namespace | 378 } // namespace |
| 379 } // namespace test | 379 } // namespace test |
| 380 } // namespace net | 380 } // namespace net |
| OLD | NEW |