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_PUBLIC_TEST_MOCK_BLOB_URL_REQUEST_CONTEXT_H_
6 #define CONTENT_PUBLIC_TEST_MOCK_BLOB_URL_REQUEST_CONTEXT_H_
8 #include "net/url_request/url_request_context.h"
9 #include "net/url_request/url_request_job.h"
10 #include "net/url_request/url_request_job_factory_impl.h"
13 class FileSystemContext
;
18 class BlobStorageContext
;
23 class MockBlobURLRequestContext
: public net::URLRequestContext
{
25 MockBlobURLRequestContext(storage::FileSystemContext
* file_system_context
);
26 virtual ~MockBlobURLRequestContext();
28 storage::BlobStorageContext
* blob_storage_context() const {
29 return blob_storage_context_
.get();
33 net::URLRequestJobFactoryImpl job_factory_
;
34 scoped_ptr
<storage::BlobStorageContext
> blob_storage_context_
;
36 DISALLOW_COPY_AND_ASSIGN(MockBlobURLRequestContext
);
39 class ScopedTextBlob
{
41 // Registers a blob with the given |id| that contains |data|.
42 ScopedTextBlob(const MockBlobURLRequestContext
& request_context
,
43 const std::string
& blob_id
,
44 const std::string
& data
);
47 // Returns a BlobDataHandle referring to the scoped blob.
48 scoped_ptr
<storage::BlobDataHandle
> GetBlobDataHandle();
51 const std::string blob_id_
;
52 storage::BlobStorageContext
* context_
;
53 scoped_ptr
<storage::BlobDataHandle
> handle_
;
55 DISALLOW_COPY_AND_ASSIGN(ScopedTextBlob
);
58 } // namespace content
60 #endif // CONTENT_PUBLIC_TEST_MOCK_BLOB_URL_REQUEST_CONTEXT_H_