| Index: content/browser/fileapi/blob_url_request_job_unittest.h
|
| diff --git a/content/browser/fileapi/blob_url_request_job_unittest.h b/content/browser/fileapi/blob_url_request_job_unittest.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e81b28a1dfdd13ccab093c0808ca9ce56f2076fc
|
| --- /dev/null
|
| +++ b/content/browser/fileapi/blob_url_request_job_unittest.h
|
| @@ -0,0 +1,60 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "net/url_request/url_request.h"
|
| +#include "net/url_request/url_request_job_factory.h"
|
| +
|
| +namespace fileapi {
|
| +class FileSystemContext;
|
| +}
|
| +
|
| +namespace net {
|
| +class IOBuffer;
|
| +}
|
| +
|
| +namespace webkit_blob {
|
| +class BlobData;
|
| +}
|
| +
|
| +namespace content {
|
| +
|
| +// A URL request delegate that receives the response body.
|
| +class MockURLRequestDelegate : public net::URLRequest::Delegate {
|
| + public:
|
| + MockURLRequestDelegate();
|
| + virtual ~MockURLRequestDelegate();
|
| +
|
| + virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
|
| + virtual void OnReadCompleted(net::URLRequest* request,
|
| + int bytes_read) OVERRIDE;
|
| + const std::string& response_data() const { return response_data_; }
|
| +
|
| + private:
|
| + void ReadSome(net::URLRequest* request);
|
| + void ReceiveData(net::URLRequest* request, int bytes_read);
|
| + void RequestComplete();
|
| +
|
| + scoped_refptr<net::IOBuffer> received_data_;
|
| + std::string response_data_;
|
| +};
|
| +
|
| +// A simple ProtocolHandler implementation to create BlobURLRequestJob.
|
| +class MockBlobProtocolHandler
|
| + : public net::URLRequestJobFactory::ProtocolHandler {
|
| + public:
|
| + // Caller owns |blob_data| and |file_system_context|.
|
| + MockBlobProtocolHandler(webkit_blob::BlobData* blob_data,
|
| + fileapi::FileSystemContext* file_system_context);
|
| +
|
| + // net::URLRequestJobFactory::ProtocolHandler override.
|
| + virtual net::URLRequestJob* MaybeCreateJob(
|
| + net::URLRequest* request,
|
| + net::NetworkDelegate* network_delegate) const OVERRIDE;
|
| +
|
| + private:
|
| + webkit_blob::BlobData* blob_data_;
|
| + fileapi::FileSystemContext* file_system_context_;
|
| +};
|
| +
|
| +} // namespace content
|
|
|