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