| 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_(new StrictMock<MockConnection>(&helper_, | 48 : connection_(new StrictMock<MockQuicConnection>(&helper_, |
| 49 &alarm_factory_, | 49 &alarm_factory_, |
| 50 Perspective::IS_CLIENT)), | 50 Perspective::IS_CLIENT)), |
| 51 session_(connection_, &index_), | 51 session_(connection_, &index_), |
| 52 promised_(&session_, kServerDataStreamId1, url_) { | 52 promised_(&session_, kServerDataStreamId1, url_) { |
| 53 FLAGS_quic_supports_push_promise = true; | 53 FLAGS_quic_supports_push_promise = true; |
| 54 request_[":path"] = "/bar"; | 54 request_[":path"] = "/bar"; |
| 55 request_[":authority"] = "www.google.com"; | 55 request_[":authority"] = "www.google.com"; |
| 56 request_[":version"] = "HTTP/1.1"; | 56 request_[":version"] = "HTTP/1.1"; |
| 57 request_[":method"] = "GET"; | 57 request_[":method"] = "GET"; |
| 58 request_[":scheme"] = "https"; | 58 request_[":scheme"] = "https"; |
| 59 url_ = SpdyUtils::GetUrlFromHeaderBlock(request_); | 59 url_ = SpdyUtils::GetUrlFromHeaderBlock(request_); |
| 60 } | 60 } |
| 61 | 61 |
| 62 MockConnectionHelper helper_; | 62 MockQuicConnectionHelper helper_; |
| 63 MockAlarmFactory alarm_factory_; | 63 MockAlarmFactory alarm_factory_; |
| 64 StrictMock<MockConnection>* connection_; | 64 StrictMock<MockQuicConnection>* connection_; |
| 65 MockQuicClientSession session_; | 65 MockQuicClientSession session_; |
| 66 QuicClientPushPromiseIndex index_; | 66 QuicClientPushPromiseIndex index_; |
| 67 SpdyHeaderBlock request_; | 67 SpdyHeaderBlock request_; |
| 68 string url_; | 68 string url_; |
| 69 MockQuicClientPromisedInfo promised_; | 69 MockQuicClientPromisedInfo promised_; |
| 70 QuicClientPushPromiseIndex::TryHandle* handle_; | 70 QuicClientPushPromiseIndex::TryHandle* handle_; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 TEST_F(QuicClientPushPromiseIndexTest, TryRequestSuccess) { | 73 TEST_F(QuicClientPushPromiseIndexTest, TryRequestSuccess) { |
| 74 (*index_.promised_by_url())[url_] = &promised_; | 74 (*index_.promised_by_url())[url_] = &promised_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 TEST_F(QuicClientPushPromiseIndexTest, GetPromise) { | 102 TEST_F(QuicClientPushPromiseIndexTest, GetPromise) { |
| 103 (*index_.promised_by_url())[url_] = &promised_; | 103 (*index_.promised_by_url())[url_] = &promised_; |
| 104 EXPECT_EQ(index_.GetPromised(url_), &promised_); | 104 EXPECT_EQ(index_.GetPromised(url_), &promised_); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace | 107 } // namespace |
| 108 } // namespace test | 108 } // namespace test |
| 109 } // namespace net | 109 } // namespace net |
| OLD | NEW |