| 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 <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
| 14 #include "net/spdy/server_push_delegate.h" |
| 14 #include "net/spdy/spdy_bug_tracker.h" | 15 #include "net/spdy/spdy_bug_tracker.h" |
| 15 #include "net/spdy/spdy_header_block.h" | 16 #include "net/spdy/spdy_header_block.h" |
| 16 #include "net/spdy/spdy_headers_handler_interface.h" | 17 #include "net/spdy/spdy_headers_handler_interface.h" |
| 17 #include "net/spdy/spdy_protocol.h" | 18 #include "net/spdy/spdy_protocol.h" |
| 18 #include "net/test/gtest_util.h" | 19 #include "net/test/gtest_util.h" |
| 19 | 20 |
| 20 #define EXPECT_SPDY_BUG EXPECT_DFATAL | 21 #define EXPECT_SPDY_BUG EXPECT_DFATAL |
| 21 | 22 |
| 22 namespace net { | 23 namespace net { |
| 23 | 24 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 const SpdyHeaderBlock& decoded_block() const { return block_; } | 83 const SpdyHeaderBlock& decoded_block() const { return block_; } |
| 83 size_t header_bytes_parsed() { return header_bytes_parsed_; } | 84 size_t header_bytes_parsed() { return header_bytes_parsed_; } |
| 84 | 85 |
| 85 private: | 86 private: |
| 86 SpdyHeaderBlock block_; | 87 SpdyHeaderBlock block_; |
| 87 size_t header_bytes_parsed_; | 88 size_t header_bytes_parsed_; |
| 88 | 89 |
| 89 DISALLOW_COPY_AND_ASSIGN(TestHeadersHandler); | 90 DISALLOW_COPY_AND_ASSIGN(TestHeadersHandler); |
| 90 }; | 91 }; |
| 91 | 92 |
| 93 // A test implementation of ServerPushDelegate that caches all the pushed |
| 94 // request and provides a interface to cancel the push given url. |
| 95 class TestServerPushDelegate : public ServerPushDelegate { |
| 96 public: |
| 97 explicit TestServerPushDelegate(); |
| 98 ~TestServerPushDelegate() override; |
| 99 |
| 100 void OnPush(std::unique_ptr<ServerPushHelper> push_helper) override; |
| 101 |
| 102 bool CancelPush(GURL url); |
| 103 |
| 104 private: |
| 105 std::map<GURL, std::unique_ptr<ServerPushHelper>> push_helpers; |
| 106 }; |
| 107 |
| 92 } // namespace test | 108 } // namespace test |
| 93 } // namespace net | 109 } // namespace net |
| 94 | 110 |
| 95 #endif // NET_SPDY_SPDY_TEST_UTILS_H_ | 111 #endif // NET_SPDY_SPDY_TEST_UTILS_H_ |
| OLD | NEW |