| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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 WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ | |
| 6 #define WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ | |
| 7 | |
| 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" | |
| 11 | |
| 12 namespace fileapi { | |
| 13 class FileSystemContext; | |
| 14 } | |
| 15 | |
| 16 namespace webkit_blob { | |
| 17 | |
| 18 class BlobDataHandle; | |
| 19 class BlobStorageContext; | |
| 20 | |
| 21 class MockBlobURLRequestContext : public net::URLRequestContext { | |
| 22 public: | |
| 23 MockBlobURLRequestContext(fileapi::FileSystemContext* file_system_context); | |
| 24 virtual ~MockBlobURLRequestContext(); | |
| 25 | |
| 26 BlobStorageContext* blob_storage_context() const { | |
| 27 return blob_storage_context_.get(); | |
| 28 } | |
| 29 | |
| 30 private: | |
| 31 net::URLRequestJobFactoryImpl job_factory_; | |
| 32 scoped_ptr<BlobStorageContext> blob_storage_context_; | |
| 33 | |
| 34 DISALLOW_COPY_AND_ASSIGN(MockBlobURLRequestContext); | |
| 35 }; | |
| 36 | |
| 37 class ScopedTextBlob { | |
| 38 public: | |
| 39 // Registers a blob with the given |id| that contains |data|. | |
| 40 ScopedTextBlob(const MockBlobURLRequestContext& request_context, | |
| 41 const std::string& blob_id, | |
| 42 const std::string& data); | |
| 43 ~ScopedTextBlob(); | |
| 44 | |
| 45 // Returns a BlobDataHandle referring to the scoped blob. | |
| 46 scoped_ptr<BlobDataHandle> GetBlobDataHandle(); | |
| 47 | |
| 48 private: | |
| 49 const std::string blob_id_; | |
| 50 BlobStorageContext* context_; | |
| 51 scoped_ptr<BlobDataHandle> handle_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(ScopedTextBlob); | |
| 54 }; | |
| 55 | |
| 56 } // namespace webkit_blob | |
| 57 | |
| 58 #endif // WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ | |
| OLD | NEW |