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_push_promise_index.h" | 5 #include "net/quic/quic_client_push_promise_index.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "net/quic/spdy_utils.h" | 9 #include "net/quic/spdy_utils.h" |
10 #include "net/quic/test_tools/crypto_test_utils.h" | 10 #include "net/quic/test_tools/crypto_test_utils.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 private: | 39 private: |
40 QuicCryptoClientConfig crypto_config_; | 40 QuicCryptoClientConfig crypto_config_; |
41 | 41 |
42 DISALLOW_COPY_AND_ASSIGN(MockQuicClientSession); | 42 DISALLOW_COPY_AND_ASSIGN(MockQuicClientSession); |
43 }; | 43 }; |
44 | 44 |
45 class QuicClientPushPromiseIndexTest : public ::testing::Test { | 45 class QuicClientPushPromiseIndexTest : public ::testing::Test { |
46 public: | 46 public: |
47 QuicClientPushPromiseIndexTest() | 47 QuicClientPushPromiseIndexTest() |
48 : connection_( | 48 : connection_(new StrictMock<MockConnection>(&helper_, |
49 new StrictMock<MockConnection>(&helper_, Perspective::IS_CLIENT)), | 49 &alarm_factory_, |
| 50 Perspective::IS_CLIENT)), |
50 session_(connection_, &index_), | 51 session_(connection_, &index_), |
51 promised_(&session_, kServerDataStreamId1, url_) { | 52 promised_(&session_, kServerDataStreamId1, url_) { |
52 FLAGS_quic_supports_push_promise = true; | 53 FLAGS_quic_supports_push_promise = true; |
53 request_[":path"] = "/bar"; | 54 request_[":path"] = "/bar"; |
54 request_[":authority"] = "www.google.com"; | 55 request_[":authority"] = "www.google.com"; |
55 request_[":version"] = "HTTP/1.1"; | 56 request_[":version"] = "HTTP/1.1"; |
56 request_[":method"] = "GET"; | 57 request_[":method"] = "GET"; |
57 request_[":scheme"] = "https"; | 58 request_[":scheme"] = "https"; |
58 url_ = SpdyUtils::GetUrlFromHeaderBlock(request_); | 59 url_ = SpdyUtils::GetUrlFromHeaderBlock(request_); |
59 } | 60 } |
60 | 61 |
61 MockConnectionHelper helper_; | 62 MockConnectionHelper helper_; |
| 63 MockAlarmFactory alarm_factory_; |
62 StrictMock<MockConnection>* connection_; | 64 StrictMock<MockConnection>* connection_; |
63 MockQuicClientSession session_; | 65 MockQuicClientSession session_; |
64 QuicClientPushPromiseIndex index_; | 66 QuicClientPushPromiseIndex index_; |
65 SpdyHeaderBlock request_; | 67 SpdyHeaderBlock request_; |
66 string url_; | 68 string url_; |
67 MockQuicClientPromisedInfo promised_; | 69 MockQuicClientPromisedInfo promised_; |
68 QuicClientPushPromiseIndex::TryHandle* handle_; | 70 QuicClientPushPromiseIndex::TryHandle* handle_; |
69 }; | 71 }; |
70 | 72 |
71 TEST_F(QuicClientPushPromiseIndexTest, TryRequestSuccess) { | 73 TEST_F(QuicClientPushPromiseIndexTest, TryRequestSuccess) { |
(...skipping 26 matching lines...) Expand all Loading... |
98 } | 100 } |
99 | 101 |
100 TEST_F(QuicClientPushPromiseIndexTest, GetPromise) { | 102 TEST_F(QuicClientPushPromiseIndexTest, GetPromise) { |
101 (*index_.promised_by_url())[url_] = &promised_; | 103 (*index_.promised_by_url())[url_] = &promised_; |
102 EXPECT_EQ(index_.GetPromised(url_), &promised_); | 104 EXPECT_EQ(index_.GetPromised(url_), &promised_); |
103 } | 105 } |
104 | 106 |
105 } // namespace | 107 } // namespace |
106 } // namespace test | 108 } // namespace test |
107 } // namespace net | 109 } // namespace net |
OLD | NEW |