Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / browser / fileapi / mock_url_request_delegate.h
bloba628f6ea5a424298b3a48d0060a1f1b746963947
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 ~MockURLRequestDelegate() override;
22 void OnResponseStarted(net::URLRequest* request) override;
23 void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
24 const std::string& response_data() const { return response_data_; }
26 private:
27 void ReadSome(net::URLRequest* request);
28 void ReceiveData(net::URLRequest* request, int bytes_read);
29 void RequestComplete();
31 scoped_refptr<net::IOBuffer> io_buffer_;
32 std::string response_data_;
35 } // namespace content
37 #endif // CONTENT_BROWSER_FILEAPI_MOCK_URL_REQUEST_DELEGATE_H