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

Side by Side Diff: chrome/test/chromedriver/net/test_http_server.cc

Issue 594393002: Add net::HttpServer::Delegate::OnConnect() function and set ChromeDriver buffer sizes to 100 MB (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Put as much of the file as possible into the anonymous namespace Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/test/chromedriver/net/test_http_server.h" 5 #include "chrome/test/chromedriver/net/test_http_server.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void TestHttpServer::SetMessageAction(WebSocketMessageAction action) { 68 void TestHttpServer::SetMessageAction(WebSocketMessageAction action) {
69 base::AutoLock lock(action_lock_); 69 base::AutoLock lock(action_lock_);
70 message_action_ = action; 70 message_action_ = action;
71 } 71 }
72 72
73 GURL TestHttpServer::web_socket_url() const { 73 GURL TestHttpServer::web_socket_url() const {
74 base::AutoLock lock(url_lock_); 74 base::AutoLock lock(url_lock_);
75 return web_socket_url_; 75 return web_socket_url_;
76 } 76 }
77 77
78 void TestHttpServer::OnHttpRequest( 78 void TestHttpServer::OnConnect(int connection_id) {
79 int connection_id,
80 const net::HttpServerRequestInfo& info) {
81 server_->SetSendBufferSize(connection_id, kBufferSize); 79 server_->SetSendBufferSize(connection_id, kBufferSize);
82 server_->SetReceiveBufferSize(connection_id, kBufferSize); 80 server_->SetReceiveBufferSize(connection_id, kBufferSize);
83 } 81 }
84 82
85 void TestHttpServer::OnWebSocketRequest( 83 void TestHttpServer::OnWebSocketRequest(
86 int connection_id, 84 int connection_id,
87 const net::HttpServerRequestInfo& info) { 85 const net::HttpServerRequestInfo& info) {
88 server_->SetSendBufferSize(connection_id, kBufferSize); 86 server_->SetSendBufferSize(connection_id, kBufferSize);
stgao 2014/09/24 17:53:34 Could these two lines be deleted as they are alrea
samuong 2014/09/24 18:18:35 Done.
89 server_->SetReceiveBufferSize(connection_id, kBufferSize); 87 server_->SetReceiveBufferSize(connection_id, kBufferSize);
90 88
91 WebSocketRequestAction action; 89 WebSocketRequestAction action;
92 { 90 {
93 base::AutoLock lock(action_lock_); 91 base::AutoLock lock(action_lock_);
94 action = request_action_; 92 action = request_action_;
95 } 93 }
96 connections_.insert(connection_id); 94 connections_.insert(connection_id);
97 all_closed_event_.Reset(); 95 all_closed_event_.Reset();
98 96
99 switch (action) { 97 switch (action) {
100 case kAccept: 98 case kAccept:
101 server_->AcceptWebSocket(connection_id, info); 99 server_->AcceptWebSocket(connection_id, info);
102 break; 100 break;
103 case kNotFound: 101 case kNotFound:
104 server_->Send404(connection_id); 102 server_->Send404(connection_id);
105 break; 103 break;
106 case kClose: 104 case kClose:
107 server_->Close(connection_id); 105 server_->Close(connection_id);
108 break; 106 break;
109 } 107 }
110 } 108 }
111 109
112 void TestHttpServer::OnWebSocketMessage(int connection_id, 110 void TestHttpServer::OnWebSocketMessage(int connection_id,
113 const std::string& data) { 111 const std::string& data) {
114 server_->SetSendBufferSize(connection_id, kBufferSize); 112 server_->SetSendBufferSize(connection_id, kBufferSize);
stgao 2014/09/24 17:53:34 Same here.
samuong 2014/09/24 18:18:35 Done.
115 server_->SetReceiveBufferSize(connection_id, kBufferSize); 113 server_->SetReceiveBufferSize(connection_id, kBufferSize);
116 WebSocketMessageAction action; 114 WebSocketMessageAction action;
117 { 115 {
118 base::AutoLock lock(action_lock_); 116 base::AutoLock lock(action_lock_);
119 action = message_action_; 117 action = message_action_;
120 } 118 }
121 switch (action) { 119 switch (action) {
122 case kEchoMessage: 120 case kEchoMessage:
123 server_->SendOverWebSocket(connection_id, data); 121 server_->SendOverWebSocket(connection_id, data);
124 break; 122 break;
(...skipping 27 matching lines...) Expand all
152 server_.reset(NULL); 150 server_.reset(NULL);
153 } 151 }
154 *success = server_.get(); 152 *success = server_.get();
155 event->Signal(); 153 event->Signal();
156 } 154 }
157 155
158 void TestHttpServer::StopOnServerThread(base::WaitableEvent* event) { 156 void TestHttpServer::StopOnServerThread(base::WaitableEvent* event) {
159 server_.reset(NULL); 157 server_.reset(NULL);
160 event->Signal(); 158 event->Signal();
161 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698