Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: net/tools/flip_server/http_interface_test.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/flip_server/http_interface.h ('k') | net/tools/flip_server/mem_cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/tools/flip_server/http_interface.h" 5 #include "net/tools/flip_server/http_interface.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 memory_cache_.get(), 79 memory_cache_.get(),
80 acceptor_.get(), 80 acceptor_.get(),
81 "log_prefix")); 81 "log_prefix"));
82 82
83 interface_.reset(new HttpSM(connection_.get(), 83 interface_.reset(new HttpSM(connection_.get(),
84 mock_another_interface_.get(), 84 mock_another_interface_.get(),
85 memory_cache_.get(), 85 memory_cache_.get(),
86 acceptor_.get())); 86 acceptor_.get()));
87 } 87 }
88 88
89 virtual void TearDown() override { 89 void TearDown() override {
90 if (acceptor_->listen_fd_ >= 0) { 90 if (acceptor_->listen_fd_ >= 0) {
91 epoll_server_->UnregisterFD(acceptor_->listen_fd_); 91 epoll_server_->UnregisterFD(acceptor_->listen_fd_);
92 close(acceptor_->listen_fd_); 92 close(acceptor_->listen_fd_);
93 acceptor_->listen_fd_ = -1; 93 acceptor_->listen_fd_ = -1;
94 } 94 }
95 STLDeleteElements(connection_->output_list()); 95 STLDeleteElements(connection_->output_list());
96 } 96 }
97 97
98 bool HasStream(uint32 stream_id) { 98 bool HasStream(uint32 stream_id) {
99 return interface_->output_ordering().ExistsInPriorityMaps(stream_id); 99 return interface_->output_ordering().ExistsInPriorityMaps(stream_id);
100 } 100 }
101 101
102 protected: 102 protected:
103 scoped_ptr<MockSMInterface> mock_another_interface_; 103 scoped_ptr<MockSMInterface> mock_another_interface_;
104 scoped_ptr<MemoryCache> memory_cache_; 104 scoped_ptr<MemoryCache> memory_cache_;
105 scoped_ptr<FlipAcceptor> acceptor_; 105 scoped_ptr<FlipAcceptor> acceptor_;
106 scoped_ptr<EpollServer> epoll_server_; 106 scoped_ptr<EpollServer> epoll_server_;
107 scoped_ptr<MockSMConnection> connection_; 107 scoped_ptr<MockSMConnection> connection_;
108 scoped_ptr<HttpSM> interface_; 108 scoped_ptr<HttpSM> interface_;
109 }; 109 };
110 110
111 class FlipHttpSMProxyTest : public FlipHttpSMTest { 111 class FlipHttpSMProxyTest : public FlipHttpSMTest {
112 public: 112 public:
113 FlipHttpSMProxyTest() : FlipHttpSMTest(FLIP_HANDLER_PROXY) {} 113 FlipHttpSMProxyTest() : FlipHttpSMTest(FLIP_HANDLER_PROXY) {}
114 virtual ~FlipHttpSMProxyTest() {} 114 ~FlipHttpSMProxyTest() override {}
115 }; 115 };
116 116
117 class FlipHttpSMHttpTest : public FlipHttpSMTest { 117 class FlipHttpSMHttpTest : public FlipHttpSMTest {
118 public: 118 public:
119 FlipHttpSMHttpTest() : FlipHttpSMTest(FLIP_HANDLER_HTTP_SERVER) {} 119 FlipHttpSMHttpTest() : FlipHttpSMTest(FLIP_HANDLER_HTTP_SERVER) {}
120 virtual ~FlipHttpSMHttpTest() {} 120 ~FlipHttpSMHttpTest() override {}
121 }; 121 };
122 122
123 class FlipHttpSMSpdyTest : public FlipHttpSMTest { 123 class FlipHttpSMSpdyTest : public FlipHttpSMTest {
124 public: 124 public:
125 FlipHttpSMSpdyTest() : FlipHttpSMTest(FLIP_HANDLER_SPDY_SERVER) {} 125 FlipHttpSMSpdyTest() : FlipHttpSMTest(FLIP_HANDLER_SPDY_SERVER) {}
126 virtual ~FlipHttpSMSpdyTest() {} 126 ~FlipHttpSMSpdyTest() override {}
127 }; 127 };
128 128
129 TEST_F(FlipHttpSMTest, Construct) { 129 TEST_F(FlipHttpSMTest, Construct) {
130 ASSERT_FALSE(interface_->spdy_framer()->is_request()); 130 ASSERT_FALSE(interface_->spdy_framer()->is_request());
131 } 131 }
132 132
133 TEST_F(FlipHttpSMTest, AddToOutputOrder) { 133 TEST_F(FlipHttpSMTest, AddToOutputOrder) {
134 uint32 stream_id = 13; 134 uint32 stream_id = 13;
135 MemCacheIter mci; 135 MemCacheIter mci;
136 mci.stream_id = stream_id; 136 mci.stream_id = stream_id;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 } 482 }
483 interface_->SendEOF(32); 483 interface_->SendEOF(32);
484 ASSERT_EQ(1u, connection_->output_list()->size()); 484 ASSERT_EQ(1u, connection_->output_list()->size());
485 DataFrame* df = connection_->output_list()->front(); 485 DataFrame* df = connection_->output_list()->front();
486 ASSERT_EQ("0\r\n\r\n", StringPiece(df->data, df->size)); 486 ASSERT_EQ("0\r\n\r\n", StringPiece(df->data, df->size));
487 } 487 }
488 488
489 } // namespace 489 } // namespace
490 490
491 } // namespace net 491 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/flip_server/http_interface.h ('k') | net/tools/flip_server/mem_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698