| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef NET_SPDY_SPDY_TEST_UTILS_H_ | 5 #ifndef NET_SPDY_SPDY_TEST_UTILS_H_ |
| 6 #define NET_SPDY_SPDY_TEST_UTILS_H_ | 6 #define NET_SPDY_SPDY_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> |
| 12 #include <memory> |
| 13 |
| 11 #include "net/spdy/platform/api/spdy_string.h" | 14 #include "net/spdy/platform/api/spdy_string.h" |
| 12 #include "net/spdy/platform/api/spdy_string_piece.h" | 15 #include "net/spdy/platform/api/spdy_string_piece.h" |
| 13 #include "net/spdy/server_push_delegate.h" | 16 #include "net/spdy/server_push_delegate.h" |
| 14 #include "net/spdy/spdy_bug_tracker.h" | 17 #include "net/spdy/spdy_bug_tracker.h" |
| 15 #include "net/spdy/spdy_header_block.h" | 18 #include "net/spdy/spdy_header_block.h" |
| 16 #include "net/spdy/spdy_headers_handler_interface.h" | 19 #include "net/spdy/spdy_headers_handler_interface.h" |
| 17 #include "net/spdy/spdy_protocol.h" | 20 #include "net/spdy/spdy_protocol.h" |
| 18 #include "net/test/gtest_util.h" | 21 #include "net/test/gtest_util.h" |
| 19 | 22 |
| 20 #define EXPECT_SPDY_BUG EXPECT_DFATAL | 23 #define EXPECT_SPDY_BUG EXPECT_DFATAL |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 SpdyHeaderBlock block_; | 86 SpdyHeaderBlock block_; |
| 84 size_t header_bytes_parsed_; | 87 size_t header_bytes_parsed_; |
| 85 | 88 |
| 86 DISALLOW_COPY_AND_ASSIGN(TestHeadersHandler); | 89 DISALLOW_COPY_AND_ASSIGN(TestHeadersHandler); |
| 87 }; | 90 }; |
| 88 | 91 |
| 89 // A test implementation of ServerPushDelegate that caches all the pushed | 92 // A test implementation of ServerPushDelegate that caches all the pushed |
| 90 // request and provides a interface to cancel the push given url. | 93 // request and provides a interface to cancel the push given url. |
| 91 class TestServerPushDelegate : public ServerPushDelegate { | 94 class TestServerPushDelegate : public ServerPushDelegate { |
| 92 public: | 95 public: |
| 93 explicit TestServerPushDelegate(); | 96 TestServerPushDelegate(); |
| 94 ~TestServerPushDelegate() override; | 97 ~TestServerPushDelegate() override; |
| 95 | 98 |
| 96 void OnPush(std::unique_ptr<ServerPushHelper> push_helper, | 99 void OnPush(std::unique_ptr<ServerPushHelper> push_helper, |
| 97 const NetLogWithSource& session_net_log) override; | 100 const NetLogWithSource& session_net_log) override; |
| 98 | 101 |
| 99 bool CancelPush(GURL url); | 102 bool CancelPush(GURL url); |
| 100 | 103 |
| 101 private: | 104 private: |
| 102 std::map<GURL, std::unique_ptr<ServerPushHelper>> push_helpers; | 105 std::map<GURL, std::unique_ptr<ServerPushHelper>> push_helpers; |
| 103 }; | 106 }; |
| 104 | 107 |
| 105 } // namespace test | 108 } // namespace test |
| 106 } // namespace net | 109 } // namespace net |
| 107 | 110 |
| 108 #endif // NET_SPDY_SPDY_TEST_UTILS_H_ | 111 #endif // NET_SPDY_SPDY_TEST_UTILS_H_ |
| OLD | NEW |