| 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 #include "net/http/http_pipelined_connection_impl.h" | 5 #include "net/http/http_pipelined_connection_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 pool_(1, 1, &histograms_, &factory_), | 73 pool_(1, 1, &histograms_, &factory_), |
| 74 origin_("host", 123) { | 74 origin_("host", 123) { |
| 75 } | 75 } |
| 76 | 76 |
| 77 void TearDown() { | 77 void TearDown() { |
| 78 MessageLoop::current()->RunAllPending(); | 78 MessageLoop::current()->RunAllPending(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void Initialize(MockRead* reads, size_t reads_count, | 81 void Initialize(MockRead* reads, size_t reads_count, |
| 82 MockWrite* writes, size_t writes_count) { | 82 MockWrite* writes, size_t writes_count) { |
| 83 data_ = new DeterministicSocketData(reads, reads_count, | 83 data_.reset(new DeterministicSocketData(reads, reads_count, |
| 84 writes, writes_count); | 84 writes, writes_count)); |
| 85 data_->set_connect_data(MockConnect(SYNCHRONOUS, OK)); | 85 data_->set_connect_data(MockConnect(SYNCHRONOUS, OK)); |
| 86 if (reads_count || writes_count) { | 86 if (reads_count || writes_count) { |
| 87 data_->StopAfter(reads_count + writes_count); | 87 data_->StopAfter(reads_count + writes_count); |
| 88 } | 88 } |
| 89 factory_.AddSocketDataProvider(data_.get()); | 89 factory_.AddSocketDataProvider(data_.get()); |
| 90 scoped_refptr<DummySocketParams> params; | 90 scoped_refptr<DummySocketParams> params; |
| 91 ClientSocketHandle* connection = new ClientSocketHandle; | 91 ClientSocketHandle* connection = new ClientSocketHandle; |
| 92 connection->Init("a", params, MEDIUM, CompletionCallback(), &pool_, | 92 connection->Init("a", params, MEDIUM, CompletionCallback(), &pool_, |
| 93 BoundNetLog()); | 93 BoundNetLog()); |
| 94 pipeline_.reset(new HttpPipelinedConnectionImpl( | 94 pipeline_.reset(new HttpPipelinedConnectionImpl( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 callback_.callback())); | 141 callback_.callback())); |
| 142 EXPECT_EQ(OK, stream->ReadResponseHeaders(callback_.callback())); | 142 EXPECT_EQ(OK, stream->ReadResponseHeaders(callback_.callback())); |
| 143 ExpectResponse(filename, stream, false); | 143 ExpectResponse(filename, stream, false); |
| 144 | 144 |
| 145 stream->Close(false); | 145 stream->Close(false); |
| 146 } | 146 } |
| 147 | 147 |
| 148 DeterministicMockClientSocketFactory factory_; | 148 DeterministicMockClientSocketFactory factory_; |
| 149 ClientSocketPoolHistograms histograms_; | 149 ClientSocketPoolHistograms histograms_; |
| 150 MockTransportClientSocketPool pool_; | 150 MockTransportClientSocketPool pool_; |
| 151 scoped_refptr<DeterministicSocketData> data_; | 151 scoped_ptr<DeterministicSocketData> data_; |
| 152 | 152 |
| 153 HostPortPair origin_; | 153 HostPortPair origin_; |
| 154 SSLConfig ssl_config_; | 154 SSLConfig ssl_config_; |
| 155 ProxyInfo proxy_info_; | 155 ProxyInfo proxy_info_; |
| 156 NiceMock<MockPipelineDelegate> delegate_; | 156 NiceMock<MockPipelineDelegate> delegate_; |
| 157 TestCompletionCallback callback_; | 157 TestCompletionCallback callback_; |
| 158 scoped_ptr<HttpPipelinedConnectionImpl> pipeline_; | 158 scoped_ptr<HttpPipelinedConnectionImpl> pipeline_; |
| 159 ScopedVector<HttpRequestInfo> request_info_vector_; | 159 ScopedVector<HttpRequestInfo> request_info_vector_; |
| 160 }; | 160 }; |
| 161 | 161 |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 MessageLoop::current()->RunAllPending(); | 1602 MessageLoop::current()->RunAllPending(); |
| 1603 | 1603 |
| 1604 stream->Close(false); | 1604 stream->Close(false); |
| 1605 EXPECT_CALL(delegate_, OnPipelineHasCapacity(pipeline_.get())).Times(1); | 1605 EXPECT_CALL(delegate_, OnPipelineHasCapacity(pipeline_.get())).Times(1); |
| 1606 stream.reset(NULL); | 1606 stream.reset(NULL); |
| 1607 } | 1607 } |
| 1608 | 1608 |
| 1609 } // anonymous namespace | 1609 } // anonymous namespace |
| 1610 | 1610 |
| 1611 } // namespace net | 1611 } // namespace net |
| OLD | NEW |