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

Side by Side Diff: net/test/embedded_test_server/http_connection.cc

Issue 15069003: Rename the embedded test server to EmbeddedTestServer in net::test_server namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 7 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
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/test/embedded_test_server/http_connection.h" 5 #include "net/test/embedded_test_server/http_connection.h"
6 6
7 #include "net/socket/stream_listen_socket.h" 7 #include "net/socket/stream_listen_socket.h"
8 #include "net/test/embedded_test_server/http_response.h" 8 #include "net/test/embedded_test_server/http_response.h"
9 9
10 namespace google_apis { 10 namespace net {
11 namespace test_server { 11 namespace test_server {
12 12
13 HttpConnection::HttpConnection(net::StreamListenSocket* socket, 13 HttpConnection::HttpConnection(StreamListenSocket* socket,
14 const HandleRequestCallback& callback) 14 const HandleRequestCallback& callback)
15 : socket_(socket), 15 : socket_(socket),
16 callback_(callback) { 16 callback_(callback) {
17 } 17 }
18 18
19 HttpConnection::~HttpConnection() { 19 HttpConnection::~HttpConnection() {
20 } 20 }
21 21
22 void HttpConnection::SendResponse(scoped_ptr<HttpResponse> response) const { 22 void HttpConnection::SendResponse(scoped_ptr<HttpResponse> response) const {
23 const std::string response_string = response->ToResponseString(); 23 const std::string response_string = response->ToResponseString();
24 socket_->Send(response_string.c_str(), response_string.length()); 24 socket_->Send(response_string.c_str(), response_string.length());
25 } 25 }
26 26
27 void HttpConnection::ReceiveData(const base::StringPiece& data) { 27 void HttpConnection::ReceiveData(const base::StringPiece& data) {
28 request_parser_.ProcessChunk(data); 28 request_parser_.ProcessChunk(data);
29 if (request_parser_.ParseRequest() == HttpRequestParser::ACCEPTED) { 29 if (request_parser_.ParseRequest() == HttpRequestParser::ACCEPTED) {
30 callback_.Run(this, request_parser_.GetRequest()); 30 callback_.Run(this, request_parser_.GetRequest());
31 } 31 }
32 } 32 }
33 33
34 } // namespace test_server 34 } // namespace test_server
35 } // namespace google_apis 35 } // namespace net
OLDNEW
« no previous file with comments | « net/test/embedded_test_server/http_connection.h ('k') | net/test/embedded_test_server/http_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698