| 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, int net_error) 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 int request_status() { return request_status_; } | |
| 28 | |
| 29 private: | |
| 30 void ReadSome(net::URLRequest* request); | |
| 31 void ReceiveData(net::URLRequest* request, int bytes_read); | |
| 32 void RequestComplete(); | |
| 33 | |
| 34 scoped_refptr<net::IOBuffer> io_buffer_; | |
| 35 std::string response_data_; | |
| 36 scoped_refptr<net::IOBufferWithSize> metadata_; | |
| 37 | |
| 38 int request_status_; | |
| 39 }; | |
| 40 | |
| 41 } // namespace content | |
| 42 | |
| 43 #endif // CONTENT_BROWSER_FILEAPI_MOCK_URL_REQUEST_DELEGATE_H_ | |
| OLD | NEW |