| 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_PUBLIC_TEST_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ | |
| 6 #define CONTENT_PUBLIC_TEST_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "net/url_request/url_request_context.h" | |
| 10 #include "net/url_request/url_request_job.h" | |
| 11 #include "net/url_request/url_request_job_factory_impl.h" | |
| 12 | |
| 13 namespace storage { | |
| 14 class FileSystemContext; | |
| 15 } | |
| 16 | |
| 17 namespace storage { | |
| 18 class BlobDataHandle; | |
| 19 class BlobStorageContext; | |
| 20 } | |
| 21 | |
| 22 namespace content { | |
| 23 | |
| 24 class MockBlobURLRequestContext : public net::URLRequestContext { | |
| 25 public: | |
| 26 MockBlobURLRequestContext(storage::FileSystemContext* file_system_context); | |
| 27 ~MockBlobURLRequestContext() override; | |
| 28 | |
| 29 storage::BlobStorageContext* blob_storage_context() const { | |
| 30 return blob_storage_context_.get(); | |
| 31 } | |
| 32 | |
| 33 private: | |
| 34 net::URLRequestJobFactoryImpl job_factory_; | |
| 35 std::unique_ptr<storage::BlobStorageContext> blob_storage_context_; | |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(MockBlobURLRequestContext); | |
| 38 }; | |
| 39 | |
| 40 class ScopedTextBlob { | |
| 41 public: | |
| 42 // Registers a blob with the given |id| that contains |data|. | |
| 43 ScopedTextBlob(const MockBlobURLRequestContext& request_context, | |
| 44 const std::string& blob_id, | |
| 45 const std::string& data); | |
| 46 ~ScopedTextBlob(); | |
| 47 | |
| 48 // Returns a BlobDataHandle referring to the scoped blob. | |
| 49 std::unique_ptr<storage::BlobDataHandle> GetBlobDataHandle(); | |
| 50 | |
| 51 private: | |
| 52 const std::string blob_id_; | |
| 53 storage::BlobStorageContext* context_; | |
| 54 std::unique_ptr<storage::BlobDataHandle> handle_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(ScopedTextBlob); | |
| 57 }; | |
| 58 | |
| 59 } // namespace content | |
| 60 | |
| 61 #endif // CONTENT_PUBLIC_TEST_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ | |
| OLD | NEW |