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

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

Issue 12033072: Include destination port for websocket throttling. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix things caught by toyoshim. Created 7 years, 11 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 | « no previous file | net/websockets/websocket_job_spdy3_unittest.cc » ('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 (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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 399
400 socket_ = new SocketStream(url, websocket_.get()); 400 socket_ = new SocketStream(url, websocket_.get());
401 socket_factory_.reset(new MockClientSocketFactory); 401 socket_factory_.reset(new MockClientSocketFactory);
402 DCHECK(data_.get()); 402 DCHECK(data_.get());
403 socket_factory_->AddSocketDataProvider(data_.get()); 403 socket_factory_->AddSocketDataProvider(data_.get());
404 socket_->SetClientSocketFactory(socket_factory_.get()); 404 socket_->SetClientSocketFactory(socket_factory_.get());
405 } 405 }
406 406
407 websocket_->InitSocketStream(socket_.get()); 407 websocket_->InitSocketStream(socket_.get());
408 websocket_->set_context(context_.get()); 408 websocket_->set_context(context_.get());
409 // MockHostResolver resolves all hosts to 127.0.0.1; however, when we create
410 // a WebSocketJob purely to block another one in a throttling test, we don't
411 // perform a real connect. In that case, the following address is used
412 // instead.
409 IPAddressNumber ip; 413 IPAddressNumber ip;
410 ParseIPLiteralToNumber("127.0.0.1", &ip); 414 ParseIPLiteralToNumber("127.0.0.1", &ip);
411 websocket_->addresses_ = AddressList::CreateFromIPAddress(ip, 0); 415 websocket_->addresses_ = AddressList::CreateFromIPAddress(ip, 80);
412 } 416 }
413 void SkipToConnecting() { 417 void SkipToConnecting() {
414 websocket_->state_ = WebSocketJob::CONNECTING; 418 websocket_->state_ = WebSocketJob::CONNECTING;
415 WebSocketThrottle::GetInstance()->PutInQueue(websocket_); 419 WebSocketThrottle::GetInstance()->PutInQueue(websocket_);
416 } 420 }
417 WebSocketJob::State GetWebSocketJobState() { 421 WebSocketJob::State GetWebSocketJobState() {
418 return websocket_->state_; 422 return websocket_->state_;
419 } 423 }
420 void CloseWebSocketJob() { 424 void CloseWebSocketJob() {
421 if (websocket_->socket_) { 425 if (websocket_->socket_) {
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 1092
1089 TEST_F(WebSocketJobSpdy2Test, ThrottlingSpdySpdyEnabled) { 1093 TEST_F(WebSocketJobSpdy2Test, ThrottlingSpdySpdyEnabled) {
1090 WebSocketJob::set_websocket_over_spdy_enabled(true); 1094 WebSocketJob::set_websocket_over_spdy_enabled(true);
1091 TestConnectBySpdy(SPDY_ON, THROTTLING_ON); 1095 TestConnectBySpdy(SPDY_ON, THROTTLING_ON);
1092 } 1096 }
1093 1097
1094 // TODO(toyoshim): Add tests to verify throttling, SPDY stream limitation. 1098 // TODO(toyoshim): Add tests to verify throttling, SPDY stream limitation.
1095 // TODO(toyoshim,yutak): Add tests to verify closing handshake. 1099 // TODO(toyoshim,yutak): Add tests to verify closing handshake.
1096 1100
1097 } // namespace net 1101 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/websockets/websocket_job_spdy3_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698