| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_FILEAPI_MOCK_URL_REQUEST_DELEGATE_H_ | |
| 6 #define CONTENT_BROWSER_FILEAPI_MOCK_URL_REQUEST_DELEGATE_H_ | |
| 7 | |
| 8 #include "net/base/io_buffer.h" | |
| 9 #include "net/url_request/url_request.h" | |
| 10 | |
| 11 namespace net { | |
| 12 class IOBuffer; | |
| 13 } | |
| 14 | |
| 15 namespace content { | |
| 16 | |
| 17 // A URL request delegate that receives the response body. | |
| 18 class MockURLRequestDelegate : public net::URLRequest::Delegate { | |
| 19 public: | |
| 20 MockURLRequestDelegate(); | |
| 21 ~MockURLRequestDelegate() override; | |
| 22 | |
| 23 void OnResponseStarted(net::URLRequest* request) override; | |
| 24 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; | |
| 25 const std::string& response_data() const { return response_data_; } | |
| 26 const net::IOBufferWithSize* metadata() const { return metadata_.get(); } | |
| 27 | |
| 28 private: | |
| 29 void ReadSome(net::URLRequest* request); | |
| 30 void ReceiveData(net::URLRequest* request, int bytes_read); | |
| 31 void RequestComplete(); | |
| 32 | |
| 33 scoped_refptr<net::IOBuffer> io_buffer_; | |
| 34 std::string response_data_; | |
| 35 scoped_refptr<net::IOBufferWithSize> metadata_; | |
| 36 }; | |
| 37 | |
| 38 } // namespace content | |
| 39 | |
| 40 #endif // CONTENT_BROWSER_FILEAPI_MOCK_URL_REQUEST_DELEGATE_H_ | |
| OLD | NEW |