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

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

Issue 11088073: HTTP server for testing Google Drive. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moved to chrome/browser/google_apis. 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
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 #include "base/basictypes.h"
9 #include "chrome/browser/google_apis/test_server/http_request.h"
10 #include "chrome/browser/google_apis/test_server/http_response.h"
11
12 namespace drive {
13 namespace test_server {
14
15 HttpConnection::HttpConnection(net::StreamListenSocket* socket,
16 const HandleRequestCallback& callback)
17 : socket_(socket),
18 callback_(callback) {
19 }
20
21 HttpConnection::~HttpConnection() {
22 }
23
24 void HttpConnection::SendResponse(scoped_ptr<HttpResponse> response) const {
25 const std::string response_string = response->ToResponseString();
26 socket_->Send(response_string.c_str(), response_string.length());
27 }
28
29 void HttpConnection::ReceiveData(const base::StringPiece& data) {
30 request_parser_.ProcessChunk(data);
31 while (request_parser_.ParseRequest() == HttpRequestParser::ACCEPTED) {
32 callback_.Run(this, request_parser_.GetRequest().Pass());
33 }
34 }
35
36 } // namespace test_server
37 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698