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

Side by Side Diff: chrome/browser/google_apis/test_server/http_connection.cc

Issue 11275306: Revert 167627 - HTTP server for testing Google APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/google_apis/test_server/http_connection.h"
6
7 #include <string>
8
9 #include "base/basictypes.h"
10 #include "chrome/browser/google_apis/test_server/http_request.h"
11 #include "chrome/browser/google_apis/test_server/http_response.h"
12
13 namespace drive {
14 namespace test_server {
15
16 HttpConnection::HttpConnection(net::StreamListenSocket* socket,
17 const HandleRequestCallback& callback)
18 : socket_(socket),
19 callback_(callback) {
20 }
21
22 HttpConnection::~HttpConnection() {
23 }
24
25 void HttpConnection::SendResponse(scoped_ptr<HttpResponse> response) const {
26 const std::string response_string = response->ToResponseString();
27 socket_->Send(response_string.c_str(), response_string.length());
28 }
29
30 void HttpConnection::ReceiveData(const base::StringPiece& data) {
31 request_parser_.ProcessChunk(data);
32 if (request_parser_.ParseRequest() == HttpRequestParser::ACCEPTED) {
33 callback_.Run(this, request_parser_.GetRequest().Pass());
34 }
35 }
36
37 } // namespace test_server
38 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/test_server/http_connection.h ('k') | chrome/browser/google_apis/test_server/http_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698