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/websockets/websocket_job.h" | 5 #include "net/websockets/websocket_job.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 entry.cookie_line = cookie_line; | 171 entry.cookie_line = cookie_line; |
172 entry.options = options; | 172 entry.options = options; |
173 entries_.push_back(entry); | 173 entries_.push_back(entry); |
174 return true; | 174 return true; |
175 } | 175 } |
176 | 176 |
177 std::string GetCookiesWithOptions(const GURL& url, | 177 std::string GetCookiesWithOptions(const GURL& url, |
178 const net::CookieOptions& options) { | 178 const net::CookieOptions& options) { |
179 std::string result; | 179 std::string result; |
180 for (size_t i = 0; i < entries_.size(); i++) { | 180 for (size_t i = 0; i < entries_.size(); i++) { |
181 Entry &entry = entries_[i]; | 181 Entry& entry = entries_[i]; |
182 if (url == entry.url) { | 182 if (url == entry.url) { |
183 if (!result.empty()) { | 183 if (!result.empty()) { |
184 result += "; "; | 184 result += "; "; |
185 } | 185 } |
186 result += entry.cookie_line; | 186 result += entry.cookie_line; |
187 } | 187 } |
188 } | 188 } |
189 return result; | 189 return result; |
190 } | 190 } |
191 | 191 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 public: | 247 public: |
248 virtual void GetSSLConfig(net::SSLConfig* config) OVERRIDE {} | 248 virtual void GetSSLConfig(net::SSLConfig* config) OVERRIDE {} |
249 | 249 |
250 protected: | 250 protected: |
251 virtual ~MockSSLConfigService() {} | 251 virtual ~MockSSLConfigService() {} |
252 }; | 252 }; |
253 | 253 |
254 class MockURLRequestContext : public net::URLRequestContext { | 254 class MockURLRequestContext : public net::URLRequestContext { |
255 public: | 255 public: |
256 explicit MockURLRequestContext(net::CookieStore* cookie_store) | 256 explicit MockURLRequestContext(net::CookieStore* cookie_store) |
257 : transport_security_state_(std::string()) { | 257 : transport_security_state_() { |
258 set_cookie_store(cookie_store); | 258 set_cookie_store(cookie_store); |
259 set_transport_security_state(&transport_security_state_); | 259 set_transport_security_state(&transport_security_state_); |
260 net::TransportSecurityState::DomainState state; | 260 net::TransportSecurityState::DomainState state; |
261 state.expiry = base::Time::Now() + base::TimeDelta::FromSeconds(1000); | 261 state.upgrade_expiry = base::Time::Now() + |
| 262 base::TimeDelta::FromSeconds(1000); |
262 transport_security_state_.EnableHost("upgrademe.com", state); | 263 transport_security_state_.EnableHost("upgrademe.com", state); |
263 } | 264 } |
264 | 265 |
265 protected: | 266 protected: |
266 friend class base::RefCountedThreadSafe<MockURLRequestContext>; | 267 friend class base::RefCountedThreadSafe<MockURLRequestContext>; |
267 virtual ~MockURLRequestContext() {} | 268 virtual ~MockURLRequestContext() {} |
268 | 269 |
269 private: | 270 private: |
270 net::TransportSecurityState transport_security_state_; | 271 net::TransportSecurityState transport_security_state_; |
271 }; | 272 }; |
272 | 273 |
273 class MockHttpTransactionFactory : public net::HttpTransactionFactory { | 274 class MockHttpTransactionFactory : public net::HttpTransactionFactory { |
274 public: | 275 public: |
275 MockHttpTransactionFactory(net::OrderedSocketData* data) { | 276 explicit MockHttpTransactionFactory(net::OrderedSocketData* data) { |
276 data_ = data; | 277 data_ = data; |
277 net::MockConnect connect_data(net::SYNCHRONOUS, net::OK); | 278 net::MockConnect connect_data(net::SYNCHRONOUS, net::OK); |
278 data_->set_connect_data(connect_data); | 279 data_->set_connect_data(connect_data); |
279 session_deps_.reset(new SpdySessionDependencies); | 280 session_deps_.reset(new SpdySessionDependencies); |
280 session_deps_->socket_factory->AddSocketDataProvider(data_); | 281 session_deps_->socket_factory->AddSocketDataProvider(data_); |
281 http_session_ = | 282 http_session_ = |
282 SpdySessionDependencies::SpdyCreateSession(session_deps_.get()); | 283 SpdySessionDependencies::SpdyCreateSession(session_deps_.get()); |
283 host_port_pair_.set_host("example.com"); | 284 host_port_pair_.set_host("example.com"); |
284 host_port_pair_.set_port(80); | 285 host_port_pair_.set_port(80); |
285 host_port_proxy_pair_.first = host_port_pair_; | 286 host_port_proxy_pair_.first = host_port_pair_; |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 | 1109 |
1109 TEST_F(WebSocketJobSpdy3Test, ThrottlingSpdySpdyEnabled) { | 1110 TEST_F(WebSocketJobSpdy3Test, ThrottlingSpdySpdyEnabled) { |
1110 WebSocketJob::set_websocket_over_spdy_enabled(true); | 1111 WebSocketJob::set_websocket_over_spdy_enabled(true); |
1111 TestConnectBySpdy(SPDY_ON, THROTTLING_ON); | 1112 TestConnectBySpdy(SPDY_ON, THROTTLING_ON); |
1112 } | 1113 } |
1113 | 1114 |
1114 // TODO(toyoshim): Add tests to verify throttling, SPDY stream limitation. | 1115 // TODO(toyoshim): Add tests to verify throttling, SPDY stream limitation. |
1115 // TODO(toyoshim,yutak): Add tests to verify closing handshake. | 1116 // TODO(toyoshim,yutak): Add tests to verify closing handshake. |
1116 | 1117 |
1117 } // namespace net | 1118 } // namespace net |
OLD | NEW |