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_push_promise_index.h" | 5 #include "net/quic/core/quic_client_push_promise_index.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "net/quic/core/spdy_utils.h" | 9 #include "net/quic/core/spdy_utils.h" |
10 #include "net/quic/platform/api/quic_test.h" | 10 #include "net/quic/platform/api/quic_test.h" |
11 #include "net/quic/test_tools/crypto_test_utils.h" | 11 #include "net/quic/test_tools/crypto_test_utils.h" |
12 #include "net/quic/test_tools/mock_quic_client_promised_info.h" | 12 #include "net/quic/test_tools/mock_quic_client_promised_info.h" |
| 13 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
13 #include "net/quic/test_tools/quic_test_utils.h" | 14 #include "net/quic/test_tools/quic_test_utils.h" |
14 #include "net/tools/quic/quic_client_session.h" | 15 #include "net/tools/quic/quic_client_session.h" |
15 | 16 |
16 using testing::_; | 17 using testing::_; |
17 using testing::Return; | 18 using testing::Return; |
18 using testing::StrictMock; | 19 using testing::StrictMock; |
19 using std::string; | 20 using std::string; |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 namespace test { | 23 namespace test { |
(...skipping 20 matching lines...) Expand all Loading... |
43 DISALLOW_COPY_AND_ASSIGN(MockQuicClientSession); | 44 DISALLOW_COPY_AND_ASSIGN(MockQuicClientSession); |
44 }; | 45 }; |
45 | 46 |
46 class QuicClientPushPromiseIndexTest : public QuicTest { | 47 class QuicClientPushPromiseIndexTest : public QuicTest { |
47 public: | 48 public: |
48 QuicClientPushPromiseIndexTest() | 49 QuicClientPushPromiseIndexTest() |
49 : connection_(new StrictMock<MockQuicConnection>(&helper_, | 50 : connection_(new StrictMock<MockQuicConnection>(&helper_, |
50 &alarm_factory_, | 51 &alarm_factory_, |
51 Perspective::IS_CLIENT)), | 52 Perspective::IS_CLIENT)), |
52 session_(connection_, &index_), | 53 session_(connection_, &index_), |
53 promised_(&session_, kServerDataStreamId1, url_) { | 54 promised_( |
| 55 &session_, |
| 56 QuicSpdySessionPeer::GetNthServerInitiatedStreamId(session_, 0), |
| 57 url_) { |
54 request_[":path"] = "/bar"; | 58 request_[":path"] = "/bar"; |
55 request_[":authority"] = "www.google.com"; | 59 request_[":authority"] = "www.google.com"; |
56 request_[":version"] = "HTTP/1.1"; | 60 request_[":version"] = "HTTP/1.1"; |
57 request_[":method"] = "GET"; | 61 request_[":method"] = "GET"; |
58 request_[":scheme"] = "https"; | 62 request_[":scheme"] = "https"; |
59 url_ = SpdyUtils::GetUrlFromHeaderBlock(request_); | 63 url_ = SpdyUtils::GetUrlFromHeaderBlock(request_); |
60 } | 64 } |
61 | 65 |
62 MockQuicConnectionHelper helper_; | 66 MockQuicConnectionHelper helper_; |
63 MockAlarmFactory alarm_factory_; | 67 MockAlarmFactory alarm_factory_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 104 } |
101 | 105 |
102 TEST_F(QuicClientPushPromiseIndexTest, GetPromise) { | 106 TEST_F(QuicClientPushPromiseIndexTest, GetPromise) { |
103 (*index_.promised_by_url())[url_] = &promised_; | 107 (*index_.promised_by_url())[url_] = &promised_; |
104 EXPECT_EQ(index_.GetPromised(url_), &promised_); | 108 EXPECT_EQ(index_.GetPromised(url_), &promised_); |
105 } | 109 } |
106 | 110 |
107 } // namespace | 111 } // namespace |
108 } // namespace test | 112 } // namespace test |
109 } // namespace net | 113 } // namespace net |
OLD | NEW |