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

Side by Side Diff: net/websockets/websocket_test_util.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months 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/websockets/websocket_stream_test.cc ('k') | no next file » | 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/websockets/websocket_test_util.h" 5 #include "net/websockets/websocket_test_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
12 #include "net/proxy/proxy_service.h" 13 #include "net/proxy/proxy_service.h"
13 #include "net/socket/socket_test_util.h" 14 #include "net/socket/socket_test_util.h"
14 #include "url/origin.h" 15 #include "url/origin.h"
15 16
16 namespace net { 17 namespace net {
17 18
18 namespace { 19 namespace {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 place += kHttpStreamParserBufferSize) { 121 place += kHttpStreamParserBufferSize) {
121 detail_->reads.push_back( 122 detail_->reads.push_back(
122 MockRead(SYNCHRONOUS, detail_->return_to_read.data() + place, 123 MockRead(SYNCHRONOUS, detail_->return_to_read.data() + place,
123 std::min(detail_->return_to_read.size() - place, 124 std::min(detail_->return_to_read.size() - place,
124 kHttpStreamParserBufferSize), 125 kHttpStreamParserBufferSize),
125 sequence++)); 126 sequence++));
126 } 127 }
127 scoped_ptr<SequencedSocketData> socket_data(new SequencedSocketData( 128 scoped_ptr<SequencedSocketData> socket_data(new SequencedSocketData(
128 detail_->reads.data(), detail_->reads.size(), &detail_->write, 1)); 129 detail_->reads.data(), detail_->reads.size(), &detail_->write, 1));
129 socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); 130 socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK));
130 AddRawExpectations(socket_data.Pass()); 131 AddRawExpectations(std::move(socket_data));
131 } 132 }
132 133
133 void WebSocketMockClientSocketFactoryMaker::AddRawExpectations( 134 void WebSocketMockClientSocketFactoryMaker::AddRawExpectations(
134 scoped_ptr<SequencedSocketData> socket_data) { 135 scoped_ptr<SequencedSocketData> socket_data) {
135 detail_->factory.AddSocketDataProvider(socket_data.get()); 136 detail_->factory.AddSocketDataProvider(socket_data.get());
136 detail_->socket_data_vector.push_back(socket_data.Pass()); 137 detail_->socket_data_vector.push_back(std::move(socket_data));
137 } 138 }
138 139
139 void WebSocketMockClientSocketFactoryMaker::AddSSLSocketDataProvider( 140 void WebSocketMockClientSocketFactoryMaker::AddSSLSocketDataProvider(
140 scoped_ptr<SSLSocketDataProvider> ssl_socket_data) { 141 scoped_ptr<SSLSocketDataProvider> ssl_socket_data) {
141 detail_->factory.AddSSLSocketDataProvider(ssl_socket_data.get()); 142 detail_->factory.AddSSLSocketDataProvider(ssl_socket_data.get());
142 detail_->ssl_socket_data_vector.push_back(ssl_socket_data.Pass()); 143 detail_->ssl_socket_data_vector.push_back(std::move(ssl_socket_data));
143 } 144 }
144 145
145 WebSocketTestURLRequestContextHost::WebSocketTestURLRequestContextHost() 146 WebSocketTestURLRequestContextHost::WebSocketTestURLRequestContextHost()
146 : url_request_context_(true), url_request_context_initialized_(false) { 147 : url_request_context_(true), url_request_context_initialized_(false) {
147 url_request_context_.set_client_socket_factory(maker_.factory()); 148 url_request_context_.set_client_socket_factory(maker_.factory());
148 } 149 }
149 150
150 WebSocketTestURLRequestContextHost::~WebSocketTestURLRequestContextHost() {} 151 WebSocketTestURLRequestContextHost::~WebSocketTestURLRequestContextHost() {}
151 152
152 void WebSocketTestURLRequestContextHost::AddRawExpectations( 153 void WebSocketTestURLRequestContextHost::AddRawExpectations(
153 scoped_ptr<SequencedSocketData> socket_data) { 154 scoped_ptr<SequencedSocketData> socket_data) {
154 maker_.AddRawExpectations(socket_data.Pass()); 155 maker_.AddRawExpectations(std::move(socket_data));
155 } 156 }
156 157
157 void WebSocketTestURLRequestContextHost::AddSSLSocketDataProvider( 158 void WebSocketTestURLRequestContextHost::AddSSLSocketDataProvider(
158 scoped_ptr<SSLSocketDataProvider> ssl_socket_data) { 159 scoped_ptr<SSLSocketDataProvider> ssl_socket_data) {
159 maker_.AddSSLSocketDataProvider(ssl_socket_data.Pass()); 160 maker_.AddSSLSocketDataProvider(std::move(ssl_socket_data));
160 } 161 }
161 162
162 void WebSocketTestURLRequestContextHost::SetProxyConfig( 163 void WebSocketTestURLRequestContextHost::SetProxyConfig(
163 const std::string& proxy_rules) { 164 const std::string& proxy_rules) {
164 DCHECK(!url_request_context_initialized_); 165 DCHECK(!url_request_context_initialized_);
165 proxy_service_ = ProxyService::CreateFixed(proxy_rules); 166 proxy_service_ = ProxyService::CreateFixed(proxy_rules);
166 url_request_context_.set_proxy_service(proxy_service_.get()); 167 url_request_context_.set_proxy_service(proxy_service_.get());
167 } 168 }
168 169
169 TestURLRequestContext* 170 TestURLRequestContext*
170 WebSocketTestURLRequestContextHost::GetURLRequestContext() { 171 WebSocketTestURLRequestContextHost::GetURLRequestContext() {
171 if (!url_request_context_initialized_) { 172 if (!url_request_context_initialized_) {
172 url_request_context_.Init(); 173 url_request_context_.Init();
173 // A Network Delegate is required to make the URLRequest::Delegate work. 174 // A Network Delegate is required to make the URLRequest::Delegate work.
174 url_request_context_.set_network_delegate(&network_delegate_); 175 url_request_context_.set_network_delegate(&network_delegate_);
175 url_request_context_initialized_ = true; 176 url_request_context_initialized_ = true;
176 } 177 }
177 return &url_request_context_; 178 return &url_request_context_;
178 } 179 }
179 180
180 } // namespace net 181 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket_stream_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698