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

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

Powered by Google App Engine
This is Rietveld 408576698