Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / browser / fileapi / mock_url_request_delegate.h
blob137b11426e844ad682720824d5c9b48c2e8ea60b
1 // Copyright 2014 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.
5 #ifndef CONTENT_BROWSER_FILEAPI_MOCK_URL_REQUEST_DELEGATE_H
6 #define CONTENT_BROWSER_FILEAPI_MOCK_URL_REQUEST_DELEGATE_H
8 #include "net/url_request/url_request.h"
10 namespace net {
11 class IOBuffer;
14 namespace content {
16 // A URL request delegate that receives the response body.
17 class MockURLRequestDelegate : public net::URLRequest::Delegate {
18 public:
19 MockURLRequestDelegate();
20 virtual ~MockURLRequestDelegate();
22 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
23 virtual void OnReadCompleted(net::URLRequest* request,
24 int bytes_read) OVERRIDE;
25 const std::string& response_data() const { return response_data_; }
27 private:
28 void ReadSome(net::URLRequest* request);
29 void ReceiveData(net::URLRequest* request, int bytes_read);
30 void RequestComplete();
32 scoped_refptr<net::IOBuffer> io_buffer_;
33 std::string response_data_;
36 } // namespace content
38 #endif // CONTENT_BROWSER_FILEAPI_MOCK_URL_REQUEST_DELEGATE_H