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

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

Issue 9415040: Refactor TransportSecurityState. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/websockets/websocket_job_spdy2_unittest.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 (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
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
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
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
OLDNEW
« no previous file with comments | « net/websockets/websocket_job_spdy2_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698